소스 검색

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…
취소
저장