Quellcode durchsuchen

Catch when recent file type is not supported. See #192.

Juan Pablo Caram vor 10 Jahren
Ursprung
Commit
ced43df1bc
1 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen
  1. 9 5
      FlatCAMApp.py

+ 9 - 5
FlatCAMApp.py

@@ -3428,13 +3428,17 @@ class App(QtCore.QObject):
         for recent in self.recent:
             filename = recent['filename'].split('/')[-1].split('\\')[-1]
 
-            action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
+            try:
+                action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
+
+                # Attach callback
+                o = make_callback(openers[recent["kind"]], recent['filename'])
+                action.triggered.connect(o)
 
-            # Attach callback
-            o = make_callback(openers[recent["kind"]], recent['filename'])
-            action.triggered.connect(o)
+                self.ui.recent.addAction(action)
 
-            self.ui.recent.addAction(action)
+            except KeyError:
+                App.log.error("Unsupported file type: %s" % recent["kind"])
 
         # self.builder.get_object('open_recent').set_submenu(recent_menu)
         # self.ui.menufilerecent.set_submenu(recent_menu)