[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] problem with pyqtref manual code
From:       "simon stockes" <simonstockes () gmail ! com>
Date:       2006-11-13 16:00:50
Message-ID: f36398ff0611130800j3ef93178lfe28ba3184756b25 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi and thank a lot for your help,

You'r right.
I forgot these lines

app = QtGui.QApplication(sys.argv)
window = ImageDialog()
window.show()
sys.exit(app.exec_())

But there is another problem. The code produced by "designer" Qt-4.2.1 is
not compatible with Qt-4.1.4 !! QDialogButtonBox is new in Qt-4.2 !!

Also, be carefull to comment also in ui_imagedialog.py this line

#self.ui.colorDepthCombo.addItem("2 colors (1 bit per pixel)")

Bye, Simon.


2006/11/11, Phil Thompson <phil@riverbankcomputing.co.uk>:
>
> On Friday 10 November 2006 3:43 pm, simon stockes wrote:
> > Hi,
> >
> > With the pyqtref manual, I try to test base2.py (see below the code).
> But
> > this one does not produce anything !!
> > Is it the same for you ?
> >
> > Simon
> >
> > Config : rhel4, pyqt-4.0.1, qt4.1.4
> >
> >
> >
> > Base2.py
> > =======
> >
> > from PyQt4 import QtCore, QtGui
> > from ui_imagedialog import Ui_ImageDialog
> >
> > class ImageDialog(QtGui.QDialog):
> >     def __init__(self):
> >         QtGui.QDialog.__init__(self)
> >
> >         # Set up the user interface from Designer.
> >         self.ui = Ui_ImageDialog()
> >         self.ui.setupUi(self)
> >
> >         # Make some local modifications.
> >         self.ui.colorDepthCombo.addItem("2 colors (1 bit per pixel)")
> >
> >         # Connect up the buttons.
> >         self.connect(self.ui.okButton, QtCore.SIGNAL("clicked()"),
> >                      self, QtCore.SLOT("accept()"))
> >         self.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"),
> >                      self, QtCore.SLOT("reject()"))
> >
> > ui_imagedialog.py
> > =============
> >
> > import sys
> > from PyQt4 import QtCore, QtGui
> >
> > class Ui_ImageDialog(object):
> >     def setupUi(self, ImageDialog):
> >         ImageDialog.setObjectName("ImageDialog")
> >         ImageDialog.resize(QtCore.QSize(QtCore.QRect
> > (0,0,420,300).size()).expandedTo(ImageDialog.minimumSizeHint()))
> >
> >         self.buttonBox = QtGui.QDialogButtonBox(ImageDialog)
> >         self.buttonBox.setGeometry(QtCore.QRect(30,240,341,32))
> >         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
> >         self.buttonBox.setStandardButtons(
> >
> QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialog
> >ButtonBox.Ok )
> >         self.buttonBox.setObjectName("buttonBox")
> >
> >         self.retranslateUi(ImageDialog)
> >         QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL
> ("accepted()"),
> > ImageDialog.accept)
> >         QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL
> ("rejected()"),
> > ImageDialog.reject)
> >         QtCore.QMetaObject.connectSlotsByName(ImageDialog)
> >
> >     def retranslateUi(self, ImageDialog):
> >
> > ImageDialog.setWindowTitle(QtGui.QApplication.translate("ImageDialog",
> > "Dialog", None, QtGui.QApplication.UnicodeUTF8))
>
> Is this the complete application? If so, then yes, it does the same for me
> -
> because you haven't created the QApplication instance, entered the event
> loop
> etc, etc.
>
> Phil
>

