This commit is contained in:
Auric Vente 2024-07-19 20:30:37 -06:00
parent af9daf2f1c
commit 4f1aec1bee
3 changed files with 23 additions and 4 deletions

View File

@ -22,9 +22,9 @@ class Config:
image_size: int = 80
space_1: int = 20
max_messages: int = 200
loop_delay_fast: int = 3_000
loop_delay_normal: int = 60_000
loop_delay_slow: int = 120_000
loop_delay_fast: int = 1000 * 5
loop_delay_normal: int = 1000 * 60 * 1
loop_delay_slow: int = 1000 * 60 * 5
hatch_burst: int = 3
font_size: int = 20
info_separator: str = " - "

View File

@ -115,3 +115,17 @@ class Utils:
dt_object = datetime.fromtimestamp(timestamp)
hour = dt_object.strftime("%I").lstrip("0")
return dt_object.strftime(f"%b %d %Y - {hour}:%M %p")
@staticmethod
def get_seconds(msecs: int) -> str:
seconds = msecs // 1000
if seconds < 60:
return f"{seconds} seconds"
minutes = seconds // 60
if minutes == 1:
return "1 minute"
return f"{minutes} minutes"

View File

@ -26,6 +26,7 @@ from PySide6.QtMultimedia import QMediaPlayer # type: ignore
from PySide6.QtMultimedia import QAudioOutput
from .config import Config
from .utils import Utils
class SpecialButton(QPushButton): # type: ignore
@ -149,7 +150,11 @@ class Window:
btn_terminate.middleClicked.connect(lambda: Ants.terminate_all())
Window.speed = QComboBox()
Window.speed.setToolTip("Change the speed of the updates")
tooltip = "Change the speed of the loop\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)}"
Window.speed.setToolTip(tooltip)
Window.speed.addItems(["Fast", "Normal", "Slow"])
Window.speed.setCurrentIndex(1)
Window.speed.currentIndexChanged.connect(Game.update_speed)