Skip to content

Commit

Permalink
Make --frame optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Oct 15, 2022
1 parent 81eaea4 commit 7f2926b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions vspreview/core/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ class AbstractMainWindow(ExtendedMainWindow, QAbstractYAMLObjectSingleton):

@abstractmethod
def load_script(
self, script_path: Path, external_args: List[Tuple[str, str]] | None = None, reloading: bool = False,
start_frame: int = 0) -> None:
self, script_path: Path, external_args: List[Tuple[str, str]] | None = None, reloading: bool = False,
start_frame: int | None = None
) -> None:
raise NotImplementedError

@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion vspreview/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def main() -> None:
app = Application(sys.argv)
main_window = MainWindow(Path(os.getcwd()) if args.preserve_cwd else script_path.parent)
main_window.load_script(
script_path, [tuple(a.split('=', maxsplit=1)) for a in args.arg or []], False, start_frame=args.frame or 0
script_path, [tuple(a.split('=', maxsplit=1)) for a in args.arg or []], False, start_frame=args.frame or None
)
main_window.show()

Expand Down
5 changes: 3 additions & 2 deletions vspreview/main/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def patch_dark_stylesheet(self, stylesheet: str) -> str:

def load_script(
self, script_path: Path, external_args: List[Tuple[str, str]] | None = None, reloading: bool = False,
start_frame: int = 0
start_frame: int | None = None
) -> None:
self.external_args = external_args or []

Expand Down Expand Up @@ -282,7 +282,8 @@ def load_script(

if not reloading:
self.switch_output(self.settings.output_index)
self.switch_frame(Frame(start_frame))
if start_frame is not None:
self.switch_frame(Frame(start_frame))

@set_status_label('Loading...')
def load_storage(self) -> None:
Expand Down

0 comments on commit 7f2926b

Please sign in to comment.