-
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathbanner_frame.py
More file actions
671 lines (592 loc) · 23.1 KB
/
Copy pathbanner_frame.py
File metadata and controls
671 lines (592 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
"""
banner_frame.py
Banner frame class for PyGPSClient application.
This handles the top banner which prominently displays the current coordinates and status.
Created on 13 Sep 2020
:author: semuadmin (Steve Smith)
:copyright: 2020 semuadmin
:license: BSD 3-Clause
"""
from tkinter import NE, NW, SUNKEN, Button, Frame, Label, N, W
from PIL import Image, ImageTk
from pynmeagps.nmeahelpers import latlon2dmm, latlon2dms, llh2ecef
from pygpsclient.globals import (
BGCOL,
CLICK_CURSOR,
CONNECTED,
CONNECTED_FILE,
CONNECTED_NTRIP,
CONNECTED_SOCKET,
CONNECTED_SPARTNIP,
CONNECTED_SPARTNLB,
DMM,
DMS,
ECEF,
ERRCOL,
FGCOL,
ICON_BLANK,
ICON_CONN,
ICON_CONTRACT,
ICON_DISCONN,
ICON_EXPAND,
ICON_LOGREAD,
ICON_NOCLIENT,
ICON_NTRIPCONFIG,
ICON_SERIAL,
ICON_SOCKET,
ICON_SPARTNCONFIG,
ICON_TRANSMIT,
UI,
UIK,
UMK,
)
from pygpsclient.helpers import (
dop2str,
m2ft,
ms2kmph,
ms2knots,
ms2mph,
scale_font,
unused_sats,
)
from pygpsclient.strings import DGPSYES, NA
M2MILES = 5280
FONTBASE = 12
FONTSCALE = 90
class BannerFrame(Frame):
"""
Banner frame class.
"""
def __init__(self, app: Frame, parent: Frame, *args, **kwargs):
"""
Constructor.
:param Frame app: reference to main tkinter application
:param Frame parent: reference to parent frame
:param args: optional args to pass to Frame parent class
:param kwargs: optional kwargs to pass to Frame parent class
"""
self.__app = app # Reference to main application class
self.__master = self.__app.appmaster # Reference to root class (Tk)
self._status = False
self._show_advanced = False
self._img_conn = ImageTk.PhotoImage(Image.open(ICON_CONN))
self._img_serial = ImageTk.PhotoImage(Image.open(ICON_SERIAL))
self._img_socket = ImageTk.PhotoImage(Image.open(ICON_SOCKET))
self._img_file = ImageTk.PhotoImage(Image.open(ICON_LOGREAD))
self._img_disconn = ImageTk.PhotoImage(Image.open(ICON_DISCONN))
self._img_expand = ImageTk.PhotoImage(Image.open(ICON_EXPAND))
self._img_contract = ImageTk.PhotoImage(Image.open(ICON_CONTRACT))
self._img_transmit = ImageTk.PhotoImage(Image.open(ICON_TRANSMIT))
self._img_noclient = ImageTk.PhotoImage(Image.open(ICON_NOCLIENT))
self._img_ntrip = ImageTk.PhotoImage(Image.open(ICON_NTRIPCONFIG))
self._img_spartn = ImageTk.PhotoImage(Image.open(ICON_SPARTNCONFIG))
self._img_blank = ImageTk.PhotoImage(Image.open(ICON_BLANK))
self._sep = False
super().__init__(parent, *args, **kwargs)
self.width, self.height = self.get_size()
self._body()
self._do_layout()
self._attach_events()
def _body(self):
"""
Set up frame and widgets.
"""
for i in range(2, 5):
self.grid_columnconfigure(i, weight=1)
self.grid_rowconfigure(0, weight=1)
self.grid_rowconfigure(1, weight=1)
self._frm_connect = Frame(self, bg=BGCOL)
self._frm_toggle = Frame(self, bg=BGCOL)
self._frm_basic = Frame(self, bg=BGCOL, relief=SUNKEN)
self._frm_advanced = Frame(self, bg=BGCOL)
self._frm_advanced2 = Frame(self, bg=BGCOL)
self._lbl_clients = Label(
self._frm_connect, bg=BGCOL, fg="green", width=2, anchor=W
)
self._lbl_ltime = Label(
self._frm_basic,
text="utc:",
bg=BGCOL,
fg=FGCOL,
anchor=N,
)
self._lbl_llat = Label(
self._frm_basic, text="lat:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_llon = Label(
self._frm_basic, text="lon:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lfix = Label(
self._frm_basic, text="fix:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._btn_toggle = Button(
self._frm_toggle,
width=28,
height=22,
command=self._toggle_advanced,
image=self._img_expand,
cursor=CLICK_CURSOR,
)
self._lbl_lhmsl = Label(
self._frm_advanced, text="hmsl:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lhae = Label(
self._frm_advanced,
text="hae:",
bg=BGCOL,
fg=FGCOL,
anchor=N,
cursor=CLICK_CURSOR,
)
self._lbl_lspd = Label(
self._frm_advanced, text="speed:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_ltrk = Label(
self._frm_advanced, text="track:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lsiv = Label(
self._frm_advanced2, text="siv:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lsip = Label(
self._frm_advanced2, text="sip:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lpdop = Label(
self._frm_advanced2, text="pdop:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lacc = Label(
self._frm_advanced2, text="acc:", bg=BGCOL, fg=FGCOL, anchor=N
)
self._lbl_lcorr = Label(
self._frm_advanced2,
text="corr:",
bg=BGCOL,
fg=FGCOL,
anchor=N,
)
self._lbl_status_preset = Label(
self._frm_connect, bg=BGCOL, image=self._img_conn
)
self._lbl_rtk_preset = Label(self._frm_connect, bg=BGCOL, image=self._img_blank)
self._lbl_transmit_preset = Label(
self._frm_connect, bg=BGCOL, image=self._img_blank
)
self._lbl_time = Label(self._frm_basic, bg=BGCOL, fg="cyan", width=15, anchor=W)
self._lbl_lat = Label(
self._frm_basic, bg=BGCOL, fg="orange", width=16, anchor=W
)
self._lbl_lon = Label(
self._frm_basic, bg=BGCOL, fg="orange", width=17, anchor=W
)
self._lbl_fix = Label(self._frm_basic, bg=BGCOL, fg="white", width=10, anchor=W)
self._lbl_hmsl = Label(
self._frm_advanced, bg=BGCOL, fg="orange", width=13, anchor=W
)
self._lbl_hae = Label(
self._frm_advanced,
bg=BGCOL,
fg="orange",
width=13,
anchor=W,
cursor=CLICK_CURSOR,
)
self._lbl_spd = Label(
self._frm_advanced, bg=BGCOL, fg="deepskyblue", width=12, anchor=W
)
self._lbl_trk = Label(
self._frm_advanced, bg=BGCOL, fg="deepskyblue", width=8, anchor=W
)
self._lbl_siv = Label(
self._frm_advanced2, bg=BGCOL, fg="yellow", width=2, anchor=W
)
self._lbl_sip = Label(
self._frm_advanced2, bg=BGCOL, fg="yellow", width=2, anchor=W
)
self._lbl_pdop = Label(
self._frm_advanced2, bg=BGCOL, fg="mediumpurple1", width=14, anchor=W
)
self._lbl_diffcorr = Label(
self._frm_advanced2, bg=BGCOL, fg="hotpink", width=3, anchor=W
)
self._lbl_hvdop = Label(
self._frm_advanced2, bg=BGCOL, fg="mediumpurple1", width=11, anchor=W
)
self._lbl_hvacc = Label(
self._frm_advanced2, bg=BGCOL, fg="aquamarine2", width=11, anchor=W
)
self._lbl_lacc_u = Label(
self._frm_advanced2,
bg=BGCOL,
fg="aquamarine2",
anchor=NW,
width=2,
)
self._lbl_diffstat = Label(
self._frm_advanced2, bg=BGCOL, fg="hotpink", width=25, anchor=W
)
def _do_layout(self):
"""
Position widgets in frame.
"""
self._lbl_status_preset.grid(column=0, row=0, padx=2, pady=3, sticky=W)
self._lbl_rtk_preset.grid(column=1, row=0, padx=2, pady=3, sticky=W)
self._lbl_transmit_preset.grid(column=2, row=0, padx=1, pady=3, sticky=W)
self._lbl_clients.grid(column=3, row=0, padx=1, pady=3, sticky=W)
self._lbl_ltime.grid(column=1, row=0, pady=0, padx=0, sticky=W)
self._lbl_time.grid(column=2, row=0, pady=0, padx=0, sticky=W)
self._lbl_llat.grid(column=3, row=0, pady=0, padx=0, sticky=W)
self._lbl_lat.grid(column=4, row=0, pady=0, padx=0, sticky=W)
self._lbl_llon.grid(column=5, row=0, pady=0, padx=0, sticky=W)
self._lbl_lon.grid(column=6, row=0, pady=0, padx=0, sticky=W)
self._lbl_lfix.grid(column=7, row=0, pady=0, padx=0, sticky=W)
self._lbl_fix.grid(column=8, row=0, pady=0, padx=0, sticky=W)
self._lbl_lhmsl.grid(column=0, row=0, pady=0, padx=0, sticky=W)
self._lbl_hmsl.grid(column=1, row=0, pady=0, padx=0, sticky=W)
self._lbl_lhae.grid(column=2, row=0, pady=0, padx=0, sticky=W)
self._lbl_hae.grid(column=3, row=0, pady=0, padx=0, sticky=W)
self._lbl_lspd.grid(column=4, row=0, pady=0, padx=0, sticky=W)
self._lbl_spd.grid(column=5, row=0, pady=0, padx=0, sticky=W)
self._lbl_ltrk.grid(column=6, row=0, pady=0, padx=0, sticky=W)
self._lbl_trk.grid(column=7, row=0, pady=0, padx=0, sticky=W)
self._lbl_lsiv.grid(column=0, row=0, pady=0, padx=0, sticky=W)
self._lbl_siv.grid(column=1, row=0, pady=0, padx=0, sticky=W)
self._lbl_lsip.grid(column=2, row=0, pady=0, padx=0, sticky=W)
self._lbl_sip.grid(column=3, row=0, pady=0, padx=0, sticky=W)
self._lbl_lpdop.grid(column=4, row=0, pady=0, padx=0, sticky=W)
self._lbl_pdop.grid(column=5, row=0, pady=0, padx=0, sticky=W)
self._lbl_hvdop.grid(column=6, row=0, pady=0, padx=0, sticky=W)
self._lbl_lacc.grid(column=7, row=0, pady=0, padx=0, sticky=W)
self._lbl_hvacc.grid(column=8, row=0, pady=0, padx=0, sticky=W)
self._lbl_lacc_u.grid(column=9, row=0, pady=0, padx=0, sticky=W)
self._lbl_lcorr.grid(column=10, row=0, pady=0, padx=0, sticky=W)
self._lbl_diffcorr.grid(column=11, row=0, pady=0, padx=0, sticky=W)
self._lbl_diffstat.grid(column=12, row=0, pady=0, padx=0, sticky=W)
self._btn_toggle.grid(column=0, row=0, padx=0, pady=0, sticky=NE)
self._toggle_advanced()
def _attach_events(self):
"""
Bind events to frame.
"""
self.bind("<Configure>", self._on_resize)
self._lbl_lhae.bind("<Double-Button-1>", self._on_sep)
self._lbl_hae.bind("<Double-Button-1>", self._on_sep)
def _toggle_advanced(self):
"""
Toggle advanced banner frame on or off.
"""
self._frm_connect.grid(
column=0, row=0, rowspan=2, pady=3, ipadx=3, ipady=3, sticky=NW
)
self._frm_basic.grid(column=1, row=0, pady=2, sticky=W)
self._frm_toggle.grid(column=5, row=0, rowspan=2, pady=2, sticky=NE)
self._show_advanced = not self._show_advanced
if self._show_advanced:
self._frm_advanced.grid(column=1, row=1, pady=2, sticky=W)
self._frm_advanced2.grid(column=1, row=2, pady=2, sticky=W)
self._btn_toggle.config(image=self._img_contract)
else:
self._frm_advanced.grid_forget()
self._frm_advanced2.grid_forget()
self._btn_toggle.config(image=self._img_expand)
def update_conn_status(self, status: int):
"""
Update connection status icon
:param int status: connection status as integer (0,1,2)
"""
if status == CONNECTED:
self._lbl_status_preset.configure(image=self._img_serial)
elif status == CONNECTED_SOCKET:
self._lbl_status_preset.configure(image=self._img_socket)
elif status == CONNECTED_FILE:
self._lbl_status_preset.configure(image=self._img_file)
else:
self._lbl_status_preset.configure(image=self._img_disconn)
def update_rtk_status(self, rtk: int = 0):
"""
Update RTK status icon.
:param int rtk: rtk transmit status (none = 0, ntrip = 1, spartn = 2/4)
"""
if rtk == CONNECTED_NTRIP:
self._lbl_rtk_preset.configure(image=self._img_ntrip)
elif rtk in (CONNECTED_SPARTNIP, CONNECTED_SPARTNLB):
self._lbl_rtk_preset.configure(image=self._img_spartn)
else:
self._lbl_rtk_preset.configure(image=self._img_blank)
def update_transmit_status(self, transmit: int = 1):
"""
Update socket server status icon.
- -1 = not transmitting
- 0 transmitting, no clients
- 1 transmitting with clients
:param int transmit: socket server transmit status
"""
if transmit > 0:
self._lbl_transmit_preset.configure(image=self._img_transmit)
self._lbl_clients.config(text=transmit, fg="#6b8839")
elif transmit == 0:
self._lbl_transmit_preset.configure(image=self._img_noclient)
self._lbl_clients.config(text=transmit, fg="#e7b03e")
else:
self._lbl_transmit_preset.configure(image=self._img_blank)
self._lbl_clients.config(text=" ", fg=BGCOL)
def update_frame(self):
"""
Sets text of banner from GNSSStatus object.
"""
deg_format = self.__app.configuration.get("degreesformat_s")
units = self.__app.configuration.get("units_s")
self._update_time()
self._update_pos(deg_format, units)
self._update_track(units)
self._update_fix()
self._update_siv()
self._update_dop(units)
self._update_dgps(units)
def _update_time(self):
"""
Update GNSS time of week
"""
tim = self.__app.gnss_status.utc
if tim in (None, ""):
self._lbl_time.config(text=NA)
else:
self._lbl_time.config(text=f"{tim:%H:%M:%S.%f}")
def _update_pos(self, pos_format, units):
"""
Update position.
:param str pos_format: position display format as string (DMS, DMM, DDD, ECEF)
:param str units: distance units as string (UMM, UMK, UI, UIK)
"""
lat = self.__app.gnss_status.lat
lon = self.__app.gnss_status.lon
alt = self.__app.gnss_status.alt # hMSL
hae = self.__app.gnss_status.hae
self._lbl_llat.config(text="lat:")
self._lbl_llon.config(text="lon:")
self._lbl_lhmsl.config(text="hmsl:")
lhae = "sep:" if self._sep else "hae:"
self._lbl_lhae.config(text=lhae)
alt_u = "ft" if units in (UI, UIK) else "m"
try:
if pos_format == ECEF:
lat, lon, alt = llh2ecef(lat, lon, alt)
if units in (UI, UIK):
lat, lon = (m2ft(x) for x in (lat, lon))
self._lbl_llat.config(text="X:")
self._lbl_llon.config(text="Y:")
self._lbl_lhmsl.config(text="Z:")
self._lbl_lat.config(text=f"{lat:.4f}")
self._lbl_lon.config(text=f"{lon:.4f}")
else:
deg_f = "<15"
if pos_format == DMS:
lat, lon = latlon2dms(lat, lon)
elif pos_format == DMM:
lat, lon = latlon2dmm(lat, lon)
else:
deg_f = ".9f"
if units in (UI, UIK):
alt = m2ft(alt)
hae = m2ft(hae)
self._lbl_lat.config(text=f"{lat:{deg_f}}")
self._lbl_lon.config(text=f"{lon:{deg_f}}")
self._lbl_hmsl.config(text=f"{alt:.4f} {alt_u}")
haev = hae - alt if self._sep else hae
self._lbl_hae.config(text=f"{haev:.4f} {alt_u}")
except (TypeError, ValueError):
self._lbl_lat.config(text=NA)
self._lbl_lon.config(text=NA)
self._lbl_hmsl.config(text=NA)
self._lbl_hae.config(text=NA)
def _update_track(self, units):
"""
Update track and ground speed
:param str units: distance units as string (UMM, UMK, UI, UIK)
"""
speed = self.__app.gnss_status.speed
speed_u = "m/s"
if isinstance(speed, (int, float)):
if units == UI:
speed = ms2mph(speed)
speed_u = "mph"
elif units == UIK:
speed = ms2knots(speed)
speed_u = "knots"
elif units == UMK:
speed = ms2kmph(speed)
speed_u = "kmph"
self._lbl_spd.config(text=f"{speed:.2f} {speed_u}")
else:
self._lbl_spd.config(text=NA)
track = self.__app.gnss_status.track
if isinstance(track, (int, float)):
self._lbl_trk.config(text=f"{track:05.1f} °")
else:
self._lbl_trk.config(text=NA)
def _update_fix(self):
"""
Update fix type
"""
fix = self.__app.gnss_status.fix
if fix in ("3D", "GNSS+DR", "RTK", "RTK FIXED", "RTK FLOAT"):
self._lbl_fix.config(fg="green2")
elif fix in ("2D", "DR"):
self._lbl_fix.config(fg="orange")
else:
self._lbl_fix.config(fg=ERRCOL)
self._lbl_fix.config(text=fix)
def _update_siv(self):
"""
Update siv and sip.
Exclude unused sats (cno = 0) if show_unused is not set.
"""
siv = self.__app.gnss_status.siv
siv = (
siv
if self.__app.configuration.get("unusedsat_b")
else siv - unused_sats(self.__app.gnss_status.gsv_data)
)
try:
self._lbl_siv.config(text=f"{siv:02d}")
self._lbl_sip.config(text=f"{self.__app.gnss_status.sip:02d}")
except (TypeError, ValueError):
self._lbl_siv.config(text=NA)
self._lbl_sip.config(text=NA)
def _update_dop(self, units):
"""
Update precision and accuracy
:param str units: distance units as string (UMM, UMK, UI, UIK)
"""
try:
pdop = self.__app.gnss_status.pdop
self._lbl_pdop.config(text=f"{pdop:.2f} {dop2str(pdop)}")
except (TypeError, ValueError):
self._lbl_pdop.config(text=NA)
try:
self._lbl_hvdop.config(
text=f"hdop {self.__app.gnss_status.hdop:.2f}\n"
+ f"vdop {self.__app.gnss_status.vdop:.2f}"
)
except (TypeError, ValueError):
self._lbl_hvdop.config(text=f"hdop {NA}\nvdop {NA}")
try:
if units in (UI, UIK):
self._lbl_hvacc.config(
text=f"hacc {m2ft(self.__app.gnss_status.hacc):.3f}\n"
+ f"vacc {m2ft(self.__app.gnss_status.vacc):.3f}"
)
self._lbl_lacc_u.config(text="ft")
else:
self._lbl_hvacc.config(
text=f"hacc {self.__app.gnss_status.hacc:.3f}\n"
+ f"vacc {self.__app.gnss_status.vacc:.3f}"
)
self._lbl_lacc_u.config(text="m")
except (TypeError, ValueError):
self._lbl_hvacc.config(text=f"hacc {NA}\nvacc {NA}")
def _update_dgps(self, units):
"""
Update DGPS status.
:param str units: distance units as string (UMM, UMK, UI, UIK)
"""
self._lbl_diffcorr.config(
text=DGPSYES if self.__app.gnss_status.diff_corr else NA
)
baseline = self.__app.gnss_status.rel_pos_length
bl = NA
bl_u = ""
if isinstance(baseline, (int, float)):
if baseline > 0.0:
if units in (UI, UIK):
bl = m2ft(baseline / 100) # cm to ft
if bl > M2MILES:
bl_u = "miles"
bl = bl / M2MILES # cm to miles
else:
bl_u = "ft"
else:
if baseline > 100000:
bl_u = "km"
bl = baseline / 100000 # cm to km
else:
bl_u = "m"
bl = baseline / 100 # cm to m
if self.__app.gnss_status.diff_corr:
age = self.__app.gnss_status.diff_age
station = self.__app.gnss_status.diff_station
if age in [None, "", 0]:
age = NA
else:
age = f"{age} s"
if station in [None, "", 0]:
station = NA
if bl == NA:
self._lbl_diffstat.config(text=f"age {age}\nid {station} - {bl}")
else:
self._lbl_diffstat.config(
text=f"age {age}\nid {station} - {bl:.2f} {bl_u}"
)
else:
self._lbl_diffstat.config(text="")
def _set_fontsize(self):
"""
Adjust font sizes according to frame size
"""
for ctl in (
self._lbl_status_preset,
self._lbl_time,
self._lbl_lat,
self._lbl_lon,
self._lbl_hmsl,
self._lbl_hae,
self._lbl_spd,
self._lbl_trk,
self._lbl_pdop,
self._lbl_fix,
self._lbl_sip,
self._lbl_siv,
self._lbl_diffcorr,
):
ctl.config(font=scale_font(self.width, FONTBASE, FONTSCALE)[0])
for ctl in (
self._lbl_ltime,
self._lbl_llat,
self._lbl_llon,
self._lbl_lhmsl,
self._lbl_lhae,
self._lbl_lspd,
self._lbl_ltrk,
self._lbl_lpdop,
self._lbl_lfix,
self._lbl_lsip,
self._lbl_lsiv,
self._lbl_lacc,
self._lbl_lcorr,
):
ctl.config(font=scale_font(self.width, FONTBASE - 2, FONTSCALE)[0])
for ctl in (
self._lbl_hvdop,
self._lbl_hvacc,
self._lbl_diffstat,
):
ctl.config(font=scale_font(self.width, FONTBASE - 4, FONTSCALE)[0])
def _on_sep(self, event): # pylint: disable=unused-argument
"""
Toggle hae/sep display.
:param event event: mouse click event
"""
self._sep = not self._sep
def _on_resize(self, event): # pylint: disable=unused-argument
"""
Resize frame.
:param event event: resize event
"""
self.width, self.height = self.get_size()
self._set_fontsize()
def get_size(self):
"""
Get current frame size.
:return: window size (width, height)
:rtype: tuple
"""
self.update_idletasks() # Make sure we know about any resizing
return self.winfo_width(), self.winfo_height()