Project/ProjectBaseBrowser.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
--- a/Project/ProjectBaseBrowser.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Project/ProjectBaseBrowser.py	Fri Oct 18 23:00:41 2013 +0200
@@ -12,8 +12,8 @@
 import os
 
 from PyQt4.QtCore import QModelIndex, pyqtSignal, Qt
-from PyQt4.QtGui import QTreeView, QCursor, QItemSelection, QItemSelectionModel, \
-    QApplication, QMenu, QAbstractItemView, QDialog
+from PyQt4.QtGui import QTreeView, QCursor, QItemSelection, \
+    QItemSelectionModel, QApplication, QMenu, QAbstractItemView, QDialog
 
 from E5Gui.E5Application import e5App
 from E5Gui import E5MessageBox
@@ -22,12 +22,14 @@
 
 from .ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem, \
     ProjectBrowserDirectoryItem, ProjectBrowserFileItem
-from .ProjectBrowserSortFilterProxyModel import ProjectBrowserSortFilterProxyModel
+from .ProjectBrowserSortFilterProxyModel import \
+    ProjectBrowserSortFilterProxyModel
 
 
 class ProjectBaseBrowser(Browser):
     """
-    Baseclass implementing common functionality for the various project browsers.
+    Baseclass implementing common functionality for the various project
+    browsers.
     
     @signal closeSourceWindow(str) emitted to close a source file
     """
@@ -38,7 +40,7 @@
         Constructor
         
         @param project reference to the project object
-        @param type project browser type (string)
+        @param type_ project browser type (string)
         @param parent parent widget of this browser
         """
         QTreeView.__init__(self, parent)
@@ -112,7 +114,8 @@
 
         # create the menu for multiple selected files
         self.multiMenu = QMenu(self)
-        self.multiMenu.addAction(QApplication.translate('ProjectBaseBrowser', 'Open'),
+        self.multiMenu.addAction(
+            QApplication.translate('ProjectBaseBrowser', 'Open'),
             self._openItem)
         
         # create the background menu
@@ -272,7 +275,8 @@
         
     def _deleteDirectory(self):
         """
-        Protected method to delete the selected directory from the project data area.
+        Protected method to delete the selected directory from the project
+        data area.
         """
         itmList = self.getSelectedItems()
         
@@ -284,7 +288,8 @@
             dn = self.project.getRelativePath(dn)
             dirs.append(dn)
         
-        from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
+        from UI.DeleteFilesConfirmationDialog import \
+            DeleteFilesConfirmationDialog
         dlg = DeleteFilesConfirmationDialog(self.parent(),
             self.trUtf8("Delete directories"),
             self.trUtf8("Do you really want to delete these directories from"
@@ -413,7 +418,8 @@
         
     def _showContextMenuMulti(self, menu):
         """
-        Protected slot called before the context menu (multiple selections) is shown.
+        Protected slot called before the context menu (multiple selections) is
+        shown.
         
         It enables/disables the VCS menu entries depending on the overall
         VCS status and the files status.
@@ -454,7 +460,8 @@
             for act in self.dirMultiMenuActions:
                 act.setEnabled(True)
         else:
-            self.vcsHelper.showContextMenuDirMulti(menu, self.dirMultiMenuActions)
+            self.vcsHelper.showContextMenuDirMulti(
+                menu, self.dirMultiMenuActions)
         
     def _showContextMenuBack(self, menu):
         """
@@ -469,15 +476,16 @@
         """
         Protected method to select entries based on their VCS status.
         
-        @param local flag indicating local (i.e. non VCS controlled) file/directory
-            entries should be selected (boolean)
+        @param local flag indicating local (i.e. non VCS controlled)
+            file/directory entries should be selected (boolean)
         @param filter list of classes to check against
         """
         if self.project.vcs is None:
             return
         
         if local:
-            compareString = QApplication.translate('ProjectBaseBrowser', "local")
+            compareString = \
+                QApplication.translate('ProjectBaseBrowser', "local")
         else:
             compareString = self.project.vcs.vcsName()
         
@@ -524,29 +532,32 @@
         
     def selectLocalEntries(self):
         """
-        Public slot to handle the select local files context menu entries
+        Public slot to handle the select local files context menu entries.
         """
         self._selectEntries(local=True, filter=[ProjectBrowserFileItem])
         
     def selectVCSEntries(self):
         """
-        Public slot to handle the select VCS files context menu entries
+        Public slot to handle the select VCS files context menu entries.
         """
         self._selectEntries(local=False, filter=[ProjectBrowserFileItem])
         
     def selectLocalDirEntries(self):
         """
-        Public slot to handle the select local directories context menu entries
+        Public slot to handle the select local directories context menu
+        entries.
         """
         self._selectEntries(local=True,
-            filter=[ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem])
+            filter=[ProjectBrowserSimpleDirectoryItem,
+                    ProjectBrowserDirectoryItem])
         
     def selectVCSDirEntries(self):
         """
-        Public slot to handle the select VCS directories context menu entries
+        Public slot to handle the select VCS directories context menu entries.
         """
         self._selectEntries(local=False,
-            filter=[ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem])
+            filter=[ProjectBrowserSimpleDirectoryItem,
+                    ProjectBrowserDirectoryItem])
         
     def _prepareRepopulateItem(self, name):
         """
@@ -573,7 +584,8 @@
             if childIndex.parent() == index.parent():
                 break
             if self.isExpanded(childIndex):
-                self.expandedNames.append(self.model().item(childIndex).data(0))
+                self.expandedNames.append(
+                    self.model().item(childIndex).data(0))
             childIndex = self.indexBelow(childIndex)
         
     def _completeRepopulateItem(self, name):
@@ -589,12 +601,14 @@
                 if self.isExpanded(index):
                     childIndex = self.indexBelow(index)
                     while childIndex.isValid():
-                        if not childIndex.isValid() or childIndex.parent() == index.parent():
+                        if not childIndex.isValid() or \
+                                childIndex.parent() == index.parent():
                             break
                         itm = self.model().item(childIndex)
                         if itm is not None:
                             itemData = itm.data(0)
-                            if self.currentItemName and self.currentItemName == itemData:
+                            if self.currentItemName and \
+                                    self.currentItemName == itemData:
                                 self._selectSingleItem(childIndex)
                             if itemData in self.expandedNames:
                                 self.setExpanded(childIndex, True)
@@ -616,9 +630,9 @@
         itm = self.model().item(self.currentIndex())
         return itm
     
-    ############################################################################
+    ###########################################################################
     ## Support for hooks below
-    ############################################################################
+    ###########################################################################
     
     def _initHookMethods(self):
         """
@@ -632,7 +646,10 @@
         
     def __checkHookKey(self, key):
         """
-        Private method to check a hook key
+        Private method to check a hook key.
+        
+        @param key key of the hook to check (string)
+        @exception KeyError raised to indicate an invalid hook
         """
         if len(self.hooks) == 0:
             raise KeyError("Hooks are not initialized.")
@@ -680,4 +697,5 @@
         """
         Protected method to open the configuration dialog.
         """
-        e5App().getObject("UserInterface").showPreferences("projectBrowserPage")
+        e5App().getObject("UserInterface")\
+            .showPreferences("projectBrowserPage")

eric ide

mercurial