Skip to content

Commit f555e1a

Browse files
authored
Merge pull request #187 from semuconsulting/streamline-config
RC 1.5.7
2 parents 7ba59b5 + 3dff580 commit f555e1a

40 files changed

+1463
-1137
lines changed

RELEASE_NOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# PyGPSClient Release Notes
22

3+
### RELEASE 1.5.7
4+
5+
FIXES:
6+
7+
1. Fixes some typos in MQTT configuration settings (mqtt rather than mgtt) **NB:** recommend saving a new json configuration file for this version.
8+
9+
ENHANCEMENTS:
10+
11+
1. Refactor configuration settings - new `Configuration` class in `configuration.py`.
12+
1. Streamline command line argument handling.
13+
1. Add 'Decode SPARTN in console' checkbox to SPARTN config dialog.
14+
315
### RELEASE 1.5.6
416

517
1. Enhancements to Dynamic Configuration Panel to allow POLL arguments to be entered for those poll commands that require them.

docs/pygpsclient.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ pygpsclient.chart\_frame module
3636
:show-inheritance:
3737
:undoc-members:
3838

39+
pygpsclient.configuration module
40+
--------------------------------
41+
42+
.. automodule:: pygpsclient.configuration
43+
:members:
44+
:show-inheritance:
45+
:undoc-members:
46+
3947
pygpsclient.confirm\_box module
4048
-------------------------------
4149

images/app.png

-830 KB
Loading

