Added dialog code generation capability for PySide and Python3. 5_2_x

Fri, 18 May 2012 12:41:38 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 18 May 2012 12:41:38 +0200
branch
5_2_x
changeset 1863
aff02fd67d62
parent 1861
6e8f19ebda9d
child 1866
91cfb0c311cb

Added dialog code generation capability for PySide and Python3.

CodeTemplates/impl_pyside.py.tmpl file | annotate | diff | comparison | revisions
Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
diff -r 6e8f19ebda9d -r aff02fd67d62 CodeTemplates/impl_pyside.py.tmpl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CodeTemplates/impl_pyside.py.tmpl	Fri May 18 12:41:38 2012 +0200
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
+"""
+Module implementing $CLASSNAME$.
+"""
+
+from PySide.QtCore import Slot
+from PySide.QtGui import $SUPERCLASS$
+
+from .Ui_$FORMFILE$ import Ui_$FORMCLASS$
+
+
+class $CLASSNAME$($SUPERCLASS$, Ui_$FORMCLASS$):
+    """
+    Class documentation goes here.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget (QWidget)
+        """
+        $SUPERCLASS$.__init__(self, parent)
+        self.setupUi(self)
diff -r 6e8f19ebda9d -r aff02fd67d62 Project/CreateDialogCodeDialog.py
--- a/Project/CreateDialogCodeDialog.py	Fri May 11 18:48:10 2012 +0200
+++ b/Project/CreateDialogCodeDialog.py	Fri May 18 12:41:38 2012 +0200
@@ -321,8 +321,12 @@
                         tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
                                                 "impl_pyqt.py2.tmpl")
                 else:
-                    tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
-                                            "impl_pyqt.py.tmpl")
+                    if self.project.getProjectType() == "PySide":
+                        tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
+                                                "impl_pyside.py.tmpl")
+                    else:
+                        tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
+                                                "impl_pyqt.py.tmpl")
                 tmplFile = open(tmplName, 'r', encoding="utf-8")
                 template = tmplFile.read()
                 tmplFile.close()
@@ -392,7 +396,10 @@
             else:
                 pyqtSignatureFormat = '@pyqtSignature("{0}")'
         else:
-            pyqtSignatureFormat = '@pyqtSlot({0})'
+            if self.project.getProjectType() == "PySide":
+                pyqtSignatureFormat = '@Slot({0})'
+            else:
+                pyqtSignatureFormat = '@pyqtSlot({0})'
         for row in range(self.slotsModel.rowCount()):
             topItem = self.slotsModel.item(row)
             for childRow in range(topItem.rowCount()):

eric ide

mercurial