USB UI improvements

This commit is contained in:
Samuel Sloniker 2024-07-22 15:27:16 -07:00
parent cc672e1d24
commit ee1a99e19b

View File

@ -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("<<newData>>", new_data)
updates = queue.Queue()
try:
window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))
except tk.TclError: