Skip to content

Commit 57c8922

Browse files
committed
Fix Load Configuration error Fixes #232
1 parent 70ef971 commit 57c8922

6 files changed

Lines changed: 27 additions & 17 deletions

File tree

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
### RELEASE 1.6.0
44

5+
FIXES:
6+
7+
1. Fix Load Configuration error \#232 `AttributeError: 'tuple' object has no attribute 'upper'`.
8+
9+
ENHANCEMENTS:
10+
511
1. Add user-selectable Signals widget, displaying individual GNSS PRN / Signal ID levels and (where applicable) correction sources (receiver must support UBX NAV-SIG messages). Provides greater granularity than the existing Levels widget for UBX devices. Signal IDs are shown in RINEX format e.g. "L1_C/A", "E5_aQ", etc.
612
1. Add user-defined preset import facility to Configuration Load/Save/Record panel (accessed via Menu..Options..Configuration Command Recorder). This allows user to record a sequence of UBX, NMEA or TTY commands as they are sent to the receiver and to import this sequence as a user-defined preset in the PyGPSClient json configuration file. This obviates the need to edit the configuration file manually. Remember to re-save the configuration file to persist the changes.
713
1. Add Undock/Dock Settings panel facility, via Menu..View..Undock/Dock Settings. Settings panel can now be undocked from the main application window and displayed as a separate Toplevel dialog. If (*and only if*) non-transient (`transient_dialog_b: 0`), the settings panel can be minimized independently of the main window.

src/pygpsclient/app.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@
122122
INACTIVE_TIMEOUT,
123123
INTROTXTNOPORTS,
124124
KILLSWITCH,
125-
LOADCONFIGBAD,
126-
LOADCONFIGOK,
127125
NOTCONN,
128126
NOWDGSWARN,
129127
SAVECONFIGBAD,
@@ -499,20 +497,16 @@ def load_config(self):
499497
if err == "": # load succeeded
500498
self.update_widgets()
501499
for frm in (
502-
self.frm_settings,
500+
self.frm_settings.frm_settings,
503501
self.frm_settings.frm_serial,
504502
self.frm_settings.frm_socketclient,
505503
):
506504
frm.reset()
507505
self._do_layout()
508506
if self._nowidgets:
509507
self.status_label = (NOWDGSWARN.format(filename), ERRCOL)
510-
else:
511-
self.status_label = (LOADCONFIGOK.format(filename), OKCOL)
512-
elif err == "cancelled": # user cancelled
513-
return
514-
else: # config error
515-
self.status_label = (LOADCONFIGBAD.format(filename), ERRCOL)
508+
elif err == "cancelled":
509+
pass
516510

517511
def save_config(self):
518512
"""
@@ -681,7 +675,6 @@ def update_clients(self, clients: int):
681675
"""
682676

683677
self.server_status = clients
684-
# self.frm_settings.frm_socketserver.clients = clients TODO
685678

686679
def _shutdown(self):
687680
"""

src/pygpsclient/configuration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ def loadfile(self, filename: str | NoneType = None) -> tuple:
293293
resave = True
294294
continue
295295
else:
296+
if err == "cancelled": # user cancelled
297+
return filename, err
296298
if "No such file or directory" in err:
297299
err = LOADCONFIGNONE.format(fname)
298300
else:

src/pygpsclient/file_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def load_config(self, filename: Path = CONFIGFILE) -> tuple:
124124
try:
125125
if filename is None:
126126
filename = self.open_file(
127+
None,
127128
"config",
128129
(
129130
("config files", "*.json"),

src/pygpsclient/settings_child_frame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
HOME,
5959
ICON_CONN,
6060
ICON_DISCONN,
61-
ICON_EXIT,
6261
ICON_LOGREAD,
6362
ICON_NMEACONFIG,
6463
ICON_NTRIPCONFIG,

src/pygpsclient/status_frame.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,33 @@ def __init__(self, app, *args, **kwargs):
3636

3737
self.width, self.height = self.get_size()
3838
self._body()
39-
40-
self.bind("<Configure>", self._on_resize)
39+
self._do_layout()
40+
self._attach_events()
4141

4242
def _body(self):
4343
"""
4444
Set up frame and widgets.
4545
"""
4646

47-
self.grid_rowconfigure(0, weight=1)
48-
49-
self.option_add("*Font", self.__app.font_md)
50-
5147
self.lbl_connection = Label(self, anchor=W)
5248
self.lbl_status = Label(self, anchor=W)
49+
50+
def _do_layout(self):
51+
"""
52+
Position widgets in frame.
53+
"""
54+
5355
self.lbl_connection.grid(column=0, row=0, sticky=EW)
5456
ttk.Separator(self, orient=VERTICAL).grid(column=1, row=0, sticky=NS)
5557
self.lbl_status.grid(column=2, row=0, sticky=EW)
5658

59+
def _attach_events(self):
60+
"""
61+
Bind events to frame.
62+
"""
63+
64+
self.bind("<Configure>", self._on_resize)
65+
5766
def _on_resize(self, event): # pylint: disable=unused-argument
5867
"""
5968
Resize frame

0 commit comments

Comments
 (0)