eric6/Project/ProjectFormsBrowser.py

changeset 7635
0cdead130a81
parent 7628
f904d0eef264
child 7759
51aa6c6b66f7
--- a/eric6/Project/ProjectFormsBrowser.py	Sat Jun 20 17:36:20 2020 +0200
+++ b/eric6/Project/ProjectFormsBrowser.py	Sun Jun 21 18:26:12 2020 +0200
@@ -74,7 +74,7 @@
             """ context menu.</p>"""
         ))
         
-        # templates for Qt4
+        # templates for Qt
         # these two lists have to stay in sync
         self.templates4 = [
             'dialog4.tmpl', 'widget4.tmpl', 'mainwindow4.tmpl',
@@ -125,9 +125,7 @@
         self.menusAboutToBeCreated.emit()
         
         self.menu = QMenu(self)
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.menu.addAction(
                 self.tr('Compile form'), self.__compileForm)
             self.menu.addAction(
@@ -187,9 +185,7 @@
         act = self.menu.addAction(self.tr('Delete'), self.__deleteFile)
         self.menuActions.append(act)
         self.menu.addSeparator()
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.menu.addAction(self.tr('New form...'), self.__newForm)
         else:
             if self.hooks["newForm"] is not None:
@@ -213,7 +209,7 @@
         self.backMenu = QMenu(self)
         if (
             self.project.getProjectType() in [
-                "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
+                "PyQt5", "E6Plugin", "PySide2"
             ] or
             self.hooks["compileAllForms"] is not None
         ):
@@ -245,9 +241,7 @@
 
         # create the menu for multiple selected files
         self.multiMenu = QMenu(self)
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.multiMenu.addAction(
                 self.tr('Compile forms'), self.__compileSelectedForms)
             self.multiMenu.addSeparator()
@@ -292,9 +286,7 @@
         self.multiMenu.addAction(self.tr('Configure...'), self._configure)
 
         self.dirMenu = QMenu(self)
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.dirMenu.addAction(
                 self.tr('Compile all forms'), self.__compileAllForms)
             self.dirMenu.addSeparator()
@@ -317,9 +309,7 @@
             self.tr('Delete'), self._deleteDirectory)
         self.dirMenuActions.append(act)
         self.dirMenu.addSeparator()
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.dirMenu.addAction(self.tr('New form...'), self.__newForm)
         else:
             if self.hooks["newForm"] is not None:
@@ -343,9 +333,7 @@
         self.dirMenu.addAction(self.tr('Configure...'), self._configure)
         
         self.dirMultiMenu = QMenu(self)
-        if self.project.getProjectType() in [
-            "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
-        ]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin", "PySide2"]:
             self.dirMultiMenu.addAction(
                 self.tr('Compile all forms'), self.__compileAllForms)
             self.dirMultiMenu.addSeparator()
@@ -390,7 +378,7 @@
         if not self.project.isOpen():
             return
         
-        enable = self.project.getProjectType() in ("Qt4", "PyQt5", "E6Plugin")
+        enable = self.project.getProjectType() in ("PyQt5", "E6Plugin")
         self.__pyuicConfigAct.setEnabled(enable)
         self.__pyuicMultiConfigAct.setEnabled(enable)
         self.__pyuicDirConfigAct.setEnabled(enable)
@@ -578,7 +566,7 @@
             self.hooks["newForm"](path)
         else:
             if self.project.getProjectType() in [
-                "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
+                "PyQt5", "E6Plugin", "PySide2"
             ]:
                 self.__newUiForm(path)
         
@@ -690,30 +678,16 @@
         """
         self.__resetUiCompiler()
         
-        if self.project.getProjectLanguage() in [
-            "Python", "Python2", "Python3"
-        ]:
-            if self.project.getProjectType() in ["Qt4", ]:
-                self.__uicompiler = Utilities.generatePyQtToolPath(
-                    'pyuic4', ["py3uic4"])
-            elif self.project.getProjectType() in ["PyQt5"]:
+        if self.project.getProjectLanguage() == "Python3":
+            if self.project.getProjectType() in ["PyQt5"]:
                 self.__uicompiler = Utilities.generatePyQtToolPath(
                     'pyuic5', ["py3uic5"])
             elif self.project.getProjectType() in ["E6Plugin"]:
                 self.__uicompiler = Utilities.generatePyQtToolPath(
                     'pyuic5', ["py3uic5"])
-            elif self.project.getProjectType() == "PySide":
-                self.__uicompiler = Utilities.generatePySideToolPath(
-                    'pyside-uic', "1")
             elif self.project.getProjectType() == "PySide2":
                 self.__uicompiler = Utilities.generatePySideToolPath(
-                    'pyside2-uic', "2")
-        elif self.project.getProjectLanguage() == "Ruby":
-            if self.project.getProjectType() == "Qt4":
-                self.__uicompiler = 'rbuic4'
-                if Utilities.isWindowsPlatform():
-                    self.__uicompiler = Utilities.getWindowsExecutablePath(
-                        self.__uicompiler)
+                    'pyside2-uic')
     
     def getUiCompiler(self):
         """
@@ -730,7 +704,7 @@
     def __readStdout(self):
         """
         Private slot to handle the readyReadStandardOutput signal of the
-        pyuic4/pyuic5/pyside-uic/pyside2-uic/rbuic4 process.
+        pyuic5/pyside2-uic process.
         """
         if self.compileProc is None:
             return
@@ -743,7 +717,7 @@
     def __readStderr(self):
         """
         Private slot to handle the readyReadStandardError signal of the
-        pyuic4/pyuic5/pyside-uic/pyside2-uic/rbuic4 process.
+        pyuic5/pyside2-uic process.
         """
         if self.compileProc is None:
             return
@@ -842,18 +816,16 @@
         ofn, ext = os.path.splitext(fn)
         fn = os.path.join(self.project.ppath, fn)
         
-        if self.project.getProjectLanguage() in [
-            "Python", "Python2", "Python3"
-        ]:
+        if self.project.getProjectLanguage() == "Python3":
             dirname, filename = os.path.split(ofn)
             self.compiledFile = os.path.join(dirname, "Ui_" + filename + ".py")
             
-            if self.project.getProjectType() in ["PySide", "PySide2"]:
-                # PySide and PySide2
+            if self.project.getProjectType() == "PySide2":
+                # PySide2
                 if Preferences.getQt("PySide2FromImports"):
                     args.append("--from-imports")
             else:
-                # PyQt4 and PyQt5
+                # PyQt5
                 if Preferences.getQt("PyuicExecute"):
                     args.append("-x")
                 indentWidth = Preferences.getQt("PyuicIndent")
@@ -902,7 +874,7 @@
         
     def __generateDialogCode(self):
         """
-        Private method to generate dialog code for the form (Qt4 only).
+        Private method to generate dialog code for the form (Qt only).
         """
         itm = self.model().item(self.currentIndex())
         fn = itm.fileName()
@@ -1017,7 +989,7 @@
             self.hooks["compileChangedForms"](self.project.pdata["FORMS"])
         else:
             if self.project.getProjectType() not in [
-                "Qt4", "PyQt5", "E6Plugin", "PySide", "PySide2"
+                "PyQt5", "E6Plugin", "PySide2"
             ]:
                 # ignore the request for non Qt GUI projects
                 return
@@ -1037,9 +1009,7 @@
                 QApplication.processEvents()
                 
                 ifn = os.path.join(self.project.ppath, fn)
-                if self.project.getProjectLanguage() in [
-                    "Python", "Python2", "Python3"
-                ]:
+                if self.project.getProjectLanguage() == "Python3":
                     dirname, filename = os.path.split(os.path.splitext(ifn)[0])
                     ofn = os.path.join(dirname, "Ui_" + filename + ".py")
                 elif self.project.getProjectLanguage() == "Ruby":
@@ -1093,7 +1063,7 @@
         
         params = self.project.pdata["UICPARAMS"]
         
-        if self.project.getProjectType() in ["Qt4", "PyQt5", "E6Plugin"]:
+        if self.project.getProjectType() in ["PyQt5", "E6Plugin"]:
             dlg = UicCompilerOptionsDialog(params, self.getUiCompiler())
             if dlg.exec_() == QDialog.Accepted:
                 package, suffix, root = dlg.getData()

eric ide

mercurial