diff --git a/app_state.py b/app_state.py index 449156f..5a83730 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.142" +VERSION = "0.0.0.143" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/connect_dialog.py b/connect_dialog.py index b5455a1..598d86e 100644 --- a/connect_dialog.py +++ b/connect_dialog.py @@ -201,7 +201,7 @@ class DiscoverDialog: hdr, text="Discover", command=self._do_discover, width=10) self._btn_discover.pack(side=tk.RIGHT) - self._wait_var = tk.StringVar(value="10") + self._wait_var = tk.StringVar(value="2") ttk.Entry(hdr, textvariable=self._wait_var, width=4, justify="center").pack( side=tk.RIGHT, padx=(0, 4)) ttk.Label(hdr, text="Wait (s):").pack(side=tk.RIGHT, padx=(8, 2)) @@ -248,14 +248,23 @@ class DiscoverDialog: self._btn_connect.pack(side=tk.RIGHT, padx=(0, 8)) self._dlg.bind("", lambda e: self._dlg.destroy()) + self._dlg.bind("", self._on_return) self._dlg.update_idletasks() x = parent.winfo_x() + (parent.winfo_width() - self._dlg.winfo_width()) // 2 y = parent.winfo_y() + (parent.winfo_height() - self._dlg.winfo_height()) // 2 self._dlg.geometry(f"+{x}+{y}") + self._dlg.lift() + self._dlg.focus_force() + self._btn_discover.focus_set() # ── Discovery ────────────────────────────────────────────────── + def _on_return(self, event=None): + if str(self._btn_discover.cget("state")) != "disabled": + self._do_discover() + return "break" + def _do_discover(self): try: port_int = int(self._port_var.get().strip()) @@ -265,7 +274,7 @@ class DiscoverDialog: try: wait_time = max(1, min(60, int(self._wait_var.get().strip()))) except ValueError: - wait_time = 10 + wait_time = 2 self._btn_discover.config(state="disabled") self._status_label.config(text="Discovering devices...", foreground="#666666")