Plugins/PluginTabnanny.py

changeset 3004
c4bf32c791d0
parent 2712
4354ab0b67c7
child 3022
57179e4cdadd
child 3057
10516539f238
--- a/Plugins/PluginTabnanny.py	Thu Oct 10 18:40:16 2013 +0200
+++ b/Plugins/PluginTabnanny.py	Thu Oct 10 19:03:45 2013 +0200
@@ -98,8 +98,10 @@
         e5App().getObject("Project").showMenu.connect(self.__projectShowMenu)
         e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\
             .showMenu.connect(self.__projectBrowserShowMenu)
-        e5App().getObject("ViewManager").editorOpenedEd.connect(self.__editorOpened)
-        e5App().getObject("ViewManager").editorClosedEd.connect(self.__editorClosed)
+        e5App().getObject("ViewManager").editorOpenedEd.connect(
+            self.__editorOpened)
+        e5App().getObject("ViewManager").editorClosedEd.connect(
+            self.__editorClosed)
         
         for editor in e5App().getObject("ViewManager").getOpenEditors():
             self.__editorOpened(editor)
@@ -110,11 +112,14 @@
         """
         Public method to deactivate this plugin.
         """
-        e5App().getObject("Project").showMenu.disconnect(self.__projectShowMenu)
+        e5App().getObject("Project").showMenu.disconnect(
+            self.__projectShowMenu)
         e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\
             .showMenu.disconnect(self.__projectBrowserShowMenu)
-        e5App().getObject("ViewManager").editorOpenedEd.disconnect(self.__editorOpened)
-        e5App().getObject("ViewManager").editorClosedEd.disconnect(self.__editorClosed)
+        e5App().getObject("ViewManager").editorOpenedEd.disconnect(
+            self.__editorOpened)
+        e5App().getObject("ViewManager").editorClosedEd.disconnect(
+            self.__editorClosed)
         
         menu = e5App().getObject("Project").getMenu("Checks")
         if menu:
@@ -122,7 +127,8 @@
         
         if self.__projectBrowserMenu:
             if self.__projectBrowserAct:
-                self.__projectBrowserMenu.removeAction(self.__projectBrowserAct)
+                self.__projectBrowserMenu.removeAction(
+                    self.__projectBrowserAct)
         
         for editor in self.__editors:
             editor.showMenu.disconnect(self.__editorShowMenu)
@@ -147,8 +153,8 @@
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
-        Private slot called, when the the project browser context menu or a submenu is
-        about to be shown.
+        Private slot called, when the the project browser context menu or a
+        submenu is about to be shown.
         
         @param menuName name of the menu to be shown (string)
         @param menu reference to the menu (QMenu)
@@ -158,9 +164,10 @@
                 ["Python3", "Python2", "Python"]:
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:
-                self.__projectBrowserAct = E5Action(self.trUtf8('Check Indentations'),
-                        self.trUtf8('&Indentations...'), 0, 0,
-                        self, "")
+                self.__projectBrowserAct = E5Action(
+                    self.trUtf8('Check Indentations'),
+                    self.trUtf8('&Indentations...'), 0, 0,
+                    self, "")
                 self.__projectBrowserAct.setWhatsThis(self.trUtf8(
                     """<b>Check Indentations...</b>"""
                     """<p>This checks Python files"""
@@ -180,8 +187,9 @@
         ppath = project.getProjectPath()
         files = [os.path.join(ppath, file) \
             for file in project.pdata["SOURCES"] \
-                if file.endswith(tuple(Preferences.getPython("Python3Extensions")) +
-                                 tuple(Preferences.getPython("PythonExtensions")))]
+                if file.endswith(
+                    tuple(Preferences.getPython("Python3Extensions")) +
+                    tuple(Preferences.getPython("PythonExtensions")))]
         
         from CheckerPlugins.Tabnanny.TabnannyDialog import TabnannyDialog
         self.__projectTabnannyDialog = TabnannyDialog()
@@ -190,10 +198,11 @@
     
     def __projectBrowserTabnanny(self):
         """
-        Private method to handle the tabnanny context menu action of the project
-        sources browser.
+        Private method to handle the tabnanny context menu action of the
+        project sources browser.
         """
-        browser = e5App().getObject("ProjectBrowser").getProjectBrowser("sources")
+        browser = e5App().getObject("ProjectBrowser").getProjectBrowser(
+            "sources")
         itm = browser.model().item(browser.currentIndex())
         try:
             fn = itm.fileName()
@@ -240,7 +249,8 @@
         if menuName == "Checks":
             if not self.__editorAct in menu.actions():
                 menu.addAction(self.__editorAct)
-            self.__editorAct.setEnabled(editor.isPy3File() or editor.isPy2File())
+            self.__editorAct.setEnabled(
+                editor.isPy3File() or editor.isPy2File())
     
     def __editorTabnanny(self):
         """
@@ -249,7 +259,8 @@
         editor = e5App().getObject("ViewManager").activeWindow()
         if editor is not None:
             if editor.checkDirty() and editor.getFileName() is not None:
-                from CheckerPlugins.Tabnanny.TabnannyDialog import TabnannyDialog
+                from CheckerPlugins.Tabnanny.TabnannyDialog import \
+                    TabnannyDialog
                 self.__editorTabnannyDialog = TabnannyDialog()
                 self.__editorTabnannyDialog.show()
                 self.__editorTabnannyDialog.start(editor.getFileName())

eric ide

mercurial