From ced43df1bc6bd19ed8b5a4e1a6ce503f6fcbb23f Mon Sep 17 00:00:00 2001 From: Juan Pablo Caram Date: Mon, 29 Feb 2016 14:18:50 -0500 Subject: [PATCH] Catch when recent file type is not supported. See #192. --- FlatCAMApp.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 6af4afe6..711a6d66 100644 --- a/FlatCAMApp.py +++ b/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)