[Attachment #5 (text/html)]

Hi and thank a lot for your help,<br><br>You'r right.<br>I forgot these \
lines<br><br>app = QtGui.QApplication(sys.argv)<br>window = \
ImageDialog()<br>window.show()<br>sys.exit(app.exec_())<br><br>But there is another \
problem. The code produced by &quot;designer&quot;  Qt-4.2.1 is not compatible with \
Qt-4.1.4 !! QDialogButtonBox is new in Qt-4.2 !!<br><br>Also, be carefull to comment \
also in ui_imagedialog.py this line<br><br><pre \
class="literal-block">#self.ui.colorDepthCombo.addItem(&quot;2 colors (1 bit per \
pixel)&quot;) <br><br></pre>Bye, Simon.<br><br><br><div><span \
class="gmail_quote">2006/11/11, Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.co.uk">phil@riverbankcomputing.co.uk</a>&gt;:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> On Friday 10 November 2006 3:43 pm, simon stockes \
wrote:<br>&gt; Hi,<br>&gt;<br>&gt; With the pyqtref manual, I try to test base2.py \
(see below the code). But<br>&gt; this one does not produce anything !!<br>&gt; Is it \
the same for you ? <br>&gt;<br>&gt; Simon<br>&gt;<br>&gt; Config : rhel4, pyqt-4.0.1, \
qt4.1.4<br>&gt;<br>&gt;<br>&gt;<br>&gt; Base2.py<br>&gt; =======<br>&gt;<br>&gt; from \
PyQt4 import QtCore, QtGui<br>&gt; from ui_imagedialog import Ui_ImageDialog \
<br>&gt;<br>&gt; class ImageDialog(QtGui.QDialog):<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; \
def __init__(self):<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QtGui.QDialog.__init__(self)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
# Set up the user interface from \
Designer.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.ui = \
Ui_ImageDialog() <br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.ui.setupUi(self)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
# Make some local modifications.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.ui.colorDepthCombo.addItem(&quot;2 colors (1 bit per \
pixel)&quot;)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # \
Connect up the buttons. <br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.connect(self.ui.okButton, \
QtCore.SIGNAL(&quot;clicked()&quot;),<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self, \
QtCore.SLOT(&quot;accept()&quot;))<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.connect(self.ui.cancelButton, QtCore.SIGNAL(&quot;clicked()&quot;), \
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self, \
QtCore.SLOT(&quot;reject()&quot;))<br>&gt;<br>&gt; ui_imagedialog.py<br>&gt; \
=============<br>&gt;<br>&gt; import sys<br>&gt; from PyQt4 import QtCore, \
QtGui<br>&gt;<br>&gt; class Ui_ImageDialog(object): <br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; \
def setupUi(self, ImageDialog):<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
ImageDialog.setObjectName(&quot;ImageDialog&quot;)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
ImageDialog.resize(QtCore.QSize(QtCore.QRect<br>&gt; \
(0,0,420,300).size()).expandedTo(ImageDialog.minimumSizeHint \
()))<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.buttonBox = \
QtGui.QDialogButtonBox(ImageDialog)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.buttonBox.setGeometry(QtCore.QRect(30,240,341,32))<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) \
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.buttonBox.setStandardButtons(<br>&gt; \
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialog<br>&gt;ButtonBox.Ok \
)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.buttonBox.setObjectName(&quot;buttonBox&quot;) \
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.retranslateUi(ImageDialog)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL(&quot;accepted()&quot;),<br>&gt; \
ImageDialog.accept)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QtCore.QObject.connect(self.buttonBox ,QtCore.SIGNAL(&quot;rejected()&quot;),<br>&gt; \
ImageDialog.reject)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QtCore.QMetaObject.connectSlotsByName(ImageDialog)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; \
def retranslateUi(self, ImageDialog):<br>&gt;<br>&gt; ImageDialog.setWindowTitle \
(QtGui.QApplication.translate(&quot;ImageDialog&quot;,<br>&gt; &quot;Dialog&quot;, \
None, QtGui.QApplication.UnicodeUTF8))<br><br>Is this the complete application? If \
so, then yes, it does the same for me -<br>because you haven't created the \
QApplication instance, entered the event loop <br>etc, \
etc.<br><br>Phil<br></blockquote></div><br>



_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic