From 1cde711445b6886366559a021e03ce801a5d2d72 Mon Sep 17 00:00:00 2001 From: builder555 <85308587+builder555@users.noreply.github.com> Date: Wed, 31 Jan 2024 20:54:34 -0500 Subject: [PATCH 1/4] fix: better type annotations --- backend/io_utils.py | 4 ++-- backend/main.py | 6 +++--- backend/pinecil_monitor.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) 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: From 639940ceb0c5dcb2ddeae1f67fb6bf50f32919bc Mon Sep 17 00:00:00 2001 From: builder555 <85308587+builder555@users.noreply.github.com> Date: Wed, 31 Jan 2024 20:55:12 -0500 Subject: [PATCH 2/4] fix: add shortcut to format with black --- backend/Pipfile | 1 + 1 file changed, 1 insertion(+) 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 From f20a562d90b964c72ab3e24c3cfbb91451066bf2 Mon Sep 17 00:00:00 2001 From: builder555 <85308587+builder555@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:06:49 -0400 Subject: [PATCH 3/4] fix: bug when holding a mouse key and leaving + or - button --- ui/src/components/TheWorkView.vue | 4 ++++ 1 file changed, 4 insertions(+) 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" > From 25bf589248bc9c8474472b08547981eafffe3282 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 21 Sep 2024 02:08:13 +0000 Subject: [PATCH 4/4] chore: bump version to 2.2.9 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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