Mods
This commit is contained in:
parent
ef60099067
commit
750abdff39
|
@ -21,6 +21,9 @@ class Args:
|
||||||
program: str = ""
|
program: str = ""
|
||||||
speed: str = ""
|
speed: str = ""
|
||||||
clean: bool = False
|
clean: bool = False
|
||||||
|
fast_minutes: float = 0.0
|
||||||
|
normal_minutes: float = 0.0
|
||||||
|
slow_minutes: float = 0.0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
|
@ -47,6 +50,9 @@ class Args:
|
||||||
"program",
|
"program",
|
||||||
"speed",
|
"speed",
|
||||||
"clean",
|
"clean",
|
||||||
|
"fast_minutes",
|
||||||
|
"normal_minutes",
|
||||||
|
"slow_minutes",
|
||||||
]
|
]
|
||||||
|
|
||||||
for n_item in normals:
|
for n_item in normals:
|
||||||
|
|
|
@ -142,3 +142,21 @@ class ArgSpec:
|
||||||
action="store_true",
|
action="store_true",
|
||||||
info="Start with clean ants data",
|
info="Start with clean ants data",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ArgSpec.add_argument(
|
||||||
|
"fast_minutes",
|
||||||
|
type=float,
|
||||||
|
info="The number of minutes between fast updates",
|
||||||
|
)
|
||||||
|
|
||||||
|
ArgSpec.add_argument(
|
||||||
|
"normal_minutes",
|
||||||
|
type=float,
|
||||||
|
info="The number of minutes between normal updates",
|
||||||
|
)
|
||||||
|
|
||||||
|
ArgSpec.add_argument(
|
||||||
|
"slow_minutes",
|
||||||
|
type=float,
|
||||||
|
info="The number of minutes between slow updates",
|
||||||
|
)
|
||||||
|
|
|
@ -24,9 +24,9 @@ class Config:
|
||||||
image_size: int = 80
|
image_size: int = 80
|
||||||
space_1: int = 18
|
space_1: int = 18
|
||||||
max_updates: int = 300
|
max_updates: int = 300
|
||||||
loop_delay_fast: int = 1000 * 5
|
fast_minutes: float = (1 / 60) * 5 # 5 seconds
|
||||||
loop_delay_normal: int = 1000 * 60 * 1
|
normal_minutes: float = 1
|
||||||
loop_delay_slow: int = 1000 * 60 * 5
|
slow_minutes: float = 5
|
||||||
font_size: int = 20
|
font_size: int = 20
|
||||||
info_separator: str = " - "
|
info_separator: str = " - "
|
||||||
font_path: Path
|
font_path: Path
|
||||||
|
|
|
@ -348,17 +348,19 @@ class Game:
|
||||||
speed = Settings.speed
|
speed = Settings.speed
|
||||||
|
|
||||||
if speed == "fast":
|
if speed == "fast":
|
||||||
delay = Config.loop_delay_fast
|
minutes = Args.fast_minutes or Config.fast_minutes
|
||||||
elif speed == "normal":
|
elif speed == "normal":
|
||||||
delay = Config.loop_delay_normal
|
minutes = Args.normal_minutes or Config.normal_minutes
|
||||||
elif speed == "slow":
|
elif speed == "slow":
|
||||||
delay = Config.loop_delay_slow
|
minutes = Args.slow_minutes or Config.slow_minutes
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
Game.timer = QTimer()
|
Game.timer = QTimer()
|
||||||
Game.timer.timeout.connect(Game.get_status)
|
Game.timer.timeout.connect(Game.get_status)
|
||||||
Game.timer.start(delay)
|
|
||||||
|
msecs = minutes * 60 * 1000
|
||||||
|
Game.timer.start(msecs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_speed() -> None:
|
def update_speed() -> None:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.1.0",
|
"version": "2.2.0",
|
||||||
"title": "Cromulant",
|
"title": "Cromulant",
|
||||||
"program": "cromulant",
|
"program": "cromulant",
|
||||||
"author": "madprops",
|
"author": "madprops",
|
||||||
|
|
|
@ -141,18 +141,20 @@ class Utils:
|
||||||
return dt_object.strftime(f"%b %d %Y - {hour}:%M %p")
|
return dt_object.strftime(f"%b %d %Y - {hour}:%M %p")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_seconds(msecs: int) -> str:
|
def get_timeword(minutes: float) -> str:
|
||||||
seconds = msecs // 1000
|
if minutes < 1:
|
||||||
|
seconds = round(minutes * 60)
|
||||||
|
|
||||||
|
if seconds == 1:
|
||||||
|
return "1 second"
|
||||||
|
|
||||||
if seconds < 60:
|
if seconds < 60:
|
||||||
return f"{seconds} seconds"
|
return f"{seconds} seconds"
|
||||||
|
|
||||||
minutes = seconds // 60
|
|
||||||
|
|
||||||
if minutes == 1:
|
if minutes == 1:
|
||||||
return "1 minute"
|
return "1 minute"
|
||||||
|
|
||||||
return f"{minutes} minutes"
|
return f"{round(minutes)} minutes"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def random_country(ignore: list[str]) -> str:
|
def random_country(ignore: list[str]) -> str:
|
||||||
|
|
|
@ -272,9 +272,16 @@ class Window:
|
||||||
|
|
||||||
Window.speed = SpecialComboBox()
|
Window.speed = SpecialComboBox()
|
||||||
tooltip = "The speed of the updates\n"
|
tooltip = "The speed of the updates\n"
|
||||||
tooltip += f"Fast: {Utils.get_seconds(Config.loop_delay_fast)}\n"
|
|
||||||
tooltip += f"Normal: {Utils.get_seconds(Config.loop_delay_normal)}\n"
|
fast = Args.fast_minutes or Config.fast_minutes
|
||||||
tooltip += f"Slow: {Utils.get_seconds(Config.loop_delay_slow)}\n"
|
tooltip += f"Fast: {Utils.get_timeword(fast)}\n"
|
||||||
|
|
||||||
|
normal = Args.normal_minutes or Config.normal_minutes
|
||||||
|
tooltip += f"Normal: {Utils.get_timeword(normal)}\n"
|
||||||
|
|
||||||
|
slow = Args.slow_minutes or Config.slow_minutes
|
||||||
|
tooltip += f"Slow: {Utils.get_timeword(slow)}\n"
|
||||||
|
|
||||||
tooltip += "Middle Click: Slow"
|
tooltip += "Middle Click: Slow"
|
||||||
Window.speed.setToolTip(tooltip)
|
Window.speed.setToolTip(tooltip)
|
||||||
Window.speed.addItems(["Fast", "Normal", "Slow", "Paused"])
|
Window.speed.addItems(["Fast", "Normal", "Slow", "Paused"])
|
||||||
|
|
Loading…
Reference in New Issue