Plugins/PluginTabnanny.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 3004
c4bf32c791d0
child 3058
0a02c433f52d
--- a/Plugins/PluginTabnanny.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Plugins/PluginTabnanny.py	Fri Oct 18 23:00:41 2013 +0200
@@ -100,8 +100,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)
@@ -112,11 +114,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:
@@ -124,7 +129,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)
@@ -149,8 +155,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)
@@ -160,9 +166,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"""
@@ -182,8 +189,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()
@@ -192,10 +200,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()
@@ -242,7 +251,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):
         """
@@ -251,7 +261,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