VCS/ProjectBrowserHelper.py

changeset 3013
fe886b7f8f40
parent 2965
d133c7edd88a
child 3031
ed2eaa573ca5
child 3057
10516539f238
--- a/VCS/ProjectBrowserHelper.py	Sun Oct 13 14:56:56 2013 +0200
+++ b/VCS/ProjectBrowserHelper.py	Sun Oct 13 16:11:46 2013 +0200
@@ -26,16 +26,16 @@
     """
     Class implementing the base class of the VCS project browser helper.
     """
-    def __init__(self, vcsObject, browserObject, projectObject, isTranslationsBrowser,
-        parent=None, name=None):
+    def __init__(self, vcsObject, browserObject, projectObject,
+                 isTranslationsBrowser, parent=None, name=None):
         """
         Constructor
         
         @param vcsObject reference to the vcs object
         @param browserObject reference to the project browser object
         @param projectObject reference to the project object
-        @param isTranslationsBrowser flag indicating, the helper is requested for the
-            translations browser (this needs some special treatment)
+        @param isTranslationsBrowser flag indicating, the helper is requested
+            for the translations browser (this needs some special treatment)
         @param parent parent widget (QWidget)
         @param name name of this object (string)
         """
@@ -48,9 +48,11 @@
         self.isTranslationsBrowser = isTranslationsBrowser
         self.project = projectObject
     
-    def addVCSMenus(self, mainMenu, multiMenu, backMenu, dirMenu, dirMultiMenu):
+    def addVCSMenus(self, mainMenu, multiMenu, backMenu, dirMenu,
+                    dirMultiMenu):
         """
-        Public method to add the VCS entries to the various project browser menus.
+        Public method to add the VCS entries to the various project browser
+        menus.
         
         @param mainMenu reference to the main menu (QPopupMenu)
         @param multiMenu reference to the multiple selection menu (QPopupMenu)
@@ -73,8 +75,8 @@
         VCS status and the file status.
         
         @param menu reference to the menu to be shown
-        @param standardItems array of standard items that need activation/deactivation
-            depending on the overall VCS status
+        @param standardItems array of standard items that need 
+            activation/deactivation depending on the overall VCS status
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -88,8 +90,8 @@
         VCS status and the files status.
         
         @param menu reference to the menu to be shown
-        @param standardItems array of standard items that need activation/deactivation
-            depending on the overall VCS status
+        @param standardItems array of standard items that need
+            activation/deactivation depending on the overall VCS status
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -103,8 +105,8 @@
         VCS status and the directory status.
         
         @param menu reference to the menu to be shown
-        @param standardItems array of standard items that need activation/deactivation
-            depending on the overall VCS status
+        @param standardItems array of standard items that
+            need activation/deactivation depending on the overall VCS status
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -118,16 +120,16 @@
         VCS status and the directory status.
         
         @param menu reference to the menu to be shown
-        @param standardItems array of standard items that need activation/deactivation
-            depending on the overall VCS status
+        @param standardItems array of standard items that need
+            activation/deactivation depending on the overall VCS status
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
         raise RuntimeError('Not implemented')
 
-    ############################################################################
+    ###########################################################################
     ## General menu handling methods below
-    ############################################################################
+    ###########################################################################
     
     def _VCSUpdate(self):
         """
@@ -135,12 +137,13 @@
         VCS repository.
         """
         if self.isTranslationsBrowser:
-            names = [itm.dirName() \
-                for itm in self.browser.getSelectedItems(
-                    [ProjectBrowserSimpleDirectoryItem])]
+            names = [itm.dirName()
+                     for itm in self.browser.getSelectedItems(
+                        [ProjectBrowserSimpleDirectoryItem])]
             if not names:
-                names = [itm.fileName() \
-                    for itm in self.browser.getSelectedItems([ProjectBrowserFileItem])]
+                names = [itm.fileName()
+                         for itm in self.browser.getSelectedItems(
+                            [ProjectBrowserFileItem])]
         else:
             names = []
             for itm in self.browser.getSelectedItems():
@@ -157,12 +160,13 @@
         VCS repository.
         """
         if self.isTranslationsBrowser:
-            names = [itm.dirName() \
-                for itm in self.browser.getSelectedItems(
-                    [ProjectBrowserSimpleDirectoryItem])]
+            names = [itm.dirName()
+                     for itm in self.browser.getSelectedItems(
+                        [ProjectBrowserSimpleDirectoryItem])]
             if not names:
-                names = [itm.fileName() \
-                    for itm in self.browser.getSelectedItems([ProjectBrowserFileItem])]
+                names = [itm.fileName()
+                         for itm in self.browser.getSelectedItems(
+                            [ProjectBrowserFileItem])]
         else:
             names = []
             for itm in self.browser.getSelectedItems():
@@ -179,11 +183,12 @@
         
     def _VCSAdd(self):
         """
-        Protected slot called by the context menu to add the selected file to the
-        VCS repository.
+        Protected slot called by the context menu to add the selected file to
+        the VCS repository.
         """
         if self.isTranslationsBrowser:
-            items = self.browser.getSelectedItems([ProjectBrowserSimpleDirectoryItem])
+            items = self.browser.getSelectedItems(
+                [ProjectBrowserSimpleDirectoryItem])
             if items:
                 names = [itm.dirName() for itm in items]
                 qnames = []
@@ -248,11 +253,12 @@
         
     def _VCSRemove(self):
         """
-        Protected slot called by the context menu to remove the selected file from the
-        VCS repository.
+        Protected slot called by the context menu to remove the selected file
+        from the VCS repository.
         """
         if self.isTranslationsBrowser:
-            items = self.browser.getSelectedItems([ProjectBrowserSimpleDirectoryItem])
+            items = self.browser.getSelectedItems(
+                [ProjectBrowserSimpleDirectoryItem])
             if items:
                 return      # not supported
             
@@ -262,14 +268,16 @@
             
             dlg = DeleteFilesConfirmationDialog(self.parent(),
                 self.trUtf8("Remove from repository (and disk)"),
-                self.trUtf8("Do you really want to remove these translation files from"
+                self.trUtf8(
+                    "Do you really want to remove these translation files from"
                     " the repository (and disk)?"),
                 names)
         else:
             items = self.browser.getSelectedItems()
             isRemoveDirs = len(items) == \
                 self.browser.getSelectedItemsCount(
-                [ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem])
+                    [ProjectBrowserSimpleDirectoryItem,
+                     ProjectBrowserDirectoryItem])
             if isRemoveDirs:
                 names = [itm.dirName() for itm in items]
             else:
@@ -279,7 +287,8 @@
             
             dlg = DeleteFilesConfirmationDialog(self.parent(),
                 self.trUtf8("Remove from repository (and disk)"),
-                self.trUtf8("Do you really want to remove these files/directories"
+                self.trUtf8(
+                    "Do you really want to remove these files/directories"
                     " from the repository (and disk)?"),
                 files)
         
@@ -287,13 +296,15 @@
             status = self.vcs.vcsRemove(names)
             if status:
                 if isRemoveDirs:
-                    self.browser._removeDir()  # remove directories from Project
+                    self.browser._removeDir()  # remove directories from
+                                               # Project
                 else:
                     self.browser._removeFile()  # remove file(s) from project
         
     def _VCSLog(self):
         """
-        Protected slot called by the context menu to show the VCS log of a file/directory.
+        Protected slot called by the context menu to show the VCS log of a
+        file/directory.
         """
         itm = self.browser.currentItem()
         try:
@@ -321,7 +332,8 @@
         Protected slot called by the context menu to show the status of a file.
         """
         if self.isTranslationsBrowser:
-            items = self.browser.getSelectedItems([ProjectBrowserSimpleDirectoryItem])
+            items = self.browser.getSelectedItems(
+                [ProjectBrowserSimpleDirectoryItem])
             if items:
                 names = [itm.dirName() for itm in items]
             else:
@@ -339,7 +351,8 @@
 
     def _VCSRevert(self):
         """
-        Protected slot called by the context menu to revert changes made to a file.
+        Protected slot called by the context menu to revert changes made to a
+        file.
         """
         names = []
         for itm in self.browser.getSelectedItems():
@@ -352,7 +365,8 @@
 
     def _VCSMerge(self):
         """
-        Protected slot called by the context menu to merge changes into to a file.
+        Protected slot called by the context menu to merge changes into to a
+        file.
         """
         itm = self.browser.currentItem()
         try:
@@ -374,6 +388,7 @@
         """
         Protected method to update the VCS status of an item.
         
-        @param name filename or directoryname of the item to be updated (string)
+        @param name filename or directoryname of the item to be updated
+            (string)
         """
         self.project.getModel().updateVCSStatus(name)

eric ide

mercurial