Add "last updated" to mobile mode
This commit is contained in:
parent
61a9c2ca92
commit
d36b75810a
|
@ -18,6 +18,12 @@ class PostHandler(tornado.web.RequestHandler):
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
navpoint.content.content = self.request.body
|
navpoint.content.content = self.request.body
|
||||||
|
intercom.put(
|
||||||
|
"Updated",
|
||||||
|
navpoint.content.content.decode("utf-8")
|
||||||
|
.split("<description>")[1]
|
||||||
|
.split("</description>")[0],
|
||||||
|
)
|
||||||
self.write("Navpoint")
|
self.write("Navpoint")
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,16 +42,12 @@ def run_in_thread(ip, token):
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
def new_data(purpose, content):
|
||||||
|
if purpose == "Updated":
|
||||||
|
updated.config(text="Last updated: " + content)
|
||||||
|
|
||||||
ip = navpoint.get_ip.get_ip()
|
ip = navpoint.get_ip.get_ip()
|
||||||
token = secrets.token_urlsafe()
|
token = secrets.token_urlsafe()
|
||||||
threading.Thread(
|
|
||||||
target=run_in_thread,
|
|
||||||
args=(
|
|
||||||
ip,
|
|
||||||
token,
|
|
||||||
),
|
|
||||||
daemon=True,
|
|
||||||
).start()
|
|
||||||
|
|
||||||
link = f"http://{ip}:8888/{token}"
|
link = f"http://{ip}:8888/{token}"
|
||||||
|
|
||||||
|
@ -56,6 +58,9 @@ def run():
|
||||||
label = tk.Label(window, text="QR code here...")
|
label = tk.Label(window, text="QR code here...")
|
||||||
label.pack()
|
label.pack()
|
||||||
|
|
||||||
|
updated = ttk.Label(window, text="Waiting for location")
|
||||||
|
updated.pack()
|
||||||
|
|
||||||
image = tk.BitmapImage(
|
image = tk.BitmapImage(
|
||||||
data=pyqrcode.create(link).xbm(scale=int(window.winfo_fpixels("2m")))
|
data=pyqrcode.create(link).xbm(scale=int(window.winfo_fpixels("2m")))
|
||||||
)
|
)
|
||||||
|
@ -69,4 +74,16 @@ def run():
|
||||||
except tk.TclError:
|
except tk.TclError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
global intercom
|
||||||
|
intercom = navpoint.intercom.Intercom(window, new_data)
|
||||||
|
|
||||||
|
threading.Thread(
|
||||||
|
target=run_in_thread,
|
||||||
|
args=(
|
||||||
|
ip,
|
||||||
|
token,
|
||||||
|
),
|
||||||
|
daemon=True,
|
||||||
|
).start()
|
||||||
|
|
||||||
window.mainloop()
|
window.mainloop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user