21 |
21 |
22 from eric7 import Utilities |
22 from eric7 import Utilities |
23 from eric7.EricGui.EricAction import EricAction |
23 from eric7.EricGui.EricAction import EricAction |
24 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
24 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
25 from eric7.EricWidgets.EricApplication import ericApp |
25 from eric7.EricWidgets.EricApplication import ericApp |
26 from eric7.Globals import isWindowsPlatform |
|
27 |
26 |
28 try: |
27 try: |
29 from eric7.EricGui import EricPixmapCache |
28 from eric7.EricGui import EricPixmapCache |
30 except ImportError: |
29 except ImportError: |
31 from UI import PixmapCache as EricPixmapCache |
30 from UI import PixmapCache as EricPixmapCache |
|
31 |
|
32 try: |
|
33 from eric7.SystemUtilities.FileSystemUtilities import ( |
|
34 getExecutablePath, |
|
35 getExecutablePaths, |
|
36 ) |
|
37 except ImportError: |
|
38 # imports for eric < 23.1 |
|
39 from eric7.Utilities import getExecutablePath, getExecutablePaths |
|
40 try: |
|
41 from eric7.SystemUtilities.OSUtilities import isWindowsPlatform |
|
42 except ImportError: |
|
43 # imports for eric < 23.1 |
|
44 from eric7.Globals import isWindowsPlatform |
32 |
45 |
33 from .FlaskBabelExtension.PyBabelProjectExtension import PyBabelProject |
46 from .FlaskBabelExtension.PyBabelProjectExtension import PyBabelProject |
34 from .FlaskMigrateExtension.MigrateProjectExtension import MigrateProject |
47 from .FlaskMigrateExtension.MigrateProjectExtension import MigrateProject |
35 |
48 |
36 |
49 |
479 ] # fall back to just cmd |
492 ] # fall back to just cmd |
480 if isWindowsPlatform() |
493 if isWindowsPlatform() |
481 else [ |
494 else [ |
482 os.path.join(virtualEnv, "bin", command), |
495 os.path.join(virtualEnv, "bin", command), |
483 os.path.join(virtualEnv, "local", "bin", command), |
496 os.path.join(virtualEnv, "local", "bin", command), |
484 Utilities.getExecutablePath(command), |
497 getExecutablePath(command), |
485 command, |
498 command, |
486 ] # fall back to just cmd |
499 ] # fall back to just cmd |
487 ) |
500 ) |
488 for command in fullCmds: |
501 for command in fullCmds: |
489 if os.path.exists(command): |
502 if os.path.exists(command): |
522 fullCmd = self.getFlaskCommand() |
535 fullCmd = self.getFlaskCommand() |
523 if isWindowsPlatform(): |
536 if isWindowsPlatform(): |
524 if fullCmd: |
537 if fullCmd: |
525 variants.append("Python3") |
538 variants.append("Python3") |
526 else: |
539 else: |
527 fullCmds = Utilities.getExecutablePaths("flask") |
540 fullCmds = getExecutablePaths("flask") |
528 for fullCmd in fullCmds: |
541 for fullCmd in fullCmds: |
529 try: |
542 try: |
530 with open(fullCmd, "r", encoding="utf-8") as f: |
543 with open(fullCmd, "r", encoding="utf-8") as f: |
531 l0 = f.readline() |
544 l0 = f.readline() |
532 except OSError: |
545 except OSError: |
883 consoleCmd = self.__plugin.getPreferences("ConsoleCommand") |
896 consoleCmd = self.__plugin.getPreferences("ConsoleCommand") |
884 if consoleCmd: |
897 if consoleCmd: |
885 self.__terminatePythonShell() |
898 self.__terminatePythonShell() |
886 |
899 |
887 args = Utilities.parseOptionString(consoleCmd) |
900 args = Utilities.parseOptionString(consoleCmd) |
888 args[0] = Utilities.getExecutablePath(args[0]) |
901 args[0] = getExecutablePath(args[0]) |
889 args += [command, "shell"] |
902 args += [command, "shell"] |
890 |
903 |
891 self.__shellProcess = QProcess() |
904 self.__shellProcess = QProcess() |
892 self.__shellProcess.setProcessEnvironment(env) |
905 self.__shellProcess.setProcessEnvironment(env) |
893 self.__shellProcess.setWorkingDirectory(workdir) |
906 self.__shellProcess.setWorkingDirectory(workdir) |