RefactoringRope/RefactoringServer.py

branch
eric7
changeset 365
f740b50380df
parent 360
2b35968f3d02
child 374
958f34e97952
diff -r a92b3272f4c1 -r f740b50380df RefactoringRope/RefactoringServer.py
--- a/RefactoringRope/RefactoringServer.py	Wed May 26 17:53:08 2021 +0200
+++ b/RefactoringRope/RefactoringServer.py	Wed May 26 19:07:42 2021 +0200
@@ -10,19 +10,17 @@
 import os
 import contextlib
 
-from PyQt5.QtCore import pyqtSlot
-from PyQt5.QtWidgets import QMenu, QApplication, QAction
-from PyQt5.Qsci import QsciScintilla
+from PyQt6.QtCore import pyqtSlot
+from PyQt6.QtGui import QAction
+from PyQt6.QtWidgets import QMenu, QApplication
+from PyQt6.Qsci import QsciScintilla
 
-from E5Gui.E5Application import e5App
-from E5Gui import E5MessageBox
-from E5Gui.E5Action import E5Action
+from EricWidgets.EricApplication import ericApp
+from EricWidgets import EricMessageBox
+from EricGui.EricAction import EricAction
 
-try:
-    from E5Network.E5JsonServer import E5JsonServer
-except ImportError:
-    # TODO: delete JsonServer once ported to eric7
-    from .JsonServer import JsonServer as E5JsonServer
+from EricNetwork.EricJsonServer import EricJsonServer
+
 from .RopeProgressDialog import RopeProgressDialog
 
 import Utilities
@@ -32,7 +30,7 @@
 from Preferences.Shortcuts import readShortcuts
 
 
-class RefactoringServer(E5JsonServer):
+class RefactoringServer(EricJsonServer):
     """
     Class implementing the refactoring interface to rope.
     """
@@ -50,8 +48,8 @@
         
         self.__plugin = plugin
         self.__ui = parent
-        self.__vm = e5App().getObject("ViewManager")
-        self.__e5project = e5App().getObject("Project")
+        self.__vm = ericApp().getObject("ViewManager")
+        self.__ericProject = ericApp().getObject("Project")
         self.__projectpath = ''
         self.__projectLanguage = ""
         self.__projectopen = False
@@ -66,8 +64,8 @@
         self.__historyDialog = None
         self.__refactoringDialogs = {}
         
