ソースを参照

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)

読み込み中…
キャンセル
保存