QScintilla/Editor.py

branch
Py2 comp.
changeset 3178
f25fc1364c88
parent 3161
06f57a834adf
parent 3169
7b1b754a60a6
child 3456
96232974dcdb
--- a/QScintilla/Editor.py	Wed Jan 01 14:39:32 2014 +0100
+++ b/QScintilla/Editor.py	Sun Jan 05 23:22:17 2014 +0100
@@ -149,7 +149,7 @@
         @exception IOError raised to indicate an issue accessing the file
         """
         super(Editor, self).__init__()
-        self.setAttribute(Qt.WA_DeleteOnClose)
+##        self.setAttribute(Qt.WA_DeleteOnClose)
         self.setAttribute(Qt.WA_KeyCompression)
         self.setUtf8(True)
         
@@ -612,10 +612,12 @@
             self.menuShow = self.__initContextMenuShow()
             self.graphicsMenu = self.__initContextMenuGraphics()
             self.autocompletionMenu = self.__initContextMenuAutocompletion()
+            self.toolsMenu = self.__initContextMenuTools()
             self.__menus["Checks"] = self.checksMenu
             self.__menus["Show"] = self.menuShow
             self.__menus["Graphics"] = self.graphicsMenu
             self.__menus["Autocompletion"] = self.autocompletionMenu
+            self.__menus["Tools"] = self.toolsMenu
         self.exportersMenu = self.__initContextMenuExporters()
         self.__menus["Exporters"] = self.exportersMenu
         self.eolMenu = self.__initContextMenuEol()
@@ -721,6 +723,8 @@
             self.menu.addSeparator()
             self.menuActs["Diagrams"] = self.menu.addMenu(self.graphicsMenu)
         self.menu.addSeparator()
+        self.menuActs["Tools"] = self.menu.addMenu(self.toolsMenu)
+        self.menu.addSeparator()
         self.menu.addAction(
             UI.PixmapCache.getIcon("documentNewView.png"),
             self.trUtf8('New Document View'), self.__newView)
@@ -799,6 +803,16 @@
         menu.aboutToShow.connect(self.__showContextMenuChecks)
         return menu
 
+    def __initContextMenuTools(self):
+        """
+        Private method used to setup the Tools context sub menu.
+        
+        @return reference to the generated menu (QMenu)
+        """
+        menu = QMenu(self.trUtf8('Tools'))
+        menu.aboutToShow.connect(self.__showContextMenuTools)
+        return menu
+
     def __initContextMenuShow(self):
         """
         Private method used to setup the Show context sub menu.
@@ -2954,7 +2968,8 @@
                         self.project.startswithProjectPath(fn):
                     self.project.appendFile(self.fileName)
                     self.addedToProject()
-                    self.setLanguage(self.fileName)
+                
+                self.setLanguage(self.fileName)
             
             self.lastModified = QFileInfo(self.fileName).lastModified()
             if newName is not None:
@@ -4645,6 +4660,8 @@
             self.menuActs["NewSplit"].setIcon(
                 UI.PixmapCache.getIcon("splitVertical.png"))
         
+        self.menuActs["Tools"].setEnabled(not self.toolsMenu.isEmpty())
+        
         self.showMenu.emit("Main", self.menu,  self)
         
     def __showContextMenuAutocompletion(self):
@@ -4827,6 +4844,13 @@
         """
         self.showMenu.emit("Checks", self.checksMenu,  self)
         
+    def __showContextMenuTools(self):
+        """
+        Private slot handling the aboutToShow signal of the tools context
+        menu.
+        """
+        self.showMenu.emit("Tools", self.toolsMenu,  self)
+        
     def __contextSave(self):
         """
         Private slot handling the save context menu entry.
@@ -5335,6 +5359,9 @@
             line = self.markerLine(handle) + 1
             self.toggleSyntaxError(line, 0, False)
         
+        self.syntaxerrors = {}
+        self.syntaxerrorToggled.emit(self)
+    
     def __showSyntaxError(self, line=-1):
         """
         Private slot to handle the 'Show syntax error message'

eric ide

mercurial