RefactoringRope/Refactoring.py

changeset 20
83b71483e198
parent 19
32dd7dbf3e8e
child 26
b02d1f37b55e
--- a/RefactoringRope/Refactoring.py	Sun Jan 30 19:00:34 2011 +0100
+++ b/RefactoringRope/Refactoring.py	Sun Jan 30 19:19:40 2011 +0100
@@ -105,9 +105,9 @@
         #####################################################
         
         self.refactoringRenameAct = E5Action(self.trUtf8('Rename'),
-                self.trUtf8('&Rename'), 
+                self.trUtf8('&Rename'),
                 0, 0,
-                self,'refactoring_rename')
+                self, 'refactoring_rename')
         self.refactoringRenameAct.setStatusTip(self.trUtf8(
             'Rename the highlighted object'))
         self.refactoringRenameAct.setWhatsThis(self.trUtf8(
@@ -119,9 +119,9 @@
         self.actions.append(self.refactoringRenameAct)
         
         self.refactoringRenameLocalAct = E5Action(self.trUtf8('Local Rename'),
-                self.trUtf8('&Local Rename'), 
+                self.trUtf8('&Local Rename'),
                 0, 0,
-                self,'refactoring_rename_local')
+                self, 'refactoring_rename_local')
         self.refactoringRenameLocalAct.setStatusTip(self.trUtf8(
             'Rename the highlighted object in the current module only'))
         self.refactoringRenameLocalAct.setWhatsThis(self.trUtf8(
@@ -135,9 +135,9 @@
         
         self.refactoringRenameModuleAct = E5Action(
                 self.trUtf8('Rename Current Module'),
-                self.trUtf8('Rename Current Module'), 
+                self.trUtf8('Rename Current Module'),
                 0, 0,
-                self,'refactoring_rename_module')
+                self, 'refactoring_rename_module')
         self.refactoringRenameModuleAct.setStatusTip(self.trUtf8(
             'Rename the current module'))
         self.refactoringRenameModuleAct.setWhatsThis(self.trUtf8(
@@ -150,9 +150,9 @@
         
         self.refactoringChangeOccurrencesAct = E5Action(
                 self.trUtf8('Change Occurrences'),
-                self.trUtf8('Change &Occurrences'), 
+                self.trUtf8('Change &Occurrences'),
                 0, 0,
-                self,'refactoring_change_occurrences')
+                self, 'refactoring_change_occurrences')
         self.refactoringChangeOccurrencesAct.setStatusTip(self.trUtf8(
             'Change all occurrences in the local scope'))
         self.refactoringChangeOccurrencesAct.setWhatsThis(self.trUtf8(
@@ -171,7 +171,7 @@
                 self.trUtf8('Extract method'),
                 self.trUtf8('Extract &Method'),
                 0, 0,
-                self,'refactoring_extract_method')
+                self, 'refactoring_extract_method')
         self.refactoringExtractMethodAct.setStatusTip(self.trUtf8(
             'Extract the highlighted area as a method'))
         self.refactoringExtractMethodAct.setWhatsThis(self.trUtf8(
@@ -186,7 +186,7 @@
                 self.trUtf8('Extract local variable'),
                 self.trUtf8('&Extract Local Variable'),
                 0, 0,
-                self,'refactoring_extract_variable')
+                self, 'refactoring_extract_variable')
         self.refactoringExtractLocalVariableAct.setStatusTip(self.trUtf8(
             'Extract the highlighted area as a local variable'))
         self.refactoringExtractLocalVariableAct.setWhatsThis(self.trUtf8(
@@ -205,7 +205,7 @@
                 self.trUtf8('Inline'),
                 self.trUtf8('&Inline'),
                 0, 0,
-                self,'refactoring_inline')
+                self, 'refactoring_inline')
         self.refactoringInlineAct.setStatusTip(self.trUtf8(
             'Inlines the selected local variable or method'))
         self.refactoringInlineAct.setWhatsThis(self.trUtf8(
@@ -224,7 +224,7 @@
                 self.trUtf8('Move method'),
                 self.trUtf8('Mo&ve Method'),
                 0, 0,
-                self,'refactoring_move_method')
+                self, 'refactoring_move_method')
         self.refactoringMoveMethodAct.setStatusTip(self.trUtf8(
             'Move the highlighted method to another class'))
         self.refactoringMoveMethodAct.setWhatsThis(self.trUtf8(
@@ -239,7 +239,7 @@
                 self.trUtf8('Move current module'),
                 self.trUtf8('Move Current Module'),
                 0, 0,
-                self,'refactoring_move_module')
+                self, 'refactoring_move_module')
         self.refactoringMoveModuleAct.setStatusTip(self.trUtf8(
             'Move the current module to another package'))
         self.refactoringMoveModuleAct.setWhatsThis(self.trUtf8(
@@ -258,7 +258,7 @@
                 self.trUtf8('Use Function'),
                 self.trUtf8('Use Function'),
                 0, 0,
-                self,'refactoring_use_function')
+                self, 'refactoring_use_function')
         self.refactoringUseFunctionAct.setStatusTip(self.trUtf8(
             'Use a function wherever possible.'))
         self.refactoringUseFunctionAct.setWhatsThis(self.trUtf8(
@@ -277,7 +277,7 @@
                 self.trUtf8('Introduce Factory Method'),
                 self.trUtf8('Introduce &Factory Method'),
                 0, 0,
-                self,'refactoring_introduce_factory_method')
+                self, 'refactoring_introduce_factory_method')
         self.refactoringIntroduceFactoryAct.setStatusTip(self.trUtf8(
             'Introduce a factory method or function'))
         self.refactoringIntroduceFactoryAct.setWhatsThis(self.trUtf8(
@@ -292,7 +292,7 @@
                 self.trUtf8('Introduce Parameter'),
                 self.trUtf8('Introduce &Parameter'),
                 0, 0,
-                self,'refactoring_introduce_parameter_method')
+                self, 'refactoring_introduce_parameter_method')
         self.refactoringIntroduceParameterAct.setStatusTip(self.trUtf8(
             'Introduce a parameter in a function'))
         self.refactoringIntroduceParameterAct.setWhatsThis(self.trUtf8(
@@ -311,7 +311,7 @@
                 self.trUtf8('Organize Imports'),
                 self.trUtf8('&Organize Imports'),
                 0, 0,
-                self,'refactoring_organize_imports')
+                self, 'refactoring_organize_imports')
         self.refactoringImportsOrganizeAct.setStatusTip(self.trUtf8(
             'Sort imports according to PEP-8'))
         self.refactoringImportsOrganizeAct.setWhatsThis(self.trUtf8(
@@ -326,7 +326,7 @@
                 self.trUtf8('Expand Star Imports'),
                 self.trUtf8('E&xpand Star Imports'),
                 0, 0,
-                self,'refactoring_expand_star_imports')
+                self, 'refactoring_expand_star_imports')
         self.refactoringImportsStarExpandAct.setStatusTip(self.trUtf8(
             'Expand imports like "from xxx import *"'))
         self.refactoringImportsStarExpandAct.setWhatsThis(self.trUtf8(
@@ -343,7 +343,7 @@
                 self.trUtf8('Relative to Absolute'),
                 self.trUtf8('Relative to &Absolute'),
                 0, 0,
-                self,'refactoring_relative_to_absolute_imports')
+                self, 'refactoring_relative_to_absolute_imports')
         self.refactoringImportsRelativeToAbsoluteAct.setStatusTip(self.trUtf8(
             'Transform relative imports to absolute ones'))
         self.refactoringImportsRelativeToAbsoluteAct.setWhatsThis(self.trUtf8(
@@ -360,7 +360,7 @@
                 self.trUtf8('Froms to Imports'),
                 self.trUtf8('Froms to &Imports'),
                 0, 0,
-                self,'refactoring_froms_to_imports')
+                self, 'refactoring_froms_to_imports')
         self.refactoringImportsFromsToImportsAct.setStatusTip(self.trUtf8(
             'Transform From imports to plain imports'))
         self.refactoringImportsFromsToImportsAct.setWhatsThis(self.trUtf8(
@@ -377,7 +377,7 @@
                 self.trUtf8('Handle Long Imports'),
                 self.trUtf8('Handle &Long Imports'),
                 0, 0,
-                self,'refactoring_organize_imports')
+                self, 'refactoring_organize_imports')
         self.refactoringImportsHandleLongAct.setStatusTip(self.trUtf8(
             'Transform long import statements to look better'))
         self.refactoringImportsHandleLongAct.setWhatsThis(self.trUtf8(
@@ -398,7 +398,7 @@
                 self.trUtf8('Restructure'),
                 self.trUtf8('Res&tructure'),
                 0, 0,
-                self,'refactoring_restructure')
+                self, 'refactoring_restructure')
         self.refactoringRestructureAct.setStatusTip(self.trUtf8(
             'Restructure code'))
         self.refactoringRestructureAct.setWhatsThis(self.trUtf8(
@@ -413,7 +413,7 @@
                 self.trUtf8('Change Method Signature'),
                 self.trUtf8('&Change Method Signature'),
                 0, 0,
-                self,'refactoring_change_method_signature')
+                self, 'refactoring_change_method_signature')
         self.refactoringChangeSignatureAct.setStatusTip(self.trUtf8(
             'Change the signature of the selected method or function'))
         self.refactoringChangeSignatureAct.setWhatsThis(self.trUtf8(
@@ -429,7 +429,7 @@
                 self.trUtf8('Inline Argument Default'),
                 self.trUtf8('Inline &Argument Default'),
                 0, 0,
-                self,'refactoring_inline_argument_default')
+                self, 'refactoring_inline_argument_default')
         self.refactoringInlineArgumentDefaultAct.setStatusTip(self.trUtf8(
             'Inline a parameters default value'))
         self.refactoringInlineArgumentDefaultAct.setWhatsThis(self.trUtf8(
@@ -444,7 +444,7 @@
                 self.trUtf8('Transform Module to Package'),
                 self.trUtf8('Transform Module to Package'),
                 0, 0,
-                self,'refactoring_transform_module_to_package')
+                self, 'refactoring_transform_module_to_package')
         self.refactoringTransformModuleAct.setStatusTip(self.trUtf8(
             'Transform the current module to a package'))
         self.refactoringTransformModuleAct.setWhatsThis(self.trUtf8(
@@ -459,7 +459,7 @@
                 self.trUtf8('Encapsulate Attribute'),
                 self.trUtf8('Encap&sulate Attribute'),
                 0, 0,
-                self,'refactoring_encapsulate_attribute')
+                self, 'refactoring_encapsulate_attribute')
         self.refactoringEncapsulateAttributeAct.setStatusTip(self.trUtf8(
             'Generate a getter/setter for an attribute'))
         self.refactoringEncapsulateAttributeAct.setWhatsThis(self.trUtf8(
@@ -475,7 +475,7 @@
                 self.trUtf8('Local Variable to Attribute'),
                 self.trUtf8('Local Varia&ble to Attribute'),
                 0, 0,
-                self,'refactoring_local_variable_to_attribute')
+                self, 'refactoring_local_variable_to_attribute')
         self.refactoringLocalVariableToAttributeAct.setStatusTip(self.trUtf8(
             'Change a local variable to an attribute'))
         self.refactoringLocalVariableToAttributeAct.setWhatsThis(self.trUtf8(
@@ -490,7 +490,7 @@
                 self.trUtf8('Method To Method Object'),
                 self.trUtf8('Method To Method Ob&ject'),
                 0, 0,
-                self,'refactoring_method_to_methodobject')
+                self, 'refactoring_method_to_methodobject')
         self.refactoringMethodToMethodObjectAct.setStatusTip(self.trUtf8(
             'Transform a function or a method to a method object'))
         self.refactoringMethodToMethodObjectAct.setWhatsThis(self.trUtf8(
@@ -506,9 +506,9 @@
         #####################################################
         
         self.refactoringUndoAct = E5Action(self.trUtf8('Undo'),
-                self.trUtf8('&Undo'), 
+                self.trUtf8('&Undo'),
                 0, 0,
-                self,'refactoring_undo')
+                self, 'refactoring_undo')
         self.refactoringUndoAct.setStatusTip(self.trUtf8(
             'Undo the last refactoring'))
         self.refactoringUndoAct.setWhatsThis(self.trUtf8(
@@ -520,9 +520,9 @@
         self.actions.append(self.refactoringUndoAct)
         
         self.refactoringRedoAct = E5Action(self.trUtf8('Redo'),
-                self.trUtf8('Re&do'), 
+                self.trUtf8('Re&do'),
                 0, 0,
-                self,'refactoring_redo')
+                self, 'refactoring_redo')
         self.refactoringRedoAct.setStatusTip(self.trUtf8(
             'Redo the last refactoring'))
         self.refactoringRedoAct.setWhatsThis(self.trUtf8(
@@ -535,9 +535,9 @@
         
         self.refactoringUndoHistoryAct = \
             E5Action(self.trUtf8('Show Project Undo History'),
-                self.trUtf8('Show Project Undo History'), 
+                self.trUtf8('Show Project Undo History'),
                 0, 0,
-                self,'refactoring_show_project_undo_history')
+                self, 'refactoring_show_project_undo_history')
         self.refactoringUndoHistoryAct.setStatusTip(self.trUtf8(
             'Show the undo history of the project'))
         self.refactoringUndoHistoryAct.setWhatsThis(self.trUtf8(
@@ -551,9 +551,9 @@
         
         self.refactoringRedoHistoryAct = \
             E5Action(self.trUtf8('Show Project Redo History'),
-                self.trUtf8('Show Project Redo History'), 
+                self.trUtf8('Show Project Redo History'),
                 0, 0,
-                self,'refactoring_show_project_redo_history')
+                self, 'refactoring_show_project_redo_history')
         self.refactoringRedoHistoryAct.setStatusTip(self.trUtf8(
             'Show the redo history of the project'))
         self.refactoringRedoHistoryAct.setWhatsThis(self.trUtf8(
@@ -567,9 +567,9 @@
         
         self.refactoringUndoFileHistoryAct = \
             E5Action(self.trUtf8('Show Current File Undo History'),
-                self.trUtf8('Show Current File Undo History'), 
+                self.trUtf8('Show Current File Undo History'),
                 0, 0,
-                self,'refactoring_show_file_undo_history')
+                self, 'refactoring_show_file_undo_history')
         self.refactoringUndoFileHistoryAct.setStatusTip(self.trUtf8(
             'Show the undo history of the current file'))
         self.refactoringUndoFileHistoryAct.setWhatsThis(self.trUtf8(
@@ -583,9 +583,9 @@
         
         self.refactoringRedoFileHistoryAct = \
             E5Action(self.trUtf8('Show Current File Redo History'),
-                self.trUtf8('Show Current File Redo History'), 
+                self.trUtf8('Show Current File Redo History'),
                 0, 0,
-                self,'refactoring_show_file_redo_history')
+                self, 'refactoring_show_file_redo_history')
         self.refactoringRedoFileHistoryAct.setStatusTip(self.trUtf8(
             'Show the redo history of the current file'))
         self.refactoringRedoFileHistoryAct.setWhatsThis(self.trUtf8(
@@ -599,9 +599,9 @@
         
         self.refactoringClearHistoryAct = \
             E5Action(self.trUtf8('Clear History'),
-                self.trUtf8('Clear History'), 
+                self.trUtf8('Clear History'),
                 0, 0,
-                self,'refactoring_clear_history')
+                self, 'refactoring_clear_history')
         self.refactoringClearHistoryAct.setStatusTip(self.trUtf8(
             'Clear the refactoring history'))
         self.refactoringClearHistoryAct.setWhatsThis(self.trUtf8(
@@ -619,7 +619,7 @@
         self.queryReferencesAct = E5Action(self.trUtf8('Find occurrences'),
                 self.trUtf8('Find &Occurrences'),
                 0, 0,
-                self,'refactoring_find_occurrences')
+                self, 'refactoring_find_occurrences')
         self.queryReferencesAct.setStatusTip(self.trUtf8(
             'Find occurrences of the highlighted object'))
         self.queryReferencesAct.setWhatsThis(self.trUtf8(
@@ -634,7 +634,7 @@
         self.queryDefinitionAct = E5Action(self.trUtf8('Find definition'),
                 self.trUtf8('Find &Definition'),
                 0, 0,
-                self,'refactoring_find_definition')
+                self, 'refactoring_find_definition')
         self.queryDefinitionAct.setStatusTip(self.trUtf8(
             'Find definition of the highlighted item'))
         self.queryDefinitionAct.setWhatsThis(self.trUtf8(
@@ -650,7 +650,7 @@
                 self.trUtf8('Find implementations'),
                 self.trUtf8('Find &Implementations'),
                 0, 0,
-                self,'refactoring_find_implementations')
+                self, 'refactoring_find_implementations')
         self.queryImplementationsAct.setStatusTip(self.trUtf8(
             'Find places where the selected method is overridden'))
         self.queryImplementationsAct.setWhatsThis(self.trUtf8(
@@ -668,7 +668,7 @@
         self.refactoringEditConfigAct = E5Action(self.trUtf8('Configure Rope'),
                 self.trUtf8('&Configure Rope'),
                 0, 0,
-                self,'refactoring_edit_config')
+                self, 'refactoring_edit_config')
         self.refactoringEditConfigAct.setStatusTip(self.trUtf8(
             'Open the rope configuration file'))
         self.refactoringEditConfigAct.setWhatsThis(self.trUtf8(
@@ -682,7 +682,7 @@
         self.refactoringHelpAct = E5Action(self.trUtf8('Rope help'),
                 self.trUtf8('Rope &Help'),
                 0, 0,
-                self,'refactoring_help')
+                self, 'refactoring_help')
         self.refactoringHelpAct.setStatusTip(self.trUtf8(
             'Show help about the rope refactorings'))
         self.refactoringHelpAct.setWhatsThis(self.trUtf8(
@@ -697,7 +697,7 @@
                 self.trUtf8('Analyse all modules'),
                 self.trUtf8('&Analyse all modules'),
                 0, 0,
-                self,'refactoring_analyze_all')
+                self, 'refactoring_analyze_all')
         self.refactoringAllSoaAct.setStatusTip(self.trUtf8(
             'Perform static object analysis on all modules'))
         self.refactoringAllSoaAct.setWhatsThis(self.trUtf8(
@@ -715,7 +715,7 @@
                 self.trUtf8('Update Configuration'),
                 self.trUtf8('&Update Configuration'),
                 0, 0,
-                self,'refactoring_update_configuration')
+                self, 'refactoring_update_configuration')
         self.updateConfigAct.setStatusTip(self.trUtf8(
             'Generates a new configuration file overwriting the current one.'))
         self.updateConfigAct.setWhatsThis(self.trUtf8(
@@ -795,7 +795,7 @@
         smenu.addSeparator()
         
         hmenu = smenu.addMenu(self.trUtf8("History"))
-        self.connect(hmenu, SIGNAL("aboutToShow()"), 
+        self.connect(hmenu, SIGNAL("aboutToShow()"),
                      self.__showRefactoringHistoryMenu)
         hmenu.addAction(self.refactoringUndoHistoryAct)
         hmenu.addAction(self.refactoringUndoFileHistoryAct)
@@ -934,12 +934,12 @@
         if str(type(err)).split()[-1][1:-2].split('.')[-1] == \
                                                     'ModuleSyntaxError':
             res = QMessageBox.warning(self.__ui, title,
-                self.trUtf8("Rope error: {0}").format(str(err)), 
+                self.trUtf8("Rope error: {0}").format(str(err)),
                 QMessageBox.Ok | QMessageBox.Open)
             if res == QMessageBox.Open:
                 e5App().getObject("ViewManager").openSourceFile(
-                    os.path.join(self.__e4project.getProjectPath(), 
-                                 err.filename), 
+                    os.path.join(self.__e4project.getProjectPath(),
+                                 err.filename),
                     err.lineno)
         else:
             QMessageBox.warning(self.__ui, title,
@@ -969,7 +969,7 @@
         """
         Private slot to handle the Rename Current Module action.
         """
-        self.__doRename(self.trUtf8('Rename Current Module'), 
+        self.__doRename(self.trUtf8('Rename Current Module'),
             renameModule=True)
     
     def __doRename(self, title, isLocal=False, renameModule=False):
@@ -977,7 +977,7 @@
         Private method to perform the various renaming refactorings.
         
         @param title title of the refactoring (string)
-        @param isLocal flag indicating to restrict refactoring to 
+        @param isLocal flag indicating to restrict refactoring to
             the local file (boolean)
         @param renameModule flag indicating a module rename refactoring
             (boolean)
@@ -992,7 +992,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the declaration you want to rename"
                     " and try again."))
-            return 
+            return
         
         if isLocal:
             if not self.confirmBufferIsSaved(aw):
@@ -1011,8 +1011,8 @@
                 QMessageBox.warning(self.__ui, title,
                     self.trUtf8("The selection must not extend beyond"
                                 " one line."))
-                return 
-            index = int(index  + (index1 - index) / 2)
+                return
+            index = int(index + (index1 - index) / 2)
             # keep it inside the object
             offset = aw.positionFromLineIndex(line, index)
         
@@ -1023,7 +1023,7 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
         if isLocal:
             localResource = resource
@@ -1048,7 +1048,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight an occurrence to be changed"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmBufferIsSaved(aw):
             return
@@ -1064,9 +1064,9 @@
                         self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = ChangeOccurrencesDialog(self, title, renamer, 
+        self.dlg = ChangeOccurrencesDialog(self, title, renamer,
                                            parent=self.__ui)
         self.dlg.show()
     
@@ -1104,7 +1104,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the region of code you want to extract"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmBufferIsSaved(aw):
             return
@@ -1127,9 +1127,9 @@
                 raise Exception("Invalid extraction kind <{0}>.".format(kind))
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = ExtractDialog(self, title, extractor, parent = self.__ui)
+        self.dlg = ExtractDialog(self, title, extractor, parent=self.__ui)
         self.dlg.show()
     
     #####################################################
@@ -1151,7 +1151,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the local variable, method or parameter"
                     " you want to inline and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1167,9 +1167,9 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = InlineDialog(self, title, inliner, parent = self.__ui)
+        self.dlg = InlineDialog(self, title, inliner, parent=self.__ui)
         self.dlg.show()
     
     #####################################################
@@ -1191,7 +1191,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the method to move"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1207,7 +1207,7 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
         self.dlg = MoveMethodDialog(self, title, mover, parent=self.__ui)
         self.dlg.show()
@@ -1236,7 +1236,7 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
         self.dlg = MoveModuleDialog(self, title, mover, parent=self.__ui)
         self.dlg.show()
@@ -1259,7 +1259,7 @@
             # no selection available
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight a global function and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1277,7 +1277,7 @@
             self.handleRopeError(err, title)
             return
         
-        self.dlg = UseFunctionDialog(self, title, user, parent = self.__ui)
+        self.dlg = UseFunctionDialog(self, title, user, parent=self.__ui)
         self.dlg.show()
     
     #####################################################
@@ -1299,7 +1299,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the class to introduce a factory"
                     " method for and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1316,9 +1316,9 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = IntroduceFactoryDialog(self, title, introducer, 
+        self.dlg = IntroduceFactoryDialog(self, title, introducer,
                                           parent=self.__ui)
         self.dlg.show()
     
@@ -1337,7 +1337,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the code for the new parameter"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1353,9 +1353,9 @@
             self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = IntroduceParameterDialog(self, title, introducer, 
+        self.dlg = IntroduceParameterDialog(self, title, introducer,
                                             parent=self.__ui)
         self.dlg.show()
     
@@ -1367,35 +1367,35 @@
         """
         Private slot to organize imports.
         """
-        self.__doImports(self.trUtf8("Organize Imports"), 
+        self.__doImports(self.trUtf8("Organize Imports"),
             ImportOrganizer.organize_imports)
     
     def __importsExpandStar(self):
         """
         Private slot to expand star imports.
         """
-        self.__doImports(self.trUtf8("Expand Star Imports"), 
+        self.__doImports(self.trUtf8("Expand Star Imports"),
             ImportOrganizer.expand_star_imports)
     
     def __importsRelativeToAbsolute(self):
         """
         Private slot to transform relative to absolute imports.
         """
-        self.__doImports(self.trUtf8("Relative to Absolute"), 
+        self.__doImports(self.trUtf8("Relative to Absolute"),
             ImportOrganizer.relatives_to_absolutes)
     
     def __importsFromToImport(self):
         """
         Private slot to transform from imports to plain imports.
         """
-        self.__doImports(self.trUtf8("Froms to Imports"), 
+        self.__doImports(self.trUtf8("Froms to Imports"),
             ImportOrganizer.froms_to_imports)
     
     def __importsHandleLong(self):
         """
         Private slot to handle long imports.
         """
-        self.__doImports(self.trUtf8("Handle Long Imports"), 
+        self.__doImports(self.trUtf8("Handle Long Imports"),
             ImportOrganizer.handle_long_imports)
     
     def __doImports(self, title, method):
@@ -1463,7 +1463,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the method or function to change"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1479,9 +1479,9 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = ChangeSignatureDialog(self, title, changer, 
+        self.dlg = ChangeSignatureDialog(self, title, changer,
                                          parent=self.__ui)
         self.dlg.show()
     
@@ -1501,7 +1501,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the method or function to inline"
                     " a parameter's default and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1517,9 +1517,9 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
-        self.dlg = InlineArgumentDefaultDialog(self, title, changer, 
+        self.dlg = InlineArgumentDefaultDialog(self, title, changer,
                                                parent=self.__ui)
         self.dlg.show()
     
@@ -1549,7 +1549,7 @@
                 self.__e5project.saveProject()
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
     
     def __encapsulateAttribute(self):
         """
@@ -1566,7 +1566,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the attribute to encapsulate"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1620,7 +1620,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the local variable to make an attribute"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1658,7 +1658,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the method or function to convert"
                     " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1674,7 +1674,7 @@
                 self.__project, resource, offset)
         except Exception as err:
             self.handleRopeError(err, title)
-            return 
+            return
         
         self.dlg = MethodToMethodObjectDialog(self, title, converter,
                                               parent=self.__ui)
@@ -1766,7 +1766,7 @@
     
     def __showFileUndoHistory(self):
         """
-        Private method to show list of changes related to the current file 
+        Private method to show list of changes related to the current file
         available for an undo operation.
         """
         aw = e5App().getObject("ViewManager").activeWindow()
@@ -1783,7 +1783,7 @@
     
     def __showFileRedoHistory(self):
         """
-        Private method to show list of changes related to the current file 
+        Private method to show list of changes related to the current file
         available for a redo operation.
         """
         aw = e5App().getObject("ViewManager").activeWindow()
@@ -1832,7 +1832,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the class, method, function or variable"
                     " to search for and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1849,7 +1849,7 @@
         try:
             occurrences = rope.contrib.findit.find_occurrences(
                 self.__project, resource, offset,
-                unsure = True, in_hierarchy = True, task_handle = handle)
+                unsure=True, in_hierarchy=True, task_handle=handle)
         except Exception as err:
             self.handleRopeError(err, title, handle)
             return
@@ -1859,7 +1859,7 @@
             self.dlg = MatchesDialog(self.__ui, True)
             self.dlg.show()
             for occurrence in occurrences:
-                self.dlg.addEntry(occurrence.resource, 
+                self.dlg.addEntry(occurrence.resource,
                     occurrence.lineno, occurrence.unsure)
         else:
             QMessageBox.warning(self.__ui, title,
@@ -1881,7 +1881,7 @@
                 self.trUtf8("Highlight the class, method, function or"
                     " variable reference to search definition for and"
                     " try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1922,7 +1922,7 @@
             QMessageBox.warning(self.__ui, title,
                 self.trUtf8("Highlight the method to search for"
                             " and try again."))
-            return 
+            return
         
         if not self.confirmAllBuffersSaved():
             return
@@ -1931,14 +1931,14 @@
         line, index, line1, index1 = aw.getSelection()
         offset = aw.positionFromLineIndex(line, index)
         
-        resource = rope.base.libutils.path_to_resource(self.__project, 
+        resource = rope.base.libutils.path_to_resource(self.__project,
             filename)
         handle = ProgressHandle(title, True, self.__ui)
         handle.show()
         QApplication.processEvents()
         try:
             occurrences = rope.contrib.findit.find_implementations(
-                self.__project, resource, offset, task_handle = handle)
+                self.__project, resource, offset, task_handle=handle)
         except Exception as err:
             self.handleRopeError(err, title, handle)
             return
@@ -1948,7 +1948,7 @@
             self.dlg = MatchesDialog(self.__ui, True)
             self.dlg.show()
             for occurrence in occurrences:
-                self.dlg.addEntry(occurrence.resource, 
+                self.dlg.addEntry(occurrence.resource,
                     occurrence.lineno, occurrence.unsure)
         else:
             QMessageBox.warning(self.__ui, title,
@@ -1972,7 +1972,7 @@
                 if self.__newStyle:
                     self.__editor.editorSaved.connect(self.__configChanged)
                 else:
-                    self.connect(self.__editor, SIGNAL("editorSaved"), 
+                    self.connect(self.__editor, SIGNAL("editorSaved"),
                         self.__configChanged)
             else:
                 QMessageBox.critical(self.__ui,
@@ -2018,10 +2018,10 @@
         Private slot to show help about the refactorings offered by Rope.
         """
         if self.__helpDialog is None:
-            helpfile = os.path.join(os.path.dirname(__file__), 
+            helpfile = os.path.join(os.path.dirname(__file__),
                                     "rope", "docs", "overview.txt")
             self.__helpDialog = \
-                HelpDialog(self.trUtf8("Help about rope refactorings"), 
+                HelpDialog(self.trUtf8("Help about rope refactorings"),
                            helpfile)
         self.__helpDialog.show()
     
@@ -2043,7 +2043,7 @@
             handle.show()
             QApplication.processEvents()
             try:
-                rope.base.libutils.analyze_modules(self.__project, 
+                rope.base.libutils.analyze_modules(self.__project,
                     task_handle=handle)
                 handle.reset()
                 QMessageBox.information(self.__ui,
@@ -2077,8 +2077,8 @@
         Private slot called, when the rope config file has changed.
         """
         self.__project.close()
-        self.__project = rope.base.project.Project(self.__projectpath, 
-            fscommands = self.__fsCommands)
+        self.__project = rope.base.project.Project(self.__projectpath,
+            fscommands=self.__fsCommands)
     
     def __defaultConfig(self):
         """
@@ -2116,8 +2116,8 @@
         self.__projectLanguage = self.__e5project.getProjectLanguage()
         
         if self.__projectLanguage in ["Python3"]:
-            self.__project = rope.base.project.Project(self.__projectpath, 
-                fscommands = self.__fsCommands)
+            self.__project = rope.base.project.Project(self.__projectpath,
+                fscommands=self.__fsCommands)
             for act in self.actions:
                 act.setEnabled(True)
     
@@ -2149,7 +2149,7 @@
         Public method to check, if an editor has unsaved changes.
         
         @param editor reference to the editor to be checked
-        @return flag indicating, that the editor doesn't contain 
+        @return flag indicating, that the editor doesn't contain
             unsaved edits (boolean)
         """
         res = editor.checkDirty()
@@ -2160,7 +2160,7 @@
         """
         Private method to check, if any editor has unsaved changes.
         
-        @return flag indicating, that no editor contains unsaved edits 
+        @return flag indicating, that no editor contains unsaved edits
             (boolean)
         """
         res = e5App().getObject("ViewManager").checkAllDirty()
@@ -2193,4 +2193,3 @@
             filename = aw.getFileName()
             if filename is not None:
                 vm.openSourceFile(filename, aw.getCursorPosition()[0] + 1)
-

eric ide

mercurial