Skip to content

Commit 616a096

Browse files
authored
add --slow option to generate command to increase preview timeout (#1051)
* add --slow option to generate command to increase preview timeout * format * update changelog * update commit hash
1 parent 50e6b2b commit 616a096

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change
99

1010
## [Unreleased]
1111

12+
### Added
13+
14+
- New `--slow` option for `pretext generate` to increase the timeout for interactive preview generation.
15+
1216
### Changed
1317

1418
- When an update is available, report this on every run of pretext.

pretext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
VERSION = get_version("pretext", Path(__file__).parent.parent)
2020

2121

22-
CORE_COMMIT = "016b805e8716fc8d4246027f3e999c566a57442c"
22+
CORE_COMMIT = "6b68dbd2e18a547b70a2b4d004bde2de102a6d19"
2323

2424

2525
def activate() -> None:

pretext/cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,13 @@ def build(
705705
is_flag=True,
706706
help="Force generation of assets; do not rely on assets in the cache.",
707707
)
708+
@click.option(
709+
"-s",
710+
"--slow",
711+
is_flag=True,
712+
default=False,
713+
help="Increase the timeout for capturing screenshots of interactive elements. Only needed if some interactive previews are not rendering correctly.",
714+
)
708715
@click.pass_context
709716
@nice_errors
710717
def generate(
@@ -716,6 +723,7 @@ def generate(
716723
xmlid: Optional[str],
717724
clean: bool,
718725
force: bool,
726+
slow: bool,
719727
) -> None:
720728
"""
721729
Generate specified (or all) assets for the default target (first target in "project.ptx"). Asset "generation" is typically
@@ -754,6 +762,7 @@ def generate(
754762
xmlid=xmlid,
755763
clean=clean,
756764
skip_cache=force,
765+
slow=slow,
757766
)
758767
# Check if there are errors reported by the build by looking at the error_flush_handler.
759768
if utils.has_errors(error_flush_handler):

pretext/project/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ def generate_assets(
877877
xmlid: t.Optional[str] = None,
878878
clean: bool = False,
879879
skip_cache: bool = False,
880+
slow: bool = False,
880881
) -> None:
881882
"""
882883
Generates assets for the current target. Options:
@@ -1145,6 +1146,7 @@ def generate_assets(
11451146
stringparams=stringparams_copy,
11461147
xmlid_root=xmlid,
11471148
dest_dir=self.generated_dir_abspath() / "preview",
1149+
method="slow" if slow else "fast",
11481150
)
11491151
successful_assets.append("interactive")
11501152
except Exception as e:

0 commit comments

Comments
 (0)