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