--- a/eric6/Project/ProjectFormsBrowser.py Mon Dec 21 13:36:24 2020 +0100 +++ b/eric6/Project/ProjectFormsBrowser.py Tue Dec 22 19:59:29 2020 +0100 @@ -49,7 +49,8 @@ showMenu = pyqtSignal(str, QMenu) menusAboutToBeCreated = pyqtSignal() - PyuicIndentDefault = 4 + Pyuic5IndentDefault = 4 + Pyuic6IndentDefault = 4 def __init__(self, project, parent=None): """ @@ -123,8 +124,10 @@ self.menusAboutToBeCreated.emit() + projectType = self.project.getProjectType() + self.menu = QMenu(self) - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.menu.addAction( self.tr('Compile form'), self.__compileForm) self.menu.addAction( @@ -184,7 +187,7 @@ act = self.menu.addAction(self.tr('Delete'), self.__deleteFile) self.menuActions.append(act) self.menu.addSeparator() - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.menu.addAction(self.tr('New form...'), self.__newForm) else: if self.hooks["newForm"] is not None: @@ -207,9 +210,7 @@ self.backMenu = QMenu(self) if ( - self.project.getProjectType() in [ - "PyQt5", "E6Plugin", "PySide2" - ] or + projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"] or self.hooks["compileAllForms"] is not None ): self.backMenu.addAction( @@ -240,7 +241,7 @@ # create the menu for multiple selected files self.multiMenu = QMenu(self) - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.multiMenu.addAction( self.tr('Compile forms'), self.__compileSelectedForms) self.multiMenu.addSeparator() @@ -285,7 +286,7 @@ self.multiMenu.addAction(self.tr('Configure...'), self._configure) self.dirMenu = QMenu(self) - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.dirMenu.addAction( self.tr('Compile all forms'), self.__compileAllForms) self.dirMenu.addSeparator() @@ -308,7 +309,7 @@ self.tr('Delete'), self._deleteDirectory) self.dirMenuActions.append(act) self.dirMenu.addSeparator() - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.dirMenu.addAction(self.tr('New form...'), self.__newForm) else: if self.hooks["newForm"] is not None: @@ -332,7 +333,7 @@ self.dirMenu.addAction(self.tr('Configure...'), self._configure) self.dirMultiMenu = QMenu(self) - if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]: + if projectType in ["PyQt5", "PyQt6", "E6Plugin", "PySide2"]: self.dirMultiMenu.addAction( self.tr('Compile all forms'), self.__compileAllForms) self.dirMultiMenu.addSeparator() @@ -377,7 +378,9 @@ if not self.project.isOpen(): return - enable = self.project.getProjectType() in ("PyQt5", "E6Plugin") + enable = ( + self.project.getProjectType() in ("PyQt5", "PyQt6", "E6Plugin") + ) self.__pyuicConfigAct.setEnabled(enable) self.__pyuicMultiConfigAct.setEnabled(enable) self.__pyuicDirConfigAct.setEnabled(enable) @@ -565,7 +568,7 @@ self.hooks["newForm"](path) else: if self.project.getProjectType() in [ - "PyQt5", "E6Plugin", "PySide2" + "PyQt5", "PyQt6", "E6Plugin", "PySide2" ]: self.__newUiForm(path) @@ -681,6 +684,9 @@ if self.project.getProjectType() in ["PyQt5"]: self.__uicompiler = Utilities.generatePyQtToolPath( 'pyuic5', ["py3uic5"]) + elif self.project.getProjectType() in ["PyQt6"]: + self.__uicompiler = Utilities.generatePyQtToolPath( + 'pyuic6') elif self.project.getProjectType() in ["E6Plugin"]: self.__uicompiler = Utilities.generatePyQtToolPath( 'pyuic5', ["py3uic5"]) @@ -703,7 +709,7 @@ def __readStdout(self): """ Private slot to handle the readyReadStandardOutput signal of the - pyuic5/pyside2-uic process. + pyuic5/pyuic6/pyside2-uic process. """ if self.compileProc is None: return @@ -716,7 +722,7 @@ def __readStderr(self): """ Private slot to handle the readyReadStandardError signal of the - pyuic5/pyside2-uic process. + pyuic5/pyuic6/pyside2-uic process. """ if self.compileProc is None: return @@ -822,12 +828,19 @@ # PySide2 if Preferences.getQt("PySide2FromImports"): args.append("--from-imports") + elif self.project.getProjectType() == "PyQt6": + # PyQt6 + if Preferences.getQt("Pyuic6Execute"): + args.append("-x") + indentWidth = Preferences.getQt("Pyuic6Indent") + if indentWidth != self.Pyuic6IndentDefault: + args.append("--indent={0}".format(indentWidth)) else: # PyQt5 if Preferences.getQt("PyuicExecute"): args.append("-x") indentWidth = Preferences.getQt("PyuicIndent") - if indentWidth != self.PyuicIndentDefault: + if indentWidth != self.Pyuic5IndentDefault: args.append("--indent={0}".format(indentWidth)) if ( 'uic5' in uicompiler and @@ -987,7 +1000,7 @@ self.hooks["compileChangedForms"](self.project.pdata["FORMS"]) else: if self.project.getProjectType() not in [ - "PyQt5", "E6Plugin", "PySide2" + "PyQt5", "PyQt6", "E6Plugin", "PySide2" ]: # ignore the request for non Qt GUI projects return @@ -1061,7 +1074,7 @@ params = self.project.pdata["UICPARAMS"] - if self.project.getProjectType() in ["PyQt5", "E6Plugin"]: + if self.project.getProjectType() in ["PyQt5", "PyQt6", "E6Plugin"]: dlg = UicCompilerOptionsDialog(params, self.getUiCompiler()) if dlg.exec() == QDialog.Accepted: package, suffix, root = dlg.getData()