USB UI improvements
This commit is contained in:
parent
cc672e1d24
commit
ee1a99e19b
|
@ -74,7 +74,7 @@ def clear(queue_to_clear):
|
||||||
|
|
||||||
def update_dropdown(dropdown):
|
def update_dropdown(dropdown):
|
||||||
dropdown["values"] = ["[Select port]"] + [
|
dropdown["values"] = ["[Select port]"] + [
|
||||||
f"{port.device} ({port.description})"
|
f"{port.device}: {port.description}"
|
||||||
for port in serial.tools.list_ports.comports()
|
for port in serial.tools.list_ports.comports()
|
||||||
]
|
]
|
||||||
dropdown.current(newindex=0)
|
dropdown.current(newindex=0)
|
||||||
|
@ -82,7 +82,7 @@ def update_dropdown(dropdown):
|
||||||
|
|
||||||
def run_ui():
|
def run_ui():
|
||||||
def selected(event):
|
def selected(event):
|
||||||
selection = dropdown.get().split()[0]
|
selection = dropdown.get().split(": ", 1)[0]
|
||||||
if not selection.startswith("["):
|
if not selection.startswith("["):
|
||||||
clear(updates)
|
clear(updates)
|
||||||
run(selection, window, updates)
|
run(selection, window, updates)
|
||||||
|
@ -96,7 +96,7 @@ def run_ui():
|
||||||
if purpose == "LocationUpdate":
|
if purpose == "LocationUpdate":
|
||||||
updated.config(text="Last updated: " + content["time"])
|
updated.config(text="Last updated: " + content["time"])
|
||||||
elif purpose == "Connected":
|
elif purpose == "Connected":
|
||||||
status.config(text="Connected to " + content)
|
status.config(text="Connected to " + dropdown.get())
|
||||||
dropdown.pack_forget()
|
dropdown.pack_forget()
|
||||||
refresh.pack_forget()
|
refresh.pack_forget()
|
||||||
elif purpose == "Disconnected":
|
elif purpose == "Disconnected":
|
||||||
|
@ -132,6 +132,7 @@ def run_ui():
|
||||||
window.bind("<<newData>>", new_data)
|
window.bind("<<newData>>", new_data)
|
||||||
|
|
||||||
updates = queue.Queue()
|
updates = queue.Queue()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))
|
window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))
|
||||||
except tk.TclError:
|
except tk.TclError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user