924 @param result dictionary containing the changes data |
921 @param result dictionary containing the changes data |
925 @type dict |
922 @type dict |
926 """ |
923 """ |
927 if self.handleRopeError(result): |
924 if self.handleRopeError(result): |
928 changeGroup = result["ChangeGroup"] |
925 changeGroup = result["ChangeGroup"] |
929 try: |
926 with contextlib.suppress(KeyError): |
930 self.__refactoringDialogs[changeGroup].processChangeData( |
927 self.__refactoringDialogs[changeGroup].processChangeData( |
931 result) |
928 result) |
932 except KeyError: |
|
933 # ignore data for non-existing dialogs |
|
934 pass |
|
935 |
929 |
936 def __refactoringDialogClosed(self, changeGroup): |
930 def __refactoringDialogClosed(self, changeGroup): |
937 """ |
931 """ |
938 Private slot handling the closing of a refactoring dialog. |
932 Private slot handling the closing of a refactoring dialog. |
939 |
933 |
940 @param changeGroup name of the refactoring change group the dialog |
934 @param changeGroup name of the refactoring change group the dialog |
941 belonged to |
935 belonged to |
942 @type str |
936 @type str |
943 """ |
937 """ |
944 try: |
938 with contextlib.suppress(KeyError): |
945 del self.__refactoringDialogs[changeGroup] |
939 del self.__refactoringDialogs[changeGroup] |
946 except KeyError: |
|
947 # it's gone already; ignore it |
|
948 pass |
|
949 |
940 |
950 ##################################################### |
941 ##################################################### |
951 ## Rename refactorings |
942 ## Rename refactorings |
952 ##################################################### |
943 ##################################################### |
953 |
944 |
1950 progressDialog.show() |
1941 progressDialog.show() |
1951 progressDialog.raise_() |
1942 progressDialog.raise_() |
1952 self.__progressDialog = progressDialog |
1943 self.__progressDialog = progressDialog |
1953 QApplication.processEvents() |
1944 QApplication.processEvents() |
1954 |
1945 |
1955 elif subcommand == "Progress": |
1946 elif subcommand == "Progress" and self.__progressDialog is not None: |
1956 if self.__progressDialog is not None: |
1947 self.__progressDialog.updateProgress(params) |
1957 self.__progressDialog.updateProgress(params) |
1948 self.__progressDialog.raise_() |
1958 self.__progressDialog.raise_() |
|
1959 |
1949 |
1960 elif subcommand == "Reset": |
1950 elif subcommand == "Reset" and self.__progressDialog is not None: |
1961 if self.__progressDialog is not None: |
1951 self.__progressDialog.reset() |
1962 self.__progressDialog.reset() |
|
1963 |
1952 |
1964 def __setConfig(self, params): |
1953 def __setConfig(self, params): |
1965 """ |
1954 """ |
1966 Private method to set the rope client configuration data. |
1955 Private method to set the rope client configuration data. |
1967 |
1956 |
2035 |
2024 |
2036 if (self.__projectLanguage.startswith("Python") or |
2025 if (self.__projectLanguage.startswith("Python") or |
2037 self.__projectLanguage == "MicroPython"): |
2026 self.__projectLanguage == "MicroPython"): |
2038 clientEnv = os.environ.copy() |
2027 clientEnv = os.environ.copy() |
2039 if "PATH" in clientEnv: |
2028 if "PATH" in clientEnv: |
|
2029 clientEnv["PATH"] = self.__ui.getOriginalPathString() |
|
2030 |
|
2031 venvManager = e5App().getObject("VirtualEnvManager") |
|
2032 |
|
2033 # get virtual environment from project first |
|
2034 venvName = self.__e5project.getDebugProperty("VIRTUALENV") |
|
2035 if venvName: |
2040 try: |
2036 try: |
2041 clientEnv["PATH"] = self.__ui.getOriginalPathString() |
2037 isRemote = venvManager.isRemoteEnvironment(venvName) |
2042 except AttributeError: |
2038 except AttributeError: |
2043 # ignore for eric6 < 18.12 |
2039 isRemote = False |
2044 pass |
2040 else: |
2045 try: |
2041 isRemote = False |
2046 # new code using virtual environments |
2042 if (not venvName) or isRemote: |
2047 venvManager = e5App().getObject("VirtualEnvManager") |
2043 # get it from debugger settings next |
|
2044 if self.__projectLanguage in ("Python3", "MicroPython"): |
|
2045 venvName = Preferences.getDebugger("Python3VirtualEnv") |
|
2046 if not venvName: |
|
2047 venvName, _ = venvManager.getDefaultEnvironment() |
|
2048 else: |
|
2049 venvName = "" |
|
2050 if venvName: |
|
2051 interpreter = venvManager.getVirtualenvInterpreter( |
|
2052 venvName) |
|
2053 execPath = venvManager.getVirtualenvExecPath(venvName) |
2048 |
2054 |
2049 # get virtual environment from project first |
2055 # build a suitable environment |
2050 venvName = self.__e5project.getDebugProperty("VIRTUALENV") |
2056 if execPath: |
2051 if venvName: |
2057 if "PATH" in clientEnv: |
2052 try: |
2058 clientEnv["PATH"] = os.pathsep.join( |
2053 isRemote = venvManager.isRemoteEnvironment(venvName) |
2059 [execPath, clientEnv["PATH"]]) |
2054 except AttributeError: |
|
2055 isRemote = False |
|
2056 else: |
|
2057 isRemote = False |
|
2058 if (not venvName) or isRemote: |
|
2059 # get it from debugger settings next |
|
2060 if self.__projectLanguage in ("Python3", "MicroPython"): |
|
2061 # Python 3 |
|
2062 venvName = Preferences.getDebugger("Python3VirtualEnv") |
|
2063 if not venvName and sys.version_info[0] >= 3: |
|
2064 try: |
|
2065 venvName, _ = ( |
|
2066 venvManager.getDefaultEnvironment() |
|
2067 ) |
|
2068 except AttributeError: |
|
2069 # ignore for eric6 < 18.10 |
|
2070 pass |
|
2071 else: |
2060 else: |
2072 venvName = "" |
2061 clientEnv["PATH"] = execPath |
2073 if venvName: |
2062 else: |
2074 interpreter = venvManager.getVirtualenvInterpreter( |
2063 interpreter = "" |
2075 venvName) |
|
2076 |
|
2077 try: |
|
2078 execPath = venvManager.getVirtualenvExecPath(venvName) |
|
2079 except AttributeError: |
|
2080 # eric6 < 18.12 |
|
2081 execPath = "" |
|
2082 |
|
2083 # build a suitable environment |
|
2084 if execPath: |
|
2085 if "PATH" in clientEnv: |
|
2086 clientEnv["PATH"] = os.pathsep.join( |
|
2087 [execPath, clientEnv["PATH"]]) |
|
2088 else: |
|
2089 clientEnv["PATH"] = execPath |
|
2090 else: |
|
2091 interpreter = "" |
|
2092 except KeyError: |
|
2093 # backward compatibility (eric < 18.07) |
|
2094 # get interpreter from project first |
|
2095 interpreter = self.__e5project.getDebugProperty("INTERPRETER") |
|
2096 if not interpreter or not Utilities.isinpath(interpreter): |
|
2097 # get it from debugger settings second |
|
2098 if self.__projectLanguage in ("Python3", "MicroPython"): |
|
2099 interpreter = Preferences.getDebugger( |
|
2100 "Python3Interpreter") |
|
2101 else: |
|
2102 interpreter = "" |
|
2103 if interpreter: |
2064 if interpreter: |
2104 if isRemote: |
2065 if isRemote: |
2105 self.__ui.appendToStderr(self.tr( |
2066 self.__ui.appendToStderr(self.tr( |
2106 "The project is configured for remote access." |
2067 "The project is configured for remote access." |
2107 " Using local interpreter instead." |
2068 " Using local interpreter instead." |