diff --git a/cromulant/args.py b/cromulant/args.py index 5115db5..58fb192 100644 --- a/cromulant/args.py +++ b/cromulant/args.py @@ -18,6 +18,7 @@ class Args: width: int = 0 height: int = 0 program: str = "" + speed: str = "" @staticmethod def prepare() -> None: @@ -42,6 +43,7 @@ class Args: "width", "height", "program", + "speed", ] for n_item in normals: diff --git a/cromulant/argspec.py b/cromulant/argspec.py index d99a780..bc07351 100644 --- a/cromulant/argspec.py +++ b/cromulant/argspec.py @@ -123,3 +123,10 @@ class ArgSpec: type=str, info="The internal name of the program", ) + + ArgSpec.add_argument( + "speed", + type=str, + choices=["fast", "normal", "slow"], + info="Use this update speed", + ) diff --git a/cromulant/settings.py b/cromulant/settings.py index 1e22bfb..922e096 100644 --- a/cromulant/settings.py +++ b/cromulant/settings.py @@ -1,5 +1,6 @@ from __future__ import annotations +from .args import Args from .window import Window from .storage import Storage @@ -17,8 +18,14 @@ class Settings: @staticmethod def prepare() -> None: settings = Storage.get_settings() + changed = False + + if Args.speed: + Settings.speed = Args.speed + changed = True + else: + Settings.speed = settings.get("speed", "normal") - Settings.speed = settings.get("speed", "normal") speed = Settings.speed.capitalize() Window.speed.setCurrentText(speed) @@ -29,6 +36,9 @@ class Settings: Settings.merge = settings.get("merge", True) + if changed: + Settings.save() + @staticmethod def save() -> None: settings = {