[PyQt] uic compiler goes wrong
Hi, I'm using a rather old (4.4.3) version of PyQT, but I was wondering if the following issue was solved: I've created a custom component with one property being a QStringList. When I compile this with pyuic4 it generates the following code in one of the python modules: self.gasFlowTestResult.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setPointSize(8) self.gasFlowTestResult.setFont(font) self.gasFlowTestResult.setNames([PyQt4.uic.Compiler.qtproxies.i18n_string object at 0x00D9CD10, PyQt4.uic.Compiler.qtproxies.i18n_string object at 0x00D9CD30, PyQt4.uic.Compiler.qtproxies.i18n_string object at 0x00D9CD70, PyQt4.uic.Compiler.qtproxies.i18n_string object at 0x00D9CDB0, PyQt4.uic.Compiler.qtproxies.i18n_string object at 0x00D9CE10]) Needless to say Python doesn't like this very much. Is this solved in a later version? Regards, Vincent ___ Ing. V. van Beveren Software Engineer, FOM Rijnhuizen T: +31 (0) 30-6096769 E: v.vanbeve...@rijnhuizen.nlmailto:v.vanbeve...@rijnhuizen.nl ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Trouble reading a model index from an untouched combo box
Hi everyone, I'm developing an app which loads data from a database table into a QSqlTableModel. At some point I associate this model to a Combo Box (using QComboBox.setModel). The strange thing is, when I try to read the current model index from the combo box view, for getting the selected item's data from another database field on the same model record, I get a invalid index, but If I just click on the combo box (I don't even have to change the item) before trying to read its index, it returns a valid model index. So, it is really necessary to do something before, like generating a currentIndexChanged signal? What I did was like this: def __init__(self): self.model = QSqlTableModel() self.model.setTable(dbtable) self.model.select() self.comboBox = QComboBox() self.comboBox.setModel(self.model) self.comboBox.setModelColumn(ITEM_NAME) def getItemID(self): index = self.comboBox.view().currentIndex() if not index.isValid(): raise ValueError, invalid index # Here I always get the error if I don't click on the combo box before row = index.row() column = self.model.fieldIndex(ITEM_ID) return self.model.data(self.model.index(row, column)).toInt()[0] Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] SIP build problem with VS2008 Express Edition
Hello, I am trying to build SIP v4.7.9 with VS2008 Express Edition and Python 2.5.4 via the Visual Studio 2008 Command Prompt. When I attempt to run sip.exe from the c:\python25 I get the dreaded R6034 Runtime Error! R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. The odd thing is that sip.exe will run if left in the sip4.7.9\sipgen directory. Has any one come across this? I am trying to build PyQt4.4.4. Side note: I've just attempted to build SIP4.8.2 and SIP 4.10 and now, these works properly. But now when I run configure.py for PyQt4.4.4 I get the following error: sip: sip/QtCore/QtCoremod.sip:73: syntax error Thanks, Darryl ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Trouble reading a model index from an untouched combo box
Hi everyone, I'm developing an app which loads data from a database table into a QSqlTableModel. At some point I associate this model to a Combo Box (using QComboBox.setModel). The strange thing is, when I try to read the current model index from the combo box view, for getting the selected item's data from another database field on the same model record, I get a invalid index, but If I just click on the combo box (I don't even have to change the item) before trying to read its index, it returns a valid model index. So, it is really necessary to do something before, like generating a currentIndexChanged signal? What I did was like this: def __init__(self): self.model = QSqlTableModel() self.model.setTable(dbtable) self.model.select() self.comboBox = QComboBox() self.comboBox.setModel(self.model) self.comboBox.setModelColumn(ITEM_NAME) def getItemID(self): index = self.comboBox.view().currentIndex() if not index.isValid(): raise ValueError, invalid index # Here I always get the error if I don't click on the combo box before row = index.row() column = self.model.fieldIndex(ITEM_ID) return self.model.data(self.model.index(row, column)).toInt()[0] Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP build problem with VS2008 Express Edition
It's very likely that PyQt 4.4.4 uses some deprecated syntax that was removed in SIP 4.8. Are you not able to build using the latest PyQt4 release? Darryl Wallace wrote: Hello, I am trying to build SIP v4.7.9 with VS2008 Express Edition and Python 2.5.4 via the Visual Studio 2008 Command Prompt. When I attempt to run sip.exe from the c:\python25 I get the dreaded R6034 Runtime Error! R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. The odd thing is that sip.exe will run if left in the sip4.7.9\sipgen directory. Has any one come across this? I am trying to build PyQt4.4.4. Side note: I've just attempted to build SIP4.8.2 and SIP 4.10 and now, these works properly. But now when I run configure.py for PyQt4.4.4 I get the following error: sip: sip/QtCore/QtCoremod.sip:73: syntax error Thanks, Darryl ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trouble reading a model index from an untouched combo box
How about selecting index 0 once the combobox is initialized with the database data? It sounds to me that it has no valid index when first initialized, and if you try to programmatically select the first index, it's returning an invalid one. You don't need to generate a signal, just use something like .setCurrentIndex(0). Claudio Felix wrote: Hi everyone, I'm developing an app which loads data from a database table into a QSqlTableModel. At some point I associate this model to a Combo Box (using QComboBox.setModel). The strange thing is, when I try to read the current model index from the combo box view, for getting the selected item's data from another database field on the same model record, I get a invalid index, but If I just click on the combo box (I don't even have to change the item) before trying to read its index, it returns a valid model index. So, it is really necessary to do something before, like generating a currentIndexChanged signal? What I did was like this: def __init__(self): self.model = QSqlTableModel() self.model.setTable(dbtable) self.model.select() self.comboBox = QComboBox() self.comboBox.setModel(self.model) self.comboBox.setModelColumn(ITEM_NAME) def getItemID(self): index = self.comboBox.view().currentIndex() if not index.isValid(): raise ValueError, invalid index # Here I always get the error if I don't click on the combo box before row = index.row() column = self.model.fieldIndex(ITEM_ID) return self.model.data(self.model.index(row, column)).toInt()[0] Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP build problem with VS2008 Express Edition
I am using an existing commercial license and I had locked down the version of my development tools (hence, PyQt4.4.4). I previously used MinGW to build the libraries (both Qt and PyQt) but I am hoping to get some smaller binaries for distribution. You were correct about the deprecated feature. SIP 4.7.x no longer uses %SIPOptions (which is on line 73 of QtCoremod.sip). Regardless, that still doesn't explain the odd behaviour of SIP 4.7.9 w.r.t. error R6034 when built with VS 2008 (especially when 4.8.2 works fine). I can likely find a work/around. So far commenting out the line 73 of QtCoremod.sip allowed it to continue. I haven't had a chance to fully build it yet. Thanks, Darryl On Tue, Jan 26, 2010 at 4:54 PM, Demetrius Cassidy dcassid...@mass.rr.comwrote: It's very likely that PyQt 4.4.4 uses some deprecated syntax that was removed in SIP 4.8. Are you not able to build using the latest PyQt4 release? Darryl Wallace wrote: Hello, I am trying to build SIP v4.7.9 with VS2008 Express Edition and Python 2.5.4 via the Visual Studio 2008 Command Prompt. When I attempt to run sip.exe from the c:\python25 I get the dreaded R6034 Runtime Error! R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. The odd thing is that sip.exe will run if left in the sip4.7.9\sipgen directory. Has any one come across this? I am trying to build PyQt4.4.4. Side note: I've just attempted to build SIP4.8.2 and SIP 4.10 and now, these works properly. But now when I run configure.py for PyQt4.4.4 I get the following error: sip: sip/QtCore/QtCoremod.sip:73: syntax error Thanks, Darryl ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- __ Darryl Wallace: Project Leader ProSensus Inc. McMaster Innovation Park 175 Longwood Road South, Suite 301 Hamilton, Ontario, L8P 0A1 Canada(GMT -05:00) Tel: 1-905-528-9136 Fax: 1-905-546-1372 Web site: http://www.prosensus.ca/ __ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP build problem with VS2008 Express Edition
Itt works fine with VS2008 Professional edition - at least on the latest builds. I'm sorry to say that I've never seen that error, but it sounds more like maybe you need to re-install the latest C++ redist package than a problem with PyQt4. Darryl Wallace wrote: I am using an existing commercial license and I had locked down the version of my development tools (hence, PyQt4.4.4). I previously used MinGW to build the libraries (both Qt and PyQt) but I am hoping to get some smaller binaries for distribution. You were correct about the deprecated feature. SIP 4.7.x no longer uses %SIPOptions (which is on line 73 of QtCoremod.sip). Regardless, that still doesn't explain the odd behaviour of SIP 4.7.9 w.r.t. error R6034 when built with VS 2008 (especially when 4.8.2 works fine). I can likely find a work/around. So far commenting out the line 73 of QtCoremod.sip allowed it to continue. I haven't had a chance to fully build it yet. Thanks, Darryl On Tue, Jan 26, 2010 at 4:54 PM, Demetrius Cassidy dcassid...@mass.rr.com mailto:dcassid...@mass.rr.com wrote: It's very likely that PyQt 4.4.4 uses some deprecated syntax that was removed in SIP 4.8. Are you not able to build using the latest PyQt4 release? Darryl Wallace wrote: Hello, I am trying to build SIP v4.7.9 with VS2008 Express Edition and Python 2.5.4 via the Visual Studio 2008 Command Prompt. When I attempt to run sip.exe from the c:\python25 I get the dreaded R6034 Runtime Error! R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. The odd thing is that sip.exe will run if left in the sip4.7.9\sipgen directory. Has any one come across this? I am trying to build PyQt4.4.4. Side note: I've just attempted to build SIP4.8.2 and SIP 4.10 and now, these works properly. But now when I run configure.py for PyQt4.4.4 I get the following error: sip: sip/QtCore/QtCoremod.sip:73: syntax error Thanks, Darryl ___ PyQt mailing listPyQt@riverbankcomputing.com mailto:PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- __ Darryl Wallace: Project Leader ProSensus Inc. McMaster Innovation Park 175 Longwood Road South, Suite 301 Hamilton, Ontario, L8P 0A1 Canada(GMT -05:00) Tel: 1-905-528-9136 Fax: 1-905-546-1372 Web site: http://www.prosensus.ca/ __ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trouble reading a model index from an untouched combo box
2010/1/26 Demetrius Cassidy dcassid...@mass.rr.com: How about selecting index 0 once the combobox is initialized with the database data? It sounds to me that it has no valid index when first initialized, and if you try to programmatically select the first index, it's returning an invalid one. You don't need to generate a signal, just use something like .setCurrentIndex(0). Thanks for the answer Demetrius. Unfortunately, it didn't change it. Maybe I do have to use a QDataWidgetMapper on the combo box? I thought just getting the model associated with it should do it.. it shows all the models' values indeed... Cheers... ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trouble reading a model index from an untouched combo box
I don't think you need to use the view pointer at all - it's returning QAbstractItemView *, which I would assume it would need to be casted to the proper class in C++. If that's so, by design the Abstract class will return an invalid index. Try to use self.comboBox.currentIndex() instead - it returns -1 if theres no selected index (which there won't be when you first set the model until you manually or programatically select one) http://doc.trolltech.com/4.6/qcombobox.html#currentIndex-prop Claudio Felix wrote: 2010/1/26 Demetrius Cassidy dcassid...@mass.rr.com: How about selecting index 0 once the combobox is initialized with the database data? It sounds to me that it has no valid index when first initialized, and if you try to programmatically select the first index, it's returning an invalid one. You don't need to generate a signal, just use something like .setCurrentIndex(0). Thanks for the answer Demetrius. Unfortunately, it didn't change it. Maybe I do have to use a QDataWidgetMapper on the combo box? I thought just getting the model associated with it should do it.. it shows all the models' values indeed... Cheers... ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Simple connect error
class Main(QGraphicsView): def __init__(self, useGL=False, parent=None): pass @pyqtSlot() def screenFinished(self): print Main.screenFinished class Screen(QObject): finished = pyqtSignal() def __init__(self, instanceName, main): QObject.__init__(self) self.main.screenFinished.connect(self.finished) gives me the error: self.main.screenFinished.connect(self.finished) AttributeError: 'Main' object has no attribute 'screenFinished' What am I doing wrong? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trouble reading a model index from an untouched combo box
On 26.01.10 17:41:40, Demetrius Cassidy wrote: I don't think you need to use the view pointer at all - it's returning QAbstractItemView *, which I would assume it would need to be casted to the proper class in C++. If that's so, by design the Abstract class will return an invalid index. I don't think so ;) The function currentIndex on the view is not virtual, so its implemented in the abstract class already properly. And to get a model index to index into the model its easier to ask the view for it, rather than constructing it yourself with model-index( combobox-currentIndex(), model-column, QModelIndex()) Andreas -- You dialed 5483. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple connect error
On 26.01.10 22:05:41, Jason H wrote: class Main(QGraphicsView): def __init__(self, useGL=False, parent=None): pass @pyqtSlot() def screenFinished(self): print Main.screenFinished class Screen(QObject): finished = pyqtSignal() def __init__(self, instanceName, main): QObject.__init__(self) self.main.screenFinished.connect(self.finished) gives me the error: self.main.screenFinished.connect(self.finished) AttributeError: 'Main' object has no attribute 'screenFinished' I'm not too familiar with the new signal/slot mechanism, but a short read on the docs suggests that your connect is in the wrong order. Its usually bound-signal.connect(slot) and you've got it the other way around. Andreas -- Your analyst has you mixed up with another patient. Don't believe a thing he tells you. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple connect error
- Original Message From: Andreas Pakulat ap...@gmx.de To: pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:17:48 AM Subject: Re: [PyQt] Simple connect error On 26.01.10 22:05:41, Jason H wrote: class Main(QGraphicsView): def __init__(self, useGL=False, parent=None): pass @pyqtSlot() def screenFinished(self): print Main.screenFinished class Screen(QObject): finished = pyqtSignal() def __init__(self, instanceName, main): QObject.__init__(self) self.main.screenFinished.connect(self.finished) gives me the error: self.main.screenFinished.connect(self.finished) AttributeError: 'Main' object has no attribute 'screenFinished' I'm not too familiar with the new signal/slot mechanism, but a short read on the docs suggests that your connect is in the wrong order. Its usually bound-signal.connect(slot) and you've got it the other way around. -- Well the Screen object emits finished and I want to connect that to the main's screenFinished slot. self.main.screenfinished is the slot, the self.finished is emitted by the screen class. If I reverse it: self.finished.connect(self.main.screenFinished) I still get the error. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Simple connect error
**facepalm** I had a locally defined class that we overriding it. It was missing the slot. - Original Message From: Jason H scorp...@yahoo.com To: Andreas Pakulat ap...@gmx.de; pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:22:51 AM Subject: Re: [PyQt] Simple connect error - Original Message From: Andreas Pakulat ap...@gmx.de To: pyqt@riverbankcomputing.com Sent: Wed, January 27, 2010 1:17:48 AM Subject: Re: [PyQt] Simple connect error On 26.01.10 22:05:41, Jason H wrote: class Main(QGraphicsView): def __init__(self, useGL=False, parent=None): pass @pyqtSlot() def screenFinished(self): print Main.screenFinished class Screen(QObject): finished = pyqtSignal() def __init__(self, instanceName, main): QObject.__init__(self) self.main.screenFinished.connect(self.finished) gives me the error: self.main.screenFinished.connect(self.finished) AttributeError: 'Main' object has no attribute 'screenFinished' I'm not too familiar with the new signal/slot mechanism, but a short read on the docs suggests that your connect is in the wrong order. Its usually bound-signal.connect(slot) and you've got it the other way around. -- Well the Screen object emits finished and I want to connect that to the main's screenFinished slot. self.main.screenfinished is the slot, the self.finished is emitted by the screen class. If I reverse it: self.finished.connect(self.main.screenFinished) I still get the error. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt