[PyQt] PyQt4 import module fails second time when running python from Qt-C++ based shell
Hi, I've attached a small Qt project for a Python shell. It also uses QScintilla. It's amazing that I made this in about 5 minutes, thanks Phil! The problem I'm encountering is that I can only correctly import a PyQt4 module once using this shell. If I try to import again then I cannot use classes within the module. The code from PyQt4 import QtCore QtCore.QObject() succeeds the first time it is run. The second time it complains that "AttributeError: 'module' object has no attribute 'QObject'". This does not happen with other modules like sys. The Python execution code uses all temporary variables. At first I thought this was because of a flaw in my C++ code, but the success of loading a non-Qt-based modules piqued my curiosity. Has anyone ever seen something like this? sample.tar.gz Description: application/compressed-tar ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] StyleSheet relative path
On Thursday 05 May 2011, 21:19:50 Hugo Léveillé wrote: > Hi > > Lets say I have a styleheet and an image file in the same folder > > QTextEdit, QListView { > background-color: white; > background-image: url(myImage.png); > background-attachment: scroll; > } > > I expected this to work since they are at the same level but I still > have to type the whole path like so: > > QTextEdit, QListView { > background-color: white; > background-image: url(/path/to/my/file/myImage.png); > background-attachment: scroll; > } > > What would be the correct syntax to make the filename relative to the > stylesheet so that the image will load on any machine no matter the > root path No idea, but have you checked: - QDir.currentPath() - prepending ./ - using Qt's resource system Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] StyleSheet relative path
Hi Lets say I have a styleheet and an image file in the same folder QTextEdit, QListView { background-color: white; background-image: url(myImage.png); background-attachment: scroll; } I expected this to work since they are at the same level but I still have to type the whole path like so: QTextEdit, QListView { background-color: white; background-image: url(/path/to/my/file/myImage.png); background-attachment: scroll; } What would be the correct syntax to make the filename relative to the stylesheet so that the image will load on any machine no matter the root path Thanks -- Hugo Léveillé TD Compositing, Vision Globale hu...@fastmail.net ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP method args default ownership rules
On Wed, 04 May 2011 19:54 +0100, "Phil Thompson" wrote: > On Wed, 04 May 2011 12:47:39 -0500, "Jim Crowell" > wrote: > > > > What are the default assumptions about the ownership of objects passed > > into or returned from SIP-generated methods? > > The ownership of objects passed in is unchanged. The ownership of objects > returned are with C++ unless SIP has already seen the object, in which > case > ownership is unchanged. Thanks Phil. -Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] an unhandled case uiparser.py:createSpacer
On 05/05/11 23:06, Phil Thompson wrote: > Can you send .ui file that demonstrates the problem and here the difference to the .ui file which works: diff SpacerProblem.ui SpacerProblem_fixed.ui 22a23,28 > > > 10 > 10 > > forgot that... Cheers, Achim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] an unhandled case uiparser.py:createSpacer
On 05/05/11 23:06, Phil Thompson wrote: > Which version of PyQt? > PyQt4.QtCore.PYQT_VERSION_STR='4.7.3' PyQt4.QtCore.QT_VERSION_STR='4.6.3' qt designer 4.6.3 Python 2.6.6 both comes comes with debian stable. > Can you send .ui file that demonstrates the problem Here are minimal examples. Cheers, Achim SpacerProblem.py Description: application/text SpacerProblem.ui Description: application/designer ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] a unhandled case uiparser.py:createSpacer
On Thu, 05 May 2011 22:59:53 +1200, Achim Gädke wrote: > Hi there! > > Today I used the qt designer, added some spacers to centre some knobs. > > I wanted to reduce/reset the sizeHint of the spacers, so I pressed the > reset button right of the value field, which resets the sizeHint > property to 0x0, that's perfectly what I want. So I saved the .ui file > and started my application: > > [...] > File "/usr/lib/pymodules/python2.6/PyQt4/uic/uiparser.py", line 308, in > createSpacer > width = int(elem.findtext("property/size/width")) > TypeError: int() argument must be a string or a number, not 'NoneType' > > Setting the sizeHint to 1x1 works fine. - The designer sets by default a > non-zero value. > > The code in createSpacer assumes the presence of width and hight > parameters, which is fatal in this case. > > (I didn't dig into the definition of the .ui file, to see whether its > format requires the presence, at least the qt documentation does not > forbid 0x0 spacer dimensions.) Which version of PyQt? Can you send .ui file that demonstrates the problem? Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] a unhandled case uiparser.py:createSpacer
Hi there! Today I used the qt designer, added some spacers to centre some knobs. I wanted to reduce/reset the sizeHint of the spacers, so I pressed the reset button right of the value field, which resets the sizeHint property to 0x0, that's perfectly what I want. So I saved the .ui file and started my application: [...] File "/usr/lib/pymodules/python2.6/PyQt4/uic/uiparser.py", line 308, in createSpacer width = int(elem.findtext("property/size/width")) TypeError: int() argument must be a string or a number, not 'NoneType' Setting the sizeHint to 1x1 works fine. - The designer sets by default a non-zero value. The code in createSpacer assumes the presence of width and hight parameters, which is fatal in this case. (I didn't dig into the definition of the .ui file, to see whether its format requires the presence, at least the qt documentation does not forbid 0x0 spacer dimensions.) Cheers, Achim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QModelIndex.internalPointer
On Friday 29 April 2011, 09:59:40 Andrei Kopats wrote: > Hi, > > Few days ago QModelIndex.internalPointer was discussed here. > I also have problems with it. I can't say exactly, when crash occurs, > and when it doesn't, but, this code generates crash for me: > > index = self.createIndex(row, column, True) > print index.internalPointer() > > I tried to pass object (which has other references, so, is not > destroyed by gc), integer, bool value as internalPoitner, and have > crashes in any case. I use the latest PyQt and SIP snapshots. You need to provide a minimal runnable example, and describe the procedure to provoke the failure. Don't forget to mention your environment, and paste in python and gdb tracebacks. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt