瀏覽代碼

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 年之前
父節點
當前提交
ca62e277ea
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      pd-buddy-gtk.py

+ 5
- 1
pd-buddy-gtk.py 查看文件

@@ -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)

Loading…
取消
儲存