diff --git a/backend/Pipfile b/backend/Pipfile index 32b9b99d..2f2d89bd 100644 --- a/backend/Pipfile +++ b/backend/Pipfile @@ -23,3 +23,4 @@ python_version = "3" [scripts] "server" = "python main.py" "test" = "pytest" +"format" = "black ." \ No newline at end of file diff --git a/backend/io_utils.py b/backend/io_utils.py index d414b739..61d3af02 100644 --- a/backend/io_utils.py +++ b/backend/io_utils.py @@ -3,7 +3,7 @@ import argparse -def get_resource_path(relative_path, max_levels=3): +def get_resource_path(relative_path: str, max_levels: int = 3): """Get the absolute path to the resource, works for development and for PyInstaller""" # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = getattr(sys, "_MEIPASS", os.path.abspath(".")) @@ -19,7 +19,7 @@ def get_resource_path(relative_path, max_levels=3): return os.path.join(base_path, relative_path) -def parse_cmd_args(default_host, default_port) -> argparse.Namespace: +def parse_cmd_args(default_host: str, default_port: int) -> argparse.Namespace: parser = argparse.ArgumentParser(description="PineSAM - Pinecil v2 Control") parser.add_argument( "host", diff --git a/backend/main.py b/backend/main.py index c5bb46d0..562a1f74 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,6 +1,5 @@ import asyncio import os -import sys from pinecil_monitor import PinecilMonitor, PinecilFinder from ws_server import CommandProcessor, WebSocketHandler from version_checker import VersionChecker @@ -8,6 +7,7 @@ import webbrowser from io_utils import parse_cmd_args, get_resource_path from rich.logging import RichHandler +import argparse LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO").upper() timestamp_format = "%H:%M:%S" @@ -22,7 +22,7 @@ DEFAULT_PORT = 8080 -async def handle_ui_opening(args): +async def handle_ui_opening(args: argparse.Namespace): host = args.host if args.host != "0.0.0.0" else "localhost" if not args.no_open: await asyncio.sleep(5) @@ -32,7 +32,7 @@ async def handle_ui_opening(args): logging.info(f"Open browser at http://{host}:{args.port}") -async def main(stop_event=asyncio.Event()): +async def main(stop_event: asyncio.Event = asyncio.Event()): args = parse_cmd_args(DEFAULT_HOST, DEFAULT_PORT) if not args.host or not args.port: return diff --git a/backend/pinecil_monitor.py b/backend/pinecil_monitor.py index 0e51a2b6..e0dba311 100644 --- a/backend/pinecil_monitor.py +++ b/backend/pinecil_monitor.py @@ -33,10 +33,10 @@ def __init__(self, finder: PinecilFinder, broadcast_func: Callable): self.should_announce_not_found = True @property - def pinecil(self): + def pinecil(self) -> Pinecil | None: return self.pinecil_finder.selected - async def monitor(self, stop_event): + async def monitor(self, stop_event: asyncio.Event): logging.info("Starting pinecil monitor") while not stop_event.is_set(): if not self.pinecil_finder.pinecils: diff --git a/ui/src/components/TheWorkView.vue b/ui/src/components/TheWorkView.vue index ea165c80..a6113356 100644 --- a/ui/src/components/TheWorkView.vue +++ b/ui/src/components/TheWorkView.vue @@ -80,6 +80,8 @@ const setExactTemperature = (temp) => { @mousedown.left="onChangeTempBtnDown(-1)" @touchend="onChangeTempBtnUp" @mouseup="onChangeTempBtnUp" + @mouseleave="onChangeTempBtnUp" + @touchleave="onChangeTempBtnUp" > @@ -90,6 +92,8 @@ const setExactTemperature = (temp) => { @mousedown.left="onChangeTempBtnDown(1)" @touchend="onChangeTempBtnUp" @mouseup="onChangeTempBtnUp" + @touchleave="onChangeTempBtnUp" + @mouseleave="onChangeTempBtnUp" > diff --git a/version.txt b/version.txt index bda8fbec..a6333e40 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.2.6 +2.2.9