13 from PyQt6.QtCore import pyqtSlot |
13 from PyQt6.QtCore import pyqtSlot |
14 from PyQt6.QtGui import QAction |
14 from PyQt6.QtGui import QAction |
15 from PyQt6.QtWidgets import QMenu, QApplication |
15 from PyQt6.QtWidgets import QMenu, QApplication |
16 from PyQt6.Qsci import QsciScintilla |
16 from PyQt6.Qsci import QsciScintilla |
17 |
17 |
18 from eric7 import Globals, Preferences, Utilities |
18 from eric7 import Preferences, Utilities |
19 from eric7.EricGui.EricAction import EricAction |
19 from eric7.EricGui.EricAction import EricAction |
20 from eric7.EricNetwork.EricJsonServer import EricJsonServer |
20 from eric7.EricNetwork.EricJsonServer import EricJsonServer |
21 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.Preferences.Shortcuts import readShortcuts |
23 from eric7.Preferences.Shortcuts import readShortcuts |
|
24 |
|
25 try: |
|
26 from eric7.SystemUtilities.FileSystemUtilities import ( |
|
27 normcasepath |
|
28 ) |
|
29 except ImportError: |
|
30 # imports for eric < 23.1 |
|
31 from eric7.Utilities import normcasepath |
|
32 try: |
|
33 from eric7.SystemUtilities.PythonUtilities import ( |
|
34 getPythonExecutable, getPythonLibraryDirectory |
|
35 ) |
|
36 except ImportError: |
|
37 # imports for eric < 23.1 |
|
38 from eric7.Globals import getPythonExecutable, getPythonLibraryDirectory |
24 |
39 |
25 |
40 |
26 from .RopeProgressDialog import RopeProgressDialog |
41 from .RopeProgressDialog import RopeProgressDialog |
27 |
42 |
28 |
43 |
2305 else: |
2320 else: |
2306 venvName = "" |
2321 venvName = "" |
2307 if venvName: |
2322 if venvName: |
2308 interpreter = venvManager.getVirtualenvInterpreter(venvName) |
2323 interpreter = venvManager.getVirtualenvInterpreter(venvName) |
2309 if not interpreter: |
2324 if not interpreter: |
2310 interpreter = Globals.getPythonExecutable() |
2325 interpreter = getPythonExecutable() |
2311 execPath = venvManager.getVirtualenvExecPath(venvName) |
2326 execPath = venvManager.getVirtualenvExecPath(venvName) |
2312 |
2327 |
2313 # build a suitable environment |
2328 # build a suitable environment |
2314 if execPath: |
2329 if execPath: |
2315 if "PATH" in clientEnv: |
2330 if "PATH" in clientEnv: |
2317 [execPath, clientEnv["PATH"]] |
2332 [execPath, clientEnv["PATH"]] |
2318 ) |
2333 ) |
2319 else: |
2334 else: |
2320 clientEnv["PATH"] = execPath |
2335 clientEnv["PATH"] = execPath |
2321 else: |
2336 else: |
2322 interpreter = Globals.getPythonExecutable() |
2337 interpreter = getPythonExecutable() |
2323 if interpreter: |
2338 if interpreter: |
2324 if isRemote: |
2339 if isRemote: |
2325 self.__ui.appendToStderr( |
2340 self.__ui.appendToStderr( |
2326 self.tr( |
2341 self.tr( |
2327 "The project is configured for remote access." |
2342 "The project is configured for remote access." |
2414 Public method to refresh modified editors. |
2429 Public method to refresh modified editors. |
2415 |
2430 |
2416 @param changedFiles list of changed files |
2431 @param changedFiles list of changed files |
2417 @type list of str |
2432 @type list of str |
2418 """ |
2433 """ |
2419 openFiles = [Utilities.normcasepath(f) for f in self.__vm.getOpenFilenames()] |
2434 openFiles = [normcasepath(f) for f in self.__vm.getOpenFilenames()] |
2420 |
2435 |
2421 for fileName in changedFiles: |
2436 for fileName in changedFiles: |
2422 normfile = Utilities.normcasepath(fileName) |
2437 normfile = normcasepath(fileName) |
2423 if normfile in openFiles: |
2438 if normfile in openFiles: |
2424 editor = self.__vm.getEditor(normfile)[1] |
2439 editor = self.__vm.getEditor(normfile)[1] |
2425 editor.refresh() |
2440 editor.refresh() |
2426 |
2441 |
2427 aw = self.__vm.activeWindow() |
2442 aw = self.__vm.activeWindow() |
2530 if interpreter: |
2545 if interpreter: |
2531 client = os.path.join(os.path.dirname(__file__), "RefactoringClient.py") |
2546 client = os.path.join(os.path.dirname(__file__), "RefactoringClient.py") |
2532 ok, exitCode = self.startClient( |
2547 ok, exitCode = self.startClient( |
2533 interpreter, |
2548 interpreter, |
2534 client, |
2549 client, |
2535 [self.__projectpath, Globals.getPythonLibraryDirectory()], |
2550 [self.__projectpath, getPythonLibraryDirectory()], |
2536 environment=clientEnv, |
2551 environment=clientEnv, |
2537 ) |
2552 ) |
2538 if not ok and exitCode == 42: |
2553 if not ok and exitCode == 42: |
2539 self.__ui.appendToStderr( |
2554 self.__ui.appendToStderr( |
2540 "RefactoringServer: " |
2555 "RefactoringServer: " |