24 |
24 |
25 from .Ui_CreateDialogCodeDialog import Ui_CreateDialogCodeDialog |
25 from .Ui_CreateDialogCodeDialog import Ui_CreateDialogCodeDialog |
26 from .NewDialogClassDialog import NewDialogClassDialog |
26 from .NewDialogClassDialog import NewDialogClassDialog |
27 |
27 |
28 from eric6config import getConfig |
28 from eric6config import getConfig |
|
29 |
|
30 import Preferences |
29 |
31 |
30 |
32 |
31 pyqtSignatureRole = Qt.UserRole + 1 |
33 pyqtSignatureRole = Qt.UserRole + 1 |
32 pythonSignatureRole = Qt.UserRole + 2 |
34 pythonSignatureRole = Qt.UserRole + 2 |
33 rubySignatureRole = Qt.UserRole + 3 |
35 rubySignatureRole = Qt.UserRole + 3 |
157 @param command uic command to be run |
159 @param command uic command to be run |
158 @type str |
160 @type str |
159 @return tuple of process output and error flag |
161 @return tuple of process output and error flag |
160 @rtype tuple of (str, bool) |
162 @rtype tuple of (str, bool) |
161 """ |
163 """ |
|
164 venvManager = e5App().getObject("VirtualEnvManager") |
|
165 projectType = self.project.getProjectType() |
|
166 |
162 venvName = self.project.getDebugProperty("VIRTUALENV") |
167 venvName = self.project.getDebugProperty("VIRTUALENV") |
163 venvManager = e5App().getObject("VirtualEnvManager") |
168 if not venvName: |
|
169 # no project specific environment, try a type specific one |
|
170 if projectType in ("PyQt5", "E6Plugin", "PySide2"): |
|
171 venvName = Preferences.getQt("PyQtVenvName") |
|
172 elif projectType in ("PyQt6", ): |
|
173 venvName = Preferences.getQt("PyQt6VenvName") |
164 interpreter = venvManager.getVirtualenvInterpreter(venvName) |
174 interpreter = venvManager.getVirtualenvInterpreter(venvName) |
165 execPath = venvManager.getVirtualenvExecPath(venvName) |
175 execPath = venvManager.getVirtualenvExecPath(venvName) |
166 |
176 |
167 if not interpreter: |
177 if not interpreter: |
168 interpreter = sys.executable |
178 interpreter = sys.executable |
174 "PATH", os.pathsep.join([execPath, env.value("PATH")]) |
184 "PATH", os.pathsep.join([execPath, env.value("PATH")]) |
175 ) |
185 ) |
176 else: |
186 else: |
177 env.insert("PATH", execPath) |
187 env.insert("PATH", execPath) |
178 |
188 |
179 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi.py") |
189 if projectType in ("PyQt5", "E6Plugin", "PySide2"): |
|
190 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi5.py") |
|
191 elif projectType in ("PyQt6", ): |
|
192 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi6.py") |
180 args = [ |
193 args = [ |
181 loadUi, |
194 loadUi, |
182 command, |
195 command, |
183 self.formFile, |
196 self.formFile, |
184 self.packagesPath, |
197 self.packagesPath, |
410 elif self.project.getProjectType() in [ |
423 elif self.project.getProjectType() in [ |
411 "PyQt5", "E6Plugin"]: |
424 "PyQt5", "E6Plugin"]: |
412 tmplName = os.path.join( |
425 tmplName = os.path.join( |
413 getConfig('ericCodeTemplatesDir'), |
426 getConfig('ericCodeTemplatesDir'), |
414 "impl_pyqt5.py.tmpl") |
427 "impl_pyqt5.py.tmpl") |
|
428 elif self.project.getProjectType() == "PyQt6": |
|
429 tmplName = os.path.join( |
|
430 getConfig('ericCodeTemplatesDir'), |
|
431 "impl_pyqt6.py.tmpl") |
415 else: |
432 else: |
416 E5MessageBox.critical( |
433 E5MessageBox.critical( |
417 self, |
434 self, |
418 self.tr("Code Generation"), |
435 self.tr("Code Generation"), |
419 self.tr( |
436 self.tr( |