Bläddra i källkod

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 år sedan
förälder
incheckning
ca62e277ea
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5
    1
      pd-buddy-gtk.py

+ 5
- 1
pd-buddy-gtk.py Visa fil

@@ -177,7 +177,11 @@ class Handler:
177 177
         window = self.builder.get_object("pdb-window")
178 178
         try:
179 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 185
                 self.cfg = pdbs.get_tmpcfg()
182 186
         except OSError as e:
183 187
             comms_error_dialog(window, e)

Laddar…
Avbryt
Spara