-        from .FileSystemCommands import E5FileSystemCommands
-        self.__fsCommands = E5FileSystemCommands(self.__e5project)
+        from .FileSystemCommands import EricFileSystemCommands
+        self.__fsCommands = EricFileSystemCommands(self.__ericProject)
         
         self.__methodMapping = {
             "Config": self.__setConfig,
@@ -102,7 +100,7 @@
         This is performed when the rope plug-in is activated.
         """
         self.__initActions()
-        e5App().registerPluginObject("RefactoringRope", self)
+        ericApp().registerPluginObject("RefactoringRope", self)
         readShortcuts(pluginName="RefactoringRope")
         
         self.__mainMenu = self.__initMenu()
@@ -121,31 +119,31 @@
                 insertBeforeAct, self.__mainMenu)
         self.__mainAct.setEnabled(False)
         
-        if e5App().getObject("Project").isOpen():
+        if ericApp().getObject("Project").isOpen():
             self.projectOpened()
         
-        e5App().getObject("Project").projectOpened.connect(
+        ericApp().getObject("Project").projectOpened.connect(
             self.projectOpened)
-        e5App().getObject("Project").projectPropertiesChanged.connect(
+        ericApp().getObject("Project").projectPropertiesChanged.connect(
             self.projectOpened)
-        e5App().getObject("Project").projectClosed.connect(
+        ericApp().getObject("Project").projectClosed.connect(
             self.projectClosed)
-        e5App().getObject("Project").newProject.connect(
+        ericApp().getObject("Project").newProject.connect(
             self.projectOpened)
     
     def deactivate(self):
         """
         Public method to deactivate the refactoring server.
         """
-        e5App().unregisterPluginObject("RefactoringRope")
+        ericApp().unregisterPluginObject("RefactoringRope")
         
-        e5App().getObject("Project").projectOpened.disconnect(
+        ericApp().getObject("Project").projectOpened.disconnect(
             self.projectOpened)
-        e5App().getObject("Project").projectPropertiesChanged.disconnect(
+        ericApp().getObject("Project").projectPropertiesChanged.disconnect(
             self.projectOpened)
-        e5App().getObject("Project").projectClosed.disconnect(
+        ericApp().getObject("Project").projectClosed.disconnect(
             self.projectClosed)
-        e5App().getObject("Project").newProject.disconnect(
+        ericApp().getObject("Project").newProject.disconnect(
             self.projectOpened)
         
         projectToolsMenu = self.__ui.getMenu("project_tools")
@@ -176,7 +174,7 @@
         ## Rename refactoring actions
         #####################################################
         
-        self.refactoringRenameAct = E5Action(
+        self.refactoringRenameAct = EricAction(
             self.tr('Rename'),
             self.tr('&Rename'),
             0, 0,
@@ -191,7 +189,7 @@
             self.__rename)
         self.actions.append(self.refactoringRenameAct)
         
-        self.refactoringRenameLocalAct = E5Action(
+        self.refactoringRenameLocalAct = EricAction(
             self.tr('Local Rename'),
             self.tr('&Local Rename'),
             0, 0,
@@ -207,7 +205,7 @@
             self.__renameLocal)
         self.actions.append(self.refactoringRenameLocalAct)
         
-        self.refactoringRenameModuleAct = E5Action(
+        self.refactoringRenameModuleAct = EricAction(
             self.tr('Rename Current Module'),
             self.tr('Rename Current Module'),
             0, 0,
@@ -222,7 +220,7 @@
             self.__renameModule)
         self.actions.append(self.refactoringRenameModuleAct)
         
-        self.refactoringChangeOccurrencesAct = E5Action(
+        self.refactoringChangeOccurrencesAct = EricAction(
             self.tr('Change Occurrences'),
             self.tr('Change &Occurrences'),
             0, 0,
@@ -241,7 +239,7 @@
         ## Extract refactoring actions
         #####################################################
         
-        self.refactoringExtractMethodAct = E5Action(
+        self.refactoringExtractMethodAct = EricAction(
             self.tr('Extract method'),
             self.tr('Extract &Method'),
             0, 0,
@@ -256,7 +254,7 @@
             self.__extractMethod)
         self.actions.append(self.refactoringExtractMethodAct)
         
-        self.refactoringExtractLocalVariableAct = E5Action(
+        self.refactoringExtractLocalVariableAct = EricAction(
             self.tr('Extract local variable'),
             self.tr('&Extract Local Variable'),
             0, 0,
@@ -275,7 +273,7 @@
         ## Inline refactoring actions
         #####################################################
         
-        self.refactoringInlineAct = E5Action(
+        self.refactoringInlineAct = EricAction(
             self.tr('Inline'),
             self.tr('&Inline'),
             0, 0,
@@ -294,7 +292,7 @@
         ## Move refactoring actions
         #####################################################
         
-        self.refactoringMoveMethodAct = E5Action(
+        self.refactoringMoveMethodAct = EricAction(
             self.tr('Move method'),
             self.tr('Mo&ve Method'),
             0, 0,
@@ -309,7 +307,7 @@
             lambda: self.__move("move_method"))
         self.actions.append(self.refactoringMoveMethodAct)
         
-        self.refactoringMoveModuleAct = E5Action(
+        self.refactoringMoveModuleAct = EricAction(
             self.tr('Move current module'),
             self.tr('Move Current Module'),
             0, 0,
@@ -328,7 +326,7 @@
         ## Use function refactoring action
         #####################################################
         
-        self.refactoringUseFunctionAct = E5Action(
+        self.refactoringUseFunctionAct = EricAction(
             self.tr('Use Function'),
             self.tr('Use Function'),
             0, 0,
@@ -347,7 +345,7 @@
         ## Introduce refactorings actions
         #####################################################
         
-        self.refactoringIntroduceFactoryAct = E5Action(
+        self.refactoringIntroduceFactoryAct = EricAction(
             self.tr('Introduce Factory Method'),
             self.tr('Introduce &Factory Method'),
             0, 0,
@@ -362,7 +360,7 @@
             self.__introduceFactoryMethod)
         self.actions.append(self.refactoringIntroduceFactoryAct)
         
-        self.refactoringIntroduceParameterAct = E5Action(
+        self.refactoringIntroduceParameterAct = EricAction(
             self.tr('Introduce Parameter'),
             self.tr('Introduce &Parameter'),
             0, 0,
@@ -381,7 +379,7 @@
         ## Import refactorings actions
         #####################################################
         
-        self.refactoringImportsOrganizeAct = E5Action(
+        self.refactoringImportsOrganizeAct = EricAction(
             self.tr('Organize Imports'),
             self.tr('&Organize Imports'),
             0, 0,
@@ -396,7 +394,7 @@
             self.__importsOrganize)
         self.actions.append(self.refactoringImportsOrganizeAct)
         
-        self.refactoringImportsStarExpandAct = E5Action(
+        self.refactoringImportsStarExpandAct = EricAction(
             self.tr('Expand Star Imports'),
             self.tr('E&xpand Star Imports'),
             0, 0,
@@ -413,7 +411,7 @@
             self.__importsExpandStar)
         self.actions.append(self.refactoringImportsStarExpandAct)
         
-        self.refactoringImportsRelativeToAbsoluteAct = E5Action(
+        self.refactoringImportsRelativeToAbsoluteAct = EricAction(
             self.tr('Relative to Absolute'),
             self.tr('Relative to &Absolute'),
             0, 0,
@@ -430,7 +428,7 @@
             self.__importsRelativeToAbsolute)
         self.actions.append(self.refactoringImportsRelativeToAbsoluteAct)
         
-        self.refactoringImportsFromsToImportsAct = E5Action(
+        self.refactoringImportsFromsToImportsAct = EricAction(
             self.tr('Froms to Imports'),
             self.tr('Froms to &Imports'),
             0, 0,
@@ -447,7 +445,7 @@
             self.__importsFromToImport)
         self.actions.append(self.refactoringImportsFromsToImportsAct)
         
-        self.refactoringImportsHandleLongAct = E5Action(
+        self.refactoringImportsHandleLongAct = EricAction(
             self.tr('Handle Long Imports'),
             self.tr('Handle &Long Imports'),
             0, 0,
@@ -468,7 +466,7 @@
         ## Various refactorings actions
         #####################################################
         
-        self.refactoringRestructureAct = E5Action(
+        self.refactoringRestructureAct = EricAction(
             self.tr('Restructure'),
             self.tr('Res&tructure'),
             0, 0,
@@ -483,7 +481,7 @@
             self.__restructure)
         self.actions.append(self.refactoringRestructureAct)
         
-        self.refactoringChangeSignatureAct = E5Action(
+        self.refactoringChangeSignatureAct = EricAction(
             self.tr('Change Method Signature'),
             self.tr('&Change Method Signature'),
             0, 0,
@@ -499,7 +497,7 @@
             self.__changeSignature)
         self.actions.append(self.refactoringChangeSignatureAct)
         
-        self.refactoringInlineArgumentDefaultAct = E5Action(
+        self.refactoringInlineArgumentDefaultAct = EricAction(
             self.tr('Inline Argument Default'),
             self.tr('Inline &Argument Default'),
             0, 0,
@@ -514,7 +512,7 @@
             self.__inlineArgumentDefault)
         self.actions.append(self.refactoringInlineArgumentDefaultAct)
         
-        self.refactoringTransformModuleAct = E5Action(
+        self.refactoringTransformModuleAct = EricAction(
             self.tr('Transform Module to Package'),
             self.tr('Transform Module to Package'),
             0, 0,
@@ -529,7 +527,7 @@
             self.__transformModuleToPackage)
         self.actions.append(self.refactoringTransformModuleAct)
         
-        self.refactoringEncapsulateAttributeAct = E5Action(
+        self.refactoringEncapsulateAttributeAct = EricAction(
             self.tr('Encapsulate Attribute'),
             self.tr('Encap&sulate Attribute'),
             0, 0,
@@ -545,7 +543,7 @@
             self.__encapsulateAttribute)
         self.actions.append(self.refactoringEncapsulateAttributeAct)
         
-        self.refactoringLocalVariableToAttributeAct = E5Action(
+        self.refactoringLocalVariableToAttributeAct = EricAction(
             self.tr('Local Variable to Attribute'),
             self.tr('Local Varia&ble to Attribute'),
             0, 0,
@@ -560,7 +558,7 @@
             self.__convertLocalToAttribute)
         self.actions.append(self.refactoringLocalVariableToAttributeAct)
         
-        self.refactoringMethodToMethodObjectAct = E5Action(
+        self.refactoringMethodToMethodObjectAct = EricAction(
             self.tr('Method To Method Object'),
             self.tr('Method To Method Ob&ject'),
             0, 0,
@@ -579,7 +577,7 @@
         ## History actions
         #####################################################
         
-        self.refactoringProjectHistoryAct = E5Action(
+        self.refactoringProjectHistoryAct = EricAction(
             self.tr('Show Project History'),
             self.tr('Show Project History...'),
             0, 0,
@@ -595,7 +593,7 @@
             self.__showProjectHistory)
         self.actions.append(self.refactoringProjectHistoryAct)
         
-        self.refactoringFileHistoryAct = E5Action(
+        self.refactoringFileHistoryAct = EricAction(
             self.tr('Show Current File History'),
             self.tr('Show Current File History...'),
             0, 0,
@@ -611,7 +609,7 @@
             self.__showFileHistory)
         self.actions.append(self.refactoringFileHistoryAct)
         
-        self.refactoringClearHistoryAct = E5Action(
+        self.refactoringClearHistoryAct = EricAction(
             self.tr('Clear History'),
             self.tr('Clear History'),
             0, 0,
@@ -630,7 +628,7 @@
         ## Query actions
         #####################################################
         
-        self.queryReferencesAct = E5Action(
+        self.queryReferencesAct = EricAction(
             self.tr('Find occurrences'),
             self.tr('Find &Occurrences'),
             0, 0,
@@ -646,7 +644,7 @@
             self.__queryReferences)
         self.actions.append(self.queryReferencesAct)
         
-        self.queryDefinitionAct = E5Action(
+        self.queryDefinitionAct = EricAction(
             self.tr('Find definition'),
             self.tr('Find &Definition'),
             0, 0,
@@ -662,7 +660,7 @@
             self.__queryDefinition)
         self.actions.append(self.queryDefinitionAct)
         
-        self.queryImplementationsAct = E5Action(
+        self.queryImplementationsAct = EricAction(
             self.tr('Find implementations'),
             self.tr('Find &Implementations'),
             0, 0,
@@ -681,7 +679,7 @@
         ## Various actions
         #####################################################
         
-        self.refactoringEditConfigAct = E5Action(
+        self.refactoringEditConfigAct = EricAction(
             self.tr('Configure Rope'),
             self.tr('&Configure Rope'),
             0, 0,
@@ -694,10 +692,10 @@
         ))
         self.refactoringEditConfigAct.triggered.connect(
             self.__editConfig)
-        self.refactoringEditConfigAct.setMenuRole(QAction.NoRole)
+        self.refactoringEditConfigAct.setMenuRole(QAction.MenuRole.NoRole)
         self.actions.append(self.refactoringEditConfigAct)
         
-        self.refactoringHelpAct = E5Action(
+        self.refactoringHelpAct = EricAction(
             self.tr('Rope Help'),
             self.tr('Rope &Help'),
             0, 0,
@@ -712,7 +710,7 @@
             self.__showRopeHelp)
         self.actions.append(self.refactoringHelpAct)
         
-        self.refactoringAllSoaAct = E5Action(
+        self.refactoringAllSoaAct = EricAction(
             self.tr('Analyse all modules'),
             self.tr('&Analyse all modules'),
             0, 0,
@@ -730,7 +728,7 @@
             self.__performSOA)
         self.actions.append(self.refactoringAllSoaAct)
         
-        self.updateConfigAct = E5Action(
+        self.updateConfigAct = EricAction(
             self.tr('Update Configuration'),
             self.tr('&Update Configuration'),
             0, 0,
@@ -837,7 +835,7 @@
         Private slot to show some info about rope.
         """
         if self.__ropeConfig:
-            E5MessageBox.about(
+            EricMessageBox.about(
                 self.__ui,
                 self.tr("About rope"),
                 self.tr("{0}\nVersion {1}\n\n{2}".format(
@@ -869,14 +867,14 @@
         title = result.get("Title", self.tr("Rope Error"))
         
         if result["Error"] == 'ModuleSyntaxError':
-            res = E5MessageBox.warning(
+            res = EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Rope error: {0}").format(
                     result["ErrorString"]),
-                E5MessageBox.Ok | E5MessageBox.Open)
-            if res == E5MessageBox.Open:
+                EricMessageBox.Ok | EricMessageBox.Open)
+            if res == EricMessageBox.Open:
                 self.__vm.openSourceFile(
-                    os.path.join(self.__e5project.getProjectPath(),
+                    os.path.join(self.__ericProject.getProjectPath(),
                                  result["ErrorFile"]),
                     result["ErrorLine"])
         elif result["Error"] == "InterruptedTaskError":
@@ -900,7 +898,7 @@
         Note: rope seems to convert all EOL styles to just \n.
         
         @param editor reference to the editor
-        @type QScintilla.Editor.Editor
+        @type Editor
         @param line line for the offset
         @type int
         @param index index into line for the offset
@@ -910,7 +908,7 @@
         """
         source = editor.text()
         offset = len("".join(source.splitlines(True)[:line])) + index
-        if editor.eolMode() == QsciScintilla.EolWindows:
+        if editor.eolMode() == QsciScintilla.EolMode.EolWindows:
             offset -= line
         return offset
 
@@ -985,7 +983,7 @@
         
         if not renameModule and not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the declaration you want to rename"
                         " and try again."))
@@ -1008,7 +1006,7 @@
             line, index, line1, index1 = aw.getSelection()
             if line != line1:
                 # selection span more than one line
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui, title,
                     self.tr("The selection must not extend beyond"
                             " one line."))
@@ -1039,7 +1037,7 @@
         title = self.tr("Change Occurrences")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight an occurrence to be changed"
                         " and try again."))
@@ -1093,7 +1091,7 @@
         
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the region of code you want to extract"
                         " and try again."))
@@ -1132,7 +1130,7 @@
         title = self.tr("Inline")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the local variable, method or parameter"
                         " you want to inline and try again."))
@@ -1173,7 +1171,7 @@
             title = self.tr("Move Method")
             if not aw.hasSelectedText():
                 # no selection available
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui, title,
                     self.tr("Highlight the method to move"
                             " and try again."))
@@ -1215,7 +1213,7 @@
         title = self.tr("Use Function")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight a global function and try again."))
             return
@@ -1252,7 +1250,7 @@
         title = self.tr("Introduce Factory Method")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the class to introduce a factory"
                         " method for and try again."))
@@ -1286,7 +1284,7 @@
         title = self.tr("Introduce Parameter")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the code for the new parameter"
                         " and try again."))
@@ -1419,7 +1417,7 @@
         title = self.tr("Change Method Signature")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the method or function to change"
                         " and try again."))
@@ -1454,7 +1452,7 @@
         title = self.tr("Inline Argument Default")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the method or function to inline"
                         " a parameter's default and try again."))
@@ -1517,7 +1515,7 @@
         title = self.tr("Encapsulate Attribute")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the attribute to encapsulate"
                         " and try again."))
@@ -1551,7 +1549,7 @@
         title = self.tr("Local Variable to Attribute")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the local variable to make an attribute"
                         " and try again."))
@@ -1590,7 +1588,7 @@
         title = self.tr("Replace Method With Method Object")
         if not aw.hasSelectedText():
             # no selection available
-            E5MessageBox.warning(
+            EricMessageBox.warning(
                 self.__ui, title,
                 self.tr("Highlight the method or function to convert"
                         " and try again."))
@@ -1651,7 +1649,7 @@
         """
         Private slot to clear the redo and undo lists.
         """
-        res = E5MessageBox.yesNo(
+        res = EricMessageBox.yesNo(
             None,
             self.tr("Clear History"),
             self.tr("Do you really want to clear the refactoring history?"))
@@ -1727,7 +1725,7 @@
                         # file name, lineno, unsure
                         occurrence[0], occurrence[1], occurrence[2])
             else:
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui, title,
                     self.tr("No occurrences found."))
     
@@ -1775,7 +1773,7 @@
                 self.dlg.addEntry(location[0], location[1])
                 # file name, lineno
             else:
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui, title,
                     self.tr("No matching definition found."))
     
@@ -1822,7 +1820,7 @@
                         # file name, lineno, unsure
                         occurrence[0], occurrence[1], occurrence[2])
             else:
-                E5MessageBox.warning(
+                EricMessageBox.warning(
                     self.__ui, title, self.tr("No implementations found."))
     
     #####################################################
@@ -1843,13 +1841,13 @@
                 self.__editor.show()
                 self.__editor.editorSaved.connect(self.__configChanged)
             else:
-                E5MessageBox.critical(
+                EricMessageBox.critical(
                     self.__ui,
                     self.tr("Configure Rope"),
                     self.tr("""The Rope configuration file '{0}' does"""
                             """ not exist.""").format(configfile))
         else:
-            E5MessageBox.critical(
+            EricMessageBox.critical(
                 self.__ui,
                 self.tr("Configure Rope"),
                 self.tr("""The Rope admin directory does not exist."""))
@@ -1858,7 +1856,7 @@
         """
         Private slot to update the configuration file.
         """
-        res = E5MessageBox.yesNo(
+        res = EricMessageBox.yesNo(
             self.__ui,
             self.tr("Update Configuration"),
             self.tr("""Shall rope's current configuration be replaced """
@@ -1873,7 +1871,7 @@
                     self.__configChanged()
                     self.__editConfig()
                 except OSError as err:
-                    E5MessageBox.critical(
+                    EricMessageBox.critical(
                         None,
                         self.tr("Update Configuration"),
                         self.tr("""<p>The configuration could not be"""
@@ -1897,7 +1895,7 @@
         Private slot to perform SOA on all modules.
         """
         title = self.tr("Analyse all modules")
-        res = E5MessageBox.yesNo(
+        res = EricMessageBox.yesNo(
             self.__ui,
             title,
             self.tr("""This action might take some time. """
@@ -1919,7 +1917,7 @@
         if self.handleRopeError(result):
             title = result["Title"]
             
-            E5MessageBox.information(
+            EricMessageBox.information(
                 self.__ui,
                 title,
                 self.tr("""Static object analysis (SOA) done. """
@@ -2010,7 +2008,7 @@
         Public method to get a list of all actions.
         
         @return list of all actions
-        @rtype list of E5Action
+        @rtype list of EricAction
         """
         return self.actions[:]
     
@@ -2022,21 +2020,20 @@
             self.projectClosed()
         
         self.__projectopen = True
-        self.__projectpath = self.__e5project.getProjectPath()
-        self.__projectLanguage = self.__e5project.getProjectLanguage()
+        self.__projectpath = self.__ericProject.getProjectPath()
+        self.__projectLanguage = self.__ericProject.getProjectLanguage()
         
         ok = False
         
-        if (self.__projectLanguage.startswith("Python") or
-                self.__projectLanguage == "MicroPython"):
+        if self.__projectLanguage in ("Python3", "MicroPython", "Cython"):
             clientEnv = os.environ.copy()
             if "PATH" in clientEnv:
                 clientEnv["PATH"] = self.__ui.getOriginalPathString()
             
-            venvManager = e5App().getObject("VirtualEnvManager")
+            venvManager = ericApp().getObject("VirtualEnvManager")
             
             # get virtual environment from project first
-            venvName = self.__e5project.getDebugProperty("VIRTUALENV")
+            venvName = self.__ericProject.getDebugProperty("VIRTUALENV")
             if venvName:
                 try:
                     isRemote = venvManager.isRemoteEnvironment(venvName)
@@ -2046,7 +2043,9 @@
                 isRemote = False
             if (not venvName) or isRemote:
                 # get it from debugger settings next
-                if self.__projectLanguage in ("Python3", "MicroPython"):
+                if self.__projectLanguage in (
+                    "Python3", "MicroPython", "Cython"
+                ):
                     venvName = Preferences.getDebugger("Python3VirtualEnv")
                     if not venvName:
                         venvName, _ = venvManager.getDefaultEnvironment()
@@ -2127,7 +2126,7 @@
         Public method to check, if an editor has unsaved changes.
         
         @param editor reference to the editor to be checked
-        @type QScintilla.Editor.Editor
+        @type Editor
         @return flag indicating, that the editor doesn't contain
             unsaved edits
         @rtype bool
@@ -2180,8 +2179,8 @@
         @type str
         """
         if (
-            self.__e5project.isOpen() and
-            self.__e5project.isProjectFile(filename)
+            self.__ericProject.isOpen() and
+            self.__ericProject.isProjectFile(filename)
         ):
             editor = self.__vm.getOpenEditor(filename)
             if (
@@ -2217,7 +2216,7 @@
         @type dict
         """
         if params["ExceptionType"] == "ProtocolError":
-            E5MessageBox.critical(
+            EricMessageBox.critical(
                 None,
                 self.tr("Refactoring Protocol Error"),
                 self.tr("""<p>The data received from the refactoring"""
@@ -2228,10 +2227,10 @@
                         """<p>Data:<br/>{1}</p>""").format(
                     params["ExceptionValue"],
                     Utilities.html_encode(params["ProtocolData"])),
-                E5MessageBox.StandardButtons(
-                    E5MessageBox.Ok))
+                EricMessageBox.StandardButtons(
+                    EricMessageBox.Ok))
         else:
-            E5MessageBox.critical(
+            EricMessageBox.critical(
                 None,
                 self.tr("Refactoring Client Error"),
                 self.tr("<p>An exception happened in the refactoring"
@@ -2245,8 +2244,8 @@
                     params["Traceback"].replace("\r\n", "<br/>")
                     .replace("\n", "<br/>").replace("\r", "<br/>"),
                 ),
-                E5MessageBox.StandardButtons(
-                    E5MessageBox.Ok))
+                EricMessageBox.StandardButtons(
+                    EricMessageBox.Ok))
     
     def __startRefactoringClient(self, interpreter, clientEnv):
         """
@@ -2265,7 +2264,7 @@
                                   "RefactoringClient.py")
             ok, exitCode = self.startClient(
                 interpreter, client,
-                [self.__projectpath, Globals.getPythonModulesDirectory()],
+                [self.__projectpath, Globals.getPythonLibraryDirectory()],
                 environment=clientEnv)
             if not ok and exitCode == 42:
                 self.__ui.appendToStderr("RefactoringServer: " + self.tr(

eric ide

mercurial