ViewManager/ViewManager.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
diff -r b0996e4a289e -r 1d8dd9706f46 ViewManager/ViewManager.py
--- a/ViewManager/ViewManager.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/ViewManager/ViewManager.py	Sat Jan 02 15:11:35 2010 +0000
@@ -19,7 +19,7 @@
 
 import Preferences
 
-from BookmarkedFilesDialog import BookmarkedFilesDialog
+from .BookmarkedFilesDialog import BookmarkedFilesDialog
 
 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
 from QScintilla.Editor import Editor
@@ -167,7 +167,7 @@
         Preferences.Prefs.rsettings.sync()
         rs = Preferences.Prefs.rsettings.value(recentNameFiles)
         if rs is not None:
-            for f in rs:
+            for f in Preferences.toList(rs):
                 if QFileInfo(f).exists():
                     self.recent.append(f)
         
@@ -425,6 +425,17 @@
         # list containing all spell checking actions
         self.spellingActions = []
         
+        self.__actions = {
+            "bookmark"  : self.bookmarkActions, 
+            "edit"      : self.editActions, 
+            "file"      : self.fileActions, 
+            "macro"     : self.macroActions, 
+            "search"    : self.searchActions, 
+            "spelling"  : self.spellingActions, 
+            "view"      : self.viewActions, 
+            "window"    : self.windowActions, 
+        }
+        
         self._initWindowActions()
         self.__initFileActions()
         self.__initEditActions()
@@ -697,8 +708,7 @@
         menu = QMenu(QApplication.translate('ViewManager', "Export as"))
         
         supportedExporters = QScintilla.Exporters.getSupportedFormats()
-        exporters = supportedExporters.keys()
-        exporters.sort()
+        exporters = sorted(list(supportedExporters.keys()))
         for exporter in exporters:
             act = menu.addAction(supportedExporters[exporter])
             act.setData(exporter)
@@ -3064,7 +3074,7 @@
         """
         try:
             newWin, editor = self.getEditor(fn, filetype = filetype)
-        except IOError:
+        except (IOError, UnicodeDecodeError):
             return
         
         if newWin:
@@ -3178,7 +3188,7 @@
         """
         try:
             newWin, self.currentEditor = self.getEditor(fn)
-        except IOError:
+        except (IOError, UnicodeDecodeError):
             return
         
         enc = self.currentEditor.getEncoding()
@@ -4683,15 +4693,14 @@
         
         @param type string denoting the action set to get.
                 It must be one of "edit", "file", "search",
-                "view", "window", "macro" or "bookmark"
+                "view", "window", "macro", "bookmark" or
+                "spelling".
         @return list of all actions (list of E4Action)
         """
         try:
-            exec 'actionList = self.%sActions[:]' % type
-        except AttributeError:
-            actionList = []
-        
-        return actionList
+            return self.__actions[type][:]
+        except KeyError:
+            return []
         
     def __editorCommand(self, cmd):
         """

eric ide

mercurial