diff --git a/pygpsclient.json b/pygpsclient.json index 9fbc0b7..c89cd9e 100644 --- a/pygpsclient.json +++ b/pygpsclient.json @@ -9,6 +9,7 @@ "Spectrum": false, "System Monitor": false, "Scatter Plot": false, + "checkforupdate_b": 0, "mapupdateinterval_n": 60, "defaultport_s": "USB", "mqapikey_s": "<======= YOUR MQ API KEY ======>", @@ -110,8 +111,8 @@ "spartndecode_b": 0, "spartnkey_s": "abcd1234abcd1234abcd1234abcd1234", "spartnbasedate_n": -1, - "checkforupdate_b": 0, "scattersettings_d": { + "maxpoints_n": 2000, "scatterautorange_b": 1, "scattercenter_s": "Average", "scatterinterval_n": 1, @@ -122,7 +123,7 @@ "chartsettings_d": { "numchn_n": 4, "timrng_n": "240", - "datpnt_n": "2000", + "maxpoints_n": "2000", "0": { "id_s": "NAV-PVT", "name_s": "hAcc", diff --git a/src/pygpsclient/chart_frame.py b/src/pygpsclient/chart_frame.py index 78214ca..e6b4b6c 100644 --- a/src/pygpsclient/chart_frame.py +++ b/src/pygpsclient/chart_frame.py @@ -155,7 +155,7 @@ def __init__(self, app, *args, **kwargs): self._mintim = 1e20 self._maxtim = 0 self._timrange = StringVar() - self._datapoints = StringVar() + self._maxpoints = StringVar() for chn in range(self._num_chans): self._data_id[chn] = StringVar() self._data_name[chn] = StringVar() @@ -219,7 +219,7 @@ def _body(self): fg=LBLCOL, bg=BGCOL, ) - self._lbl_datapoints = Label( + self._lbl_maxpoints = Label( self, text="Max Points/Chan", fg=LBLCOL, @@ -298,11 +298,11 @@ def _body(self): fg=LBLCOL, readonlybackground=BGCOL, ) - self._spn_datapoints = Spinbox( + self._spn_maxpoints = Spinbox( self, values=DPTRANGE, wrap=True, - textvariable=self._datapoints, + textvariable=self._maxpoints, state=READONLY, repeatdelay=RPTDELAY, repeatinterval=RPTDELAY, @@ -330,8 +330,8 @@ def _do_layout(self): self._spn_maxy[chn].grid(column=4, row=2 + chn, sticky=(W, E)) self._lbl_timrange.grid(column=5, row=1, sticky=(W, E)) self._spn_timrange.grid(column=5, row=2, sticky=(W, E)) - self._lbl_datapoints.grid(column=5, row=3, sticky=(W, E)) - self._spn_datapoints.grid(column=5, row=4, sticky=(W, E)) + self._lbl_maxpoints.grid(column=5, row=3, sticky=(W, E)) + self._spn_maxpoints.grid(column=5, row=4, sticky=(W, E)) def _attach_events(self): """ @@ -343,7 +343,7 @@ def _attach_events(self): self._can_chartview.bind("", self._on_clipboard) self._can_chartview.bind("", self._on_clipboard) self._timrange.trace_add("write", self._on_save_settings) - self._datapoints.trace_add("write", self._on_save_settings) + self._maxpoints.trace_add("write", self._on_save_settings) for chn in range(self._num_chans): self._data_id[chn].trace_add("write", self._on_save_settings) self._data_name[chn].trace_add("write", self._on_save_settings) @@ -357,7 +357,7 @@ def reset(self): """ self._timrange.set(self.chartsettings.get("timrng_n", TIMRANGE[3])) # 60s - self._datapoints.set(self.chartsettings.get("datpnt_n", DPTRANGE[2])) # 5000 + self._maxpoints.set(self.chartsettings.get("maxpoints_n", DPTRANGE[2])) # 5000 for chn in range(self._num_chans): cst = self.chartsettings.get(str(chn), {}) self._data_id[chn].set(cst.get("id_s", "")) @@ -429,7 +429,7 @@ def update_data(self, parsed_data: object): """ try: - maxpoints = int(self._datapoints.get()) + maxpoints = int(self._maxpoints.get()) except ValueError: maxpoints = DPTRANGE[2] # 5000 @@ -710,7 +710,7 @@ def _on_save_settings(self, var, index, mode): # pylint: disable=unused-argumen cst = {} cst["numchn_n"] = self._num_chans cst["timrng_n"] = self._timrange.get() - cst["datpnt_n"] = self._datapoints.get() + cst["maxpoints_n"] = self._maxpoints.get() for chn in range(self._num_chans): cst[chn] = {} cst[chn]["id_s"] = self._data_id[chn].get() diff --git a/src/pygpsclient/scatter_frame.py b/src/pygpsclient/scatter_frame.py index af66f11..16aee03 100644 --- a/src/pygpsclient/scatter_frame.py +++ b/src/pygpsclient/scatter_frame.py @@ -104,7 +104,6 @@ def __init__(self, app, *args, **kwargs): self.width = kwargs.get("width", def_w) self.height = kwargs.get("height", def_h) - # self._font = font.Font(size=max(int(self.height / 40), 10)) self._font = self.__app.font_sm self._fonth = fontheight(self._font) self._points = [] @@ -125,6 +124,7 @@ def __init__(self, app, *args, **kwargs): self._scale = IntVar() self._reflat = StringVar() self._reflon = StringVar() + self._maxpoints = config.get("maxpoints_n", MAXPOINTS) reflat = config.get("scatterlat_f", 0.0) reflon = config.get("scatterlon_f", 0.0) self._reflat.set("Reference Lat" if reflat == 0.0 else reflat) @@ -312,6 +312,7 @@ def _on_save_settings(self, var, index, mode): # pylint: disable=unused-argumen """ sst = {} + sst["maxpoints_n"] = self._maxpoints sst["scatterautorange_b"] = self._autorange.get() sst["scattercenter_s"] = self._centermode.get() sst["scatterinterval_n"] = self._interval.get() @@ -394,7 +395,7 @@ def _draw_stats(self, lbl_font: object): ) y += fh np = len(self._points) - pts = f"Pts: {np} {'!' if np >= MAXPOINTS else ''}" + pts = f"Pts: {np} {'!' if np >= self._maxpoints else ''}" self.canvas.create_text( 5, y, text=pts, fill=PNTCOL, font=lbl_font, anchor=NW, tags=AVG ) @@ -522,7 +523,7 @@ def update_frame(self): return # Don't repeat exactly the last point. self._points.append(pos) - if len(self._points) > MAXPOINTS: + if len(self._points) > self._maxpoints: self._cull_points() self._set_average()