From ee1a99e19ba3880e07c465919da58a5fea9eb434 Mon Sep 17 00:00:00 2001 From: Samuel Sloniker Date: Mon, 22 Jul 2024 15:27:16 -0700 Subject: [PATCH] USB UI improvements --- navpoint/usb.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/navpoint/usb.py b/navpoint/usb.py index 8e0bb24..36239ca 100644 --- a/navpoint/usb.py +++ b/navpoint/usb.py @@ -74,7 +74,7 @@ def clear(queue_to_clear): def update_dropdown(dropdown): dropdown["values"] = ["[Select port]"] + [ - f"{port.device} ({port.description})" + f"{port.device}: {port.description}" for port in serial.tools.list_ports.comports() ] dropdown.current(newindex=0) @@ -82,7 +82,7 @@ def update_dropdown(dropdown): def run_ui(): def selected(event): - selection = dropdown.get().split()[0] + selection = dropdown.get().split(": ", 1)[0] if not selection.startswith("["): clear(updates) run(selection, window, updates) @@ -96,7 +96,7 @@ def run_ui(): if purpose == "LocationUpdate": updated.config(text="Last updated: " + content["time"]) elif purpose == "Connected": - status.config(text="Connected to " + content) + status.config(text="Connected to " + dropdown.get()) dropdown.pack_forget() refresh.pack_forget() elif purpose == "Disconnected": @@ -132,6 +132,7 @@ def run_ui(): window.bind("<>", new_data) updates = queue.Queue() + try: window.iconbitmap(navpoint.fix_path.fix_path("icon.ico")) except tk.TclError: