7 Module implementing a dialog to enter the options for a check operation. |
7 Module implementing a dialog to enter the options for a check operation. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt6.QtCore import pyqtSlot, Qt, QProcess |
12 from PyQt6.QtCore import QProcess, Qt, pyqtSlot |
13 from PyQt6.QtWidgets import QDialog |
13 from PyQt6.QtWidgets import QDialog |
14 |
14 |
15 from eric7 import Preferences, Utilities |
15 from eric7 import Preferences |
16 |
16 |
17 try: |
17 try: |
18 from eric7.EricGui import EricPixmapCache |
18 from eric7.EricGui import EricPixmapCache |
19 except ImportError: |
19 except ImportError: |
20 from UI import PixmapCache as EricPixmapCache |
20 from UI import PixmapCache as EricPixmapCache |
|
21 |
21 from eric7.EricWidgets import EricFileDialog |
22 from eric7.EricWidgets import EricFileDialog |
|
23 |
|
24 try: |
|
25 from eric7.SystemUtilities.FileSystemUtilities import ( |
|
26 relativeUniversalPath, |
|
27 toNativeSeparators, |
|
28 ) |
|
29 except ImportError: |
|
30 # imports for eric < 23.1 |
|
31 from eric7.Utilities import relativeUniversalPath, toNativeSeparators |
22 |
32 |
23 from .Ui_DjangoCheckOptionsDialog import Ui_DjangoCheckOptionsDialog |
33 from .Ui_DjangoCheckOptionsDialog import Ui_DjangoCheckOptionsDialog |
24 |
34 |
25 |
35 |
26 class DjangoCheckOptionsDialog(QDialog, Ui_DjangoCheckOptionsDialog): |
36 class DjangoCheckOptionsDialog(QDialog, Ui_DjangoCheckOptionsDialog): |
91 @type str |
101 @type str |
92 @return module name |
102 @return module name |
93 @rtype str |
103 @rtype str |
94 """ |
104 """ |
95 start = self.__path[:-1] if self.__path.endswith(("/", "\\")) else self.__path |
105 start = self.__path[:-1] if self.__path.endswith(("/", "\\")) else self.__path |
96 relPath = Utilities.relativeUniversalPath(path, start) |
106 relPath = relativeUniversalPath(path, start) |
97 mod = os.path.splitext(relPath)[0].replace("/", ".") |
107 mod = os.path.splitext(relPath)[0].replace("/", ".") |
98 return mod |
108 return mod |
99 |
109 |
100 def __moduleToPath(self, moduleName): |
110 def __moduleToPath(self, moduleName): |
101 """ |
111 """ |
109 if moduleName: |
119 if moduleName: |
110 mod = "{0}.py".format(moduleName.replace(".", "/")) |
120 mod = "{0}.py".format(moduleName.replace(".", "/")) |
111 if not os.path.isabs(mod): |
121 if not os.path.isabs(mod): |
112 mod = os.path.join(self.__path, mod) |
122 mod = os.path.join(self.__path, mod) |
113 |
123 |
114 path = Utilities.toNativeSeparators(mod) |
124 path = toNativeSeparators(mod) |
115 else: |
125 else: |
116 path = "" |
126 path = "" |
117 return path |
127 return path |
118 |
128 |
119 def __populateTagsList(self, deployMode): |
129 def __populateTagsList(self, deployMode): |