Browse Source

Allow the load command to fail

When a device is selected from the list, its configuration is loaded
into the tmpcfg buffer.  When this failed due to there being no
configuration in the device, the ensuing exception prevented the device
from being configured by the GUI.

Now we explicitly silence the KeyError when loading configuration.  The
tmpcfg is still valid, so it can be read and manipulated just as always.
Clara Hobbs 7 years ago
parent
commit
ca62e277ea
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      pd-buddy-gtk.py

+ 5
- 1
pd-buddy-gtk.py View File

177
         window = self.builder.get_object("pdb-window")
177
         window = self.builder.get_object("pdb-window")
178
         try:
178
         try:
179
             with pdbuddy.Sink(self.serial_port) as pdbs:
179
             with pdbuddy.Sink(self.serial_port) as pdbs:
180
-                pdbs.load()
180
+                try:
181
+                    pdbs.load()
182
+                except KeyError:
183
+                    # If there's no configuration, we don't want to fail
184
+                    pass
181
                 self.cfg = pdbs.get_tmpcfg()
185
                 self.cfg = pdbs.get_tmpcfg()
182
         except OSError as e:
186
         except OSError as e:
183
             comms_error_dialog(window, e)
187
             comms_error_dialog(window, e)

Loading…
Cancel
Save