61 lines
1.6 KiB
Python
Executable File
61 lines
1.6 KiB
Python
Executable File
import tkinter as tk
|
|
from tkinter import ttk
|
|
import navpoint.fix_path
|
|
import navpoint.local_server
|
|
import navpoint.phone_server
|
|
import navpoint.usb
|
|
import navpoint.about
|
|
|
|
def _version():
|
|
with open(navpoint.fix_path.fix_path("README.md")) as f:
|
|
return f.readline().split()[3]
|
|
|
|
def run():
|
|
def _usb_clicked():
|
|
window.destroy()
|
|
global mode
|
|
mode = "usb"
|
|
|
|
def _mobile_clicked():
|
|
window.destroy()
|
|
global mode
|
|
mode = "mobile"
|
|
|
|
window = tk.Tk(className="navpoint")
|
|
window.title("Navpoint")
|
|
window.resizable(width=False, height=False)
|
|
|
|
global mode
|
|
mode = ""
|
|
|
|
ttk.Label(window, text="How should Navpoint obtain location data?").pack()
|
|
usb_button = ttk.Button(
|
|
window, text="USB GPS receiver (NMEA)", command=_usb_clicked
|
|
)
|
|
usb_button.pack()
|
|
mobile_button = ttk.Button(
|
|
window, text="Phone running Navpoint Mobile", command=_mobile_clicked
|
|
)
|
|
mobile_button.pack()
|
|
ttk.Separator(window, orient="horizontal").pack(fill="x", pady=3)
|
|
ttk.Label(window, text="Navpoint is free and open-source.").pack()
|
|
about_button = ttk.Button(
|
|
window, text="About Navpoint " + _version(), command=navpoint.about.about
|
|
)
|
|
about_button.pack()
|
|
|
|
try:
|
|
window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))
|
|
except tk.TclError:
|
|
pass
|
|
|
|
navpoint.about.run_server()
|
|
window.mainloop()
|
|
|
|
if mode == "mobile":
|
|
navpoint.local_server.run()
|
|
link = navpoint.phone_server.run()
|
|
elif mode == "usb":
|
|
navpoint.local_server.run()
|
|
navpoint.usb.run_ui()
|