Skip to content

Commit c43098e

Browse files
committed
update UI
1 parent d8c6d42 commit c43098e

6 files changed

+46
-30
lines changed

src/pygpsclient/chart_frame.py

+26-17
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,22 @@
3838
W,
3939
)
4040

41-
from pygpsclient.globals import BGCOL, READONLY, RPTDELAY, WIDGETU6, AreaXY
41+
from pygpsclient.globals import (
42+
AXISCOL,
43+
BGCOL,
44+
GRIDCOL,
45+
READONLY,
46+
RPTDELAY,
47+
WIDGETU6,
48+
AreaXY,
49+
)
4250
from pygpsclient.helpers import data2xy, get_grid, scale_font, time2str
4351

4452
MAXCHANS = 4
4553
RESFONT = 28 # font size relative to widget size
4654
MINFONT = 8 # minimum font size
4755
PLOTWID = 1
4856
PLOTCOLS = ("yellow", "cyan", "magenta", "deepskyblue")
49-
AXISCOL = "white"
50-
GRIDCOL = "grey40"
5157
GRIDMINCOL = "grey30"
5258
LBLGRID = 5
5359
GRIDSTEPS = get_grid(21)
@@ -368,7 +374,7 @@ def _on_clear(self, event): # pylint: disable=unused-argument
368374
"""
369375

370376
for chn in range(self._num_chans):
371-
self._chart_data[chn] = [(time(), 0)]
377+
self._chart_data[chn] = []
372378
self._mintim = 1e20
373379
self._maxtim = 0
374380
self._can_chartview.delete(ALL)
@@ -555,7 +561,8 @@ def _update_plot(self, data: dict):
555561
self._draw_yaxis_labels(w, h, bounds, minval[chn], maxval[chn], chn)
556562

557563
# plot each data point in channel
558-
for idx, (tim, val) in enumerate(data[chn]):
564+
inr = False
565+
for tim, val in data[chn]:
559566

560567
if val is None: # not numeric
561568
continue
@@ -572,22 +579,24 @@ def _update_plot(self, data: dict):
572579
val,
573580
self._xoff,
574581
)
582+
if x <= self._xoff:
583+
inr = False
575584
# plot line
576-
if idx:
585+
if inr:
577586
x2, y2 = x, y
578-
if idx:
579-
self._can_chartview.create_line(
580-
x1,
581-
y1,
582-
x2,
583-
y2,
584-
fill=chncol,
585-
width=PLOTWID,
586-
tags=f"plot_{chn:1d}",
587-
)
587+
self._can_chartview.create_line(
588+
x1,
589+
y1,
590+
x2,
591+
y2,
592+
fill=chncol,
593+
width=PLOTWID,
594+
tags=f"plot_{chn:1d}",
595+
)
588596
x1, y1 = x2, y2
589597
else:
590-
x1, y1 = x, y
598+
x1, y1 = max(x, self._xoff), y
599+
inr = True
591600

592601
def _draw_xaxis_labels(
593602
self, w: int, h: int, bounds: AreaXY, mintim: float, maxtim: float

src/pygpsclient/console_frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from pygpsclient.strings import HALTTAGWARN
3838

3939
HALT = "HALT"
40-
CONSOLELINES = 10
40+
CONSOLELINES = 20
4141

4242

4343
class ConsoleFrame(Frame):
@@ -91,7 +91,7 @@ def _body(self):
9191
yscrollcommand=self.sblogv.set,
9292
xscrollcommand=self.sblogh.set,
9393
wrap=NONE,
94-
height=CONSOLELINES,
94+
height=15,
9595
)
9696
self.sblogh.config(command=self.txt_console.xview)
9797
self.sblogv.config(command=self.txt_console.yview)

src/pygpsclient/globals.py

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def create_circle(self, x, y, r, **kwargs):
4545

4646
HOME = Path.home()
4747
APPNAME = __name__.split(".", 1)[0] # i.e. "pygpsclient"
48+
AXISCOL = "white"
4849
BADCOL = "red"
4950
BGCOL = "gray24" # default widget background color
5051
BPSRATES = (
@@ -138,6 +139,7 @@ def create_circle(self, x, y, r, **kwargs):
138139
'http://www.topografix.com/GPX/1/1/gpx.xsd"'
139140
)
140141
GPX_TRACK_INTERVAL = 1 # minimum GPS track update interval (seconds)
142+
GRIDCOL = "grey40"
141143
GUI_UPDATE_INTERVAL = 0.5 # minimum GUI widget update interval (seconds)
142144
ICON_APP128 = path.join(DIRNAME, "resources/app-128.png")
143145
ICON_BLANK = path.join(DIRNAME, "resources/blank-1-24.png")

src/pygpsclient/graphview_frame.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@
1414

1515
from tkinter import ALL, BOTH, YES, Canvas, E, Frame
1616

17-
from pygpsclient.globals import BGCOL, FGCOL, GNSS_LIST, MAX_SNR, WIDGETU2
17+
from pygpsclient.globals import (
18+
AXISCOL,
19+
BGCOL,
20+
FGCOL,
21+
GNSS_LIST,
22+
GRIDCOL,
23+
MAX_SNR,
24+
WIDGETU2,
25+
)
1826
from pygpsclient.helpers import scale_font, snr2col
1927

2028
# Relative offsets of graph axes and legend
2129
AXIS_XL = 19
2230
AXIS_XR = 10
2331
AXIS_Y = 22
24-
AXISCOL = "white"
25-
GRIDCOL = "grey40"
2632
OL_WID = 2
2733
LEG_XOFF = AXIS_XL + 10
2834
LEG_YOFF = 5

src/pygpsclient/settings_frame.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124

125125
MAXLINES = ("200", "500", "1000", "2000", "100")
126126
MAPTYPES = (WORLD, MAP, SAT, CUSTOM)
127-
MINHEIGHT = 750
128-
MINWIDTH = 390
127+
MINHEIGHT = 45 # font linespace units
128+
MINWIDTH = 31 # font metric width units
129129

130130

131131
class SettingsFrame(Frame):
@@ -195,9 +195,8 @@ def _container(self):
195195
function which invokes the on_expand() method here.
196196
"""
197197

198-
fontw = font.Font.measure(self.__app.font_md, "W") * 28
199-
fonth = font.Font.metrics(self.__app.font_md, "linespace") * 28
200-
dimw, dimh = fontw, fonth
198+
dimw = font.Font.measure(self.__app.font_md, "W") * MINWIDTH
199+
dimh = font.Font.metrics(self.__app.font_md, "linespace") * MINHEIGHT
201200
self._frm_main = Frame(self)
202201
self._frm_main.pack(fill=BOTH, expand=1)
203202
self_frm_scrollx = Frame(self._frm_main)

src/pygpsclient/spectrum_frame.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BGCOL,
2222
FGCOL,
2323
GNSS_LIST,
24+
GRIDCOL,
2425
PNTCOL,
2526
SPECTRUMVIEW,
2627
WIDGETU2,
@@ -39,7 +40,6 @@
3940
MAX_HZ = 1650000000
4041
TICK_DB = 20 # 20 dB divisions
4142
TICK_GHZ = 40000000 # 40 MHz divisions
42-
TICK_COL = "grey"
4343
RF_BANDS = {
4444
"B1": 1575420000,
4545
"B3": 1268520000,
@@ -170,7 +170,7 @@ def init_frame(self):
170170
y1,
171171
x2 + 1,
172172
y1,
173-
fill=TICK_COL if i else FGCOL,
173+
fill=GRIDCOL if i else FGCOL,
174174
tags=MODEINIT,
175175
)
176176
self.can_spectrumview.create_text(
@@ -195,7 +195,7 @@ def init_frame(self):
195195
y1 - 1,
196196
x1,
197197
y2,
198-
fill=TICK_COL if i else FGCOL,
198+
fill=GRIDCOL if i else FGCOL,
199199
tags=MODEINIT,
200200
)
201201
self.can_spectrumview.create_text(

0 commit comments

Comments
 (0)