pygpsclient.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"spartnprot_b": 1,
2222
"degreesformat_s": "DD.D",
2323
"colortag_b": 0,
24-
"units_s": "MM",
24+
"units_s": "Metric m/s",
2525
"autoscroll_b": 1,
2626
"maxlines_n": 200,
2727
"consoleformat_s": "Parsed",
@@ -83,13 +83,14 @@
8383
"mqttclientserver_s": "",
8484
"mqttclientport_n": 8883,
8585
"mqttclientid_s": "<<=== YOUR MQTT CLIENT ID ===>",
86-
"mgttclientregion_s": "eu",
87-
"mgttclientmode_n": 0,
88-
"mgttclienttopicip_b": 1,
89-
"mgttclienttopicmga_b": 1,
90-
"mgttclienttopickey_b": 1,
91-
"mgttclienttlscrt_s": "<=== FULLY QUALIFIED PATH TO MQTT CRT FILE ===>",
92-
"mgttclienttlskey_s": "<=== FULLY QUALIFIED PATH TO MQTT KEY FILE ===>",
86+
"mqttclientregion_s": "eu",
87+
"mqttclientmode_n": 0,
88+
"mqttclienttopicip_b": 1,
89+
"mqttclienttopicmga_b": 1,
90+
"mqttclienttopickey_b": 1,
91+
"mqttclienttopicfreq_b": 0,
92+
"mqttclienttlscrt_s": "<=== FULLY QUALIFIED PATH TO MQTT CRT FILE ===>",
93+
"mqttclienttlskey_s": "<=== FULLY QUALIFIED PATH TO MQTT KEY FILE ===>",
9394
"lbandclientbpsrate_n": 9600,
9495
"lbandclientdatabits_n": 8,
9596
"lbandclientstopbits_f": 1.0,
@@ -281,6 +282,14 @@
281282
"NTRIP",
282283
"#9f30c1"
283284
],
285+
[
286+
"MQTT",
287+
"#a53570"
288+
],
289+
[
290+
"LBAND",
291+
"#a53570"
292+
],
284293
[
285294
"txbuf alloc",
286295
"red"

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ dynamic = ["version"]
88
authors = [{ name = "semuadmin", email = "[email protected]" }]
99
maintainers = [{ name = "semuadmin", email = "[email protected]" }]
1010
description = "GNSS Diagnostic and UBX Configuration GUI Application"
11-
license = { file = "LICENSE" }
12-
#license-files = ["LICENSE"]
11+
license-files = ["LICENSE"]
1312
keywords = [
1413
"PyGPSClient",
1514
"GNSS",
@@ -52,7 +51,7 @@ classifiers = [
5251
dependencies = [
5352
"requests>=2.28.0",
5453
"Pillow>=9.0.0",
55-
"pygnssutils>=1.1.11",
54+
"pygnssutils>=1.1.12",
5655
"pyubxutils>=1.0.2",
5756
"pyserial>=3.5",
5857
]

src/pygpsclient/__main__.py

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
"""
1010

1111
import sys
12-
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
12+
from argparse import SUPPRESS, ArgumentDefaultsHelpFormatter, ArgumentParser
1313
from logging import getLogger
14-
from os import getenv
1514
from tkinter import Tk
1615

1716
from pygnssutils import (
@@ -28,12 +27,8 @@
2827
from pygpsclient.globals import (
2928
APPNAME,
3029
CONFIGFILE,
31-
DEFAULT_PASSWORD,
32-
DEFAULT_REGION,
33-
DEFAULT_USER,
3430
SPARTN_BASEDATE_CURRENT,
3531
SPARTN_BASEDATE_DATASTREAM,
36-
SPARTN_DEFAULT_KEY,
3732
)
3833
from pygpsclient.strings import EPILOG
3934

@@ -50,84 +45,72 @@ def main():
5045
ap.add_argument(
5146
"-C",
5247
"--config",
53-
required=False,
5448
help="Fully-qualified path to configuration file",
5549
default=CONFIGFILE,
5650
)
5751
ap.add_argument(
5852
"-U",
5953
"--userport",
60-
required=False,
6154
help="User-defined GNSS receiver port",
62-
default=getenv("PYGPSCLIENT_USERPORT", ""),
55+
default=SUPPRESS,
6356
)
6457
ap.add_argument(
6558
"-S",
6659
"--spartnport",
67-
required=False,
6860
help="User-defined SPARTN receiver port",
69-
default=getenv("PYGPSCLIENT_SPARTNPORT", ""),
61+
default=SUPPRESS,
7062
)
7163
ap.add_argument(
7264
"--mqapikey",
73-
required=False,
7465
help="MapQuest API Key",
75-
default=getenv("MQAPIKEY", ""),
66+
default=SUPPRESS,
7667
)
7768
ap.add_argument(
7869
"--mqttclientid",
79-
required=False,
8070
help="MQTT Client ID",
81-
default=getenv("MQTTCLIENTID", ""),
71+
default=SUPPRESS,
8272
)
8373
ap.add_argument(
8474
"--mqttclientregion",
85-
required=False,
8675
help="MQTT Client Region",
87-
default=getenv("MQTTCLIENTREGION", DEFAULT_REGION),
76+
default=SUPPRESS,
8877
)
8978
ap.add_argument(
9079
"--mqttclientmode",
91-
required=False,
9280
help="MQTT Client Mode (0 - IP, 1 - L-Band)",
93-
default=getenv("MQTTCLIENTMODE", "0"),
94-
type=int,
81+
default=SUPPRESS,
9582
)
9683
ap.add_argument(
9784
"--ntripcasteruser",
98-
required=False,
9985
help="NTRIP Caster authentication user",
100-
default=getenv("NTRIPCASTER_USER", DEFAULT_USER),
86+
default=SUPPRESS,
10187
)
10288
ap.add_argument(
10389
"--ntripcasterpassword",
104-
required=False,
10590
help="NTRIP Caster authentication password",
106-
default=getenv("NTRIPCASTER_PASSWORD", DEFAULT_PASSWORD),
91+
default=SUPPRESS,
10792
)
10893
ap.add_argument(
10994
"--spartnkey",
110-
required=False,
11195
help="SPARTN message decryption key",
112-
default=getenv("MQTTKEY", SPARTN_DEFAULT_KEY),
96+
default=SUPPRESS,
11397
)
11498
ap.add_argument(
11599
"--spartnbasedate",
116-
required=False,
117100
help=f"SPARTN message decryption timetag ({SPARTN_BASEDATE_CURRENT} = \
118101
current datetime, {SPARTN_BASEDATE_DATASTREAM} = use timetags from data stream)",
119-
default=SPARTN_BASEDATE_CURRENT,
120102
type=int,
103+
default=SUPPRESS,
121104
)
122105
ap.add_argument(
123106
"--verbosity",
124-
required=False,
125107
help=(
126108
f"Log message verbosity "
127109
f"{VERBOSITY_CRITICAL} = critical, "
128110
f"{VERBOSITY_LOW} = low (error), "
129111
f"{VERBOSITY_MEDIUM} = medium (warning), "
130-
f"{VERBOSITY_HIGH} = high (info), {VERBOSITY_DEBUG} = debug"
112+
f"{VERBOSITY_HIGH} = high (info), {VERBOSITY_DEBUG} = debug, "
113+
f"default = {VERBOSITY_CRITICAL}"
131114
),
132115
type=int,
133116
choices=[
@@ -141,9 +124,7 @@ def main():
141124
)
142125
ap.add_argument(
143126
"--logtofile",
144-
required=False,
145127
help="fully qualified log file name, or '' for no log file",
146-
type=str,
147128
default="",
148129
)
149130
kwargs = vars(ap.parse_args())

src/pygpsclient/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
:license: BSD 3-Clause
99
"""
1010

11-
__version__ = "1.5.6"
11+
__version__ = "1.5.7"

src/pygpsclient/about_dialog.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def __init__(self, app, **kwargs): # pylint: disable=unused-argument
7777
self._img_exit = ImageTk.PhotoImage(Image.open(ICON_EXIT))
7878
self._img_sponsor = ImageTk.PhotoImage(Image.open(ICON_SPONSOR))
7979
self._checkonstartup = IntVar()
80-
cfu = self.__app.saved_config.get("checkforupdate_b", False)
81-
self._checkonstartup.set(cfu)
80+
self._checkonstartup.set(self.__app.configuration.get("checkforupdate_b"))
8281
self._updates = []
8382

8483
self._body()
@@ -199,7 +198,16 @@ def _attach_events(self):
199198
self._lbl_copyright.bind("<Button>", self._on_license)
200199
self._btn_ok.bind("<Return>", self._ok_press)
201200
self._btn_ok.focus_set()
202-
self._checkonstartup.trace_add("write", self._on_save_settings)
201+
self._checkonstartup.trace_add("write", self._on_update_config)
202+
203+
def _on_update_config(self, var, index, mode): # pylint: disable=unused-argument
204+
"""
205+
Save current settings to saved app config dict.
206+
"""
207+
208+
self.__app.configuration.set(
209+
"checkforupdate_b", int(self._checkonstartup.get())
210+
)
203211

204212
def _on_github(self, *args, **kwargs): # pylint: disable=unused-argument
205213
"""
@@ -295,10 +303,3 @@ def _do_update(self, *args, **kwargs): # pylint: disable=unused-argument
295303

296304
self._btn_checkupdate.config(text="RESTART APP", fg=OKCOL)
297305
self._btn_checkupdate.bind("<Button>", self.__app.on_exit)
298-
299-
def _on_save_settings(self, var, index, mode): # pylint: disable=unused-argument
300-
"""
301-
Save current settings to saved app config dict.
302-
"""
303-
304-
self.__app.saved_config["checkforupdate_b"] = self._checkonstartup.get()

0 commit comments

Comments
 (0)