diff -r 9986ec0e559a -r 10516539f238 VCS/ProjectBrowserHelper.py --- a/VCS/ProjectBrowserHelper.py Tue Oct 15 22:03:54 2013 +0200 +++ b/VCS/ProjectBrowserHelper.py Fri Oct 18 23:00:41 2013 +0200 @@ -28,16 +28,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) """ @@ -50,9 +50,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) @@ -75,8 +77,10 @@ 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 """ raise RuntimeError('Not implemented') @@ -88,8 +92,10 @@ 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 """ raise RuntimeError('Not implemented') @@ -101,8 +107,10 @@ 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') @@ -114,14 +122,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): """ @@ -129,12 +139,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(): @@ -151,12 +162,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(): @@ -173,11 +185,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 = [] @@ -242,11 +255,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 @@ -256,14 +270,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: @@ -273,7 +289,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) @@ -281,13 +298,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: @@ -315,7 +334,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: @@ -333,7 +353,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(): @@ -346,7 +367,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: @@ -368,6 +390,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)