Fixed an issue in the code creation dialog. 5_1_x

Sat, 07 May 2011 13:38:24 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 07 May 2011 13:38:24 +0200
branch
5_1_x
changeset 1015
994fb489795e
parent 1013
bdf49619d9c6
child 1021
a54ae50e639b

Fixed an issue in the code creation dialog.

Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
--- a/Project/CreateDialogCodeDialog.py	Tue May 03 19:35:32 2011 +0200
+++ b/Project/CreateDialogCodeDialog.py	Sat May 07 13:38:24 2011 +0200
@@ -73,7 +73,10 @@
                 self.__initError = True
                 return
             
-            self.__module = ModuleParser.readModule(self.srcFile, caching = False)
+            try:
+                self.__module = ModuleParser.readModule(self.srcFile, caching=False)
+            except ImportError:
+                pass
         
         if self.__module is not None:
             self.filenameEdit.setText(self.srcFile)
@@ -84,7 +87,9 @@
             classesList.sort()
             self.classNameCombo.addItems(classesList)
         
-        if os.path.exists(self.srcFile) and self.classNameCombo.count() == 0:
+        if os.path.exists(self.srcFile) and \
+           self.__module is not None and \
+           self.classNameCombo.count() == 0:
             self.__initError = True
             E5MessageBox.critical(self,
                 self.trUtf8("Create Dialog Code"),
@@ -454,4 +459,4 @@
         """
         if button == self.okButton:
             self.__generateCode()
-            self.accept()
\ No newline at end of file
+            self.accept()

eric ide

mercurial