Re: [PyQt] How can i update QSqlRelationalTableModel
On 11/08/12 11:14, engdarkman89 wrote: > Thanks for taking the time to replay. > > I tried to call myRelationalTableModel.relationModel(columnIndex).select() > after saving changes to table A, but it doesn't solve the problem. > > Any thoughts. > > I have found the problem and a workaround http://lists.qt.nokia.com/pipermail/qt-interest/2010-May/023832.html i have any sql classes constructed above QSqlQueryModel to get more functionality that QSqlRelationalTableModel brings but i though that was the way to update the internal model, sorry. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] How can i update QSqlRelationalTableModel
On 10/08/12 23:43, engdarkman89 wrote: > Hi, > > I will try to explain the problem with the following scenario: > > Suppose we have two tables A and B, table B has a Foreign key column from A > and we applied QSqlRelation to that column, now we insert/update a row in > table A. > The problem is that the QSqlRelation still see the old A table, how can i > update the relation.? > > Appreciate any kind of help. > > > Hi, you need to call relational_model.relationModel(column).select(), this update the internal QSqlTableModel that .setRelation() creates. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] returning SQL result as ordinary python string?
El 03/05/12 16:02, Andrew Suffield escribió: > On Thu, May 03, 2012 at 08:15:26AM -0400, Mark Mordeca wrote: >> while(query.next()): >> >> idString=str(query.value(0).toString()) >> >> passwordString=str(query.value(1).toString()) >> >> >> >> query.value() returns a QVariant, so you use .toString() to convert it to >> a QString, then use str to convert the QString to a python string. > > One step less, and more sensible behaviour: > > query.value(0).toPyObject() > > It'll come out as the python native type for the variant, so QString > goes to unicode, etc. Also works for random python classes that > QVariant doesn't know about. > > (This should be better documented) > ___ I think that this is only True if you are using sip.setapi("QString", 2) if you are using api 1 you get this: In [2]: QVariant("test").toPyObject() Out[2]: PyQt4.QtCore.QString(u'test') So you need to explicit conversion to unicode anyway. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Always show a QLineEdit as QItemDelegate
El 27/04/12 00:12, Jake Richards escribió: > Hello: > I've got a QTreeView that uses a QLineEdit as a QItemDelegate for one of > it's > columns. The problem is that I want to display the QLineEdit all the time, > not > just when the user double clicks and starts editing. Am I using the wrong > approach to accomplish this? I was using a QTreeWidget with setItemWidget but > the docs said that I should only do that if I'm using static data, so I'm > attempting to use the delegates. Thank you for any help! > Hello, if you want to do this from a delegate, and you should if your view has many items because a complete widget it is much heavier, you should paint the widget, much like Qt do, in the paint method of the delegate, using QApplication.style().drawControl(), in this thread you have an example http://www.qtcentre.org/threads/18959-QWidget-in-tableview Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt bug with Qt 4.8.0?
I have read right now the versions you tested, the problem appeared for me after upgrade to Qt 4.8.0 El 02/01/12 15:01, Mailing List SVR escribió: > Il 02/01/2012 13:03, Linos ha scritto: >> thanks for test it. >> >> have you tried scrolling the table? i get strange visual problems with the >> vertical header when i scroll the table. > > yes I tryed and no strange visual effect here with both c++ and python > version, > both seems good, > > Nicola > >> >> Regards, >> Miguel Angel. >> >> El 02/01/12 10:44, Mailing List SVR escribió: >>> Il 31/12/2011 16:01, Linos ha scritto: >>>> has anyone tried this? >>> for me the cpp example is identical to the python one (qt 4.7.4, pyqt 4.8.5, >>> ubuntu oneiric packages) >>> >>> Nicola >>> >>>> El 28/12/11 18:16, Linos escribió: >>>>> Hi, >>>>> after Qt upgrade to 4.8.0 in my machine i have been getting problems >>>>> with >>>>> the >>>>> painting of vertical headers in QTableViews with a QSqlQueryModel that >>>>> refresh >>>>> on event (for example after tab change). >>>>> >>>>> I have created a testcase because i wanted to report the bug to Qt bug >>>>> tracker >>>>> but i can't reproduce it in c++ so i have created a testcase in python >>>>> with >>>>> the >>>>> problem and the equivalent code in c++ that not reproduces the problem, >>>>> maybe i >>>>> am missing something but it seems like a but in PyQt? >>>>> >>>>> I am using now PyQt 4.9 but i had this problem with the previous PyQt >>>>> version as >>>>> well, i am using arch x86_64 and python2.7 >>>>> >>>>> Regards, >>>>> Miguel Angel. >>>>> >>>>> >>>>> >>>>> ___ >>>>> 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 mailing listPyQt@riverbankcomputing.com >>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> ___ >> 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 mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt bug with Qt 4.8.0?
thanks for test it. have you tried scrolling the table? i get strange visual problems with the vertical header when i scroll the table. Regards, Miguel Angel. El 02/01/12 10:44, Mailing List SVR escribió: > Il 31/12/2011 16:01, Linos ha scritto: >> has anyone tried this? > > for me the cpp example is identical to the python one (qt 4.7.4, pyqt 4.8.5, > ubuntu oneiric packages) > > Nicola > >> >> El 28/12/11 18:16, Linos escribió: >>> Hi, >>> after Qt upgrade to 4.8.0 in my machine i have been getting problems >>> with >>> the >>> painting of vertical headers in QTableViews with a QSqlQueryModel that >>> refresh >>> on event (for example after tab change). >>> >>> I have created a testcase because i wanted to report the bug to Qt bug >>> tracker >>> but i can't reproduce it in c++ so i have created a testcase in python with >>> the >>> problem and the equivalent code in c++ that not reproduces the problem, >>> maybe i >>> am missing something but it seems like a but in PyQt? >>> >>> I am using now PyQt 4.9 but i had this problem with the previous PyQt >>> version as >>> well, i am using arch x86_64 and python2.7 >>> >>> Regards, >>> Miguel Angel. >>> >>> >>> >>> ___ >>> 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 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] PyQt bug with Qt 4.8.0?
has anyone tried this? El 28/12/11 18:16, Linos escribió: > Hi, > after Qt upgrade to 4.8.0 in my machine i have been getting problems > with the > painting of vertical headers in QTableViews with a QSqlQueryModel that refresh > on event (for example after tab change). > > I have created a testcase because i wanted to report the bug to Qt bug tracker > but i can't reproduce it in c++ so i have created a testcase in python with > the > problem and the equivalent code in c++ that not reproduces the problem, maybe > i > am missing something but it seems like a but in PyQt? > > I am using now PyQt 4.9 but i had this problem with the previous PyQt version > as > well, i am using arch x86_64 and python2.7 > > Regards, > Miguel Angel. > > > > ___ > 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] PyQt bug with Qt 4.8.0?
Hi, after Qt upgrade to 4.8.0 in my machine i have been getting problems with the painting of vertical headers in QTableViews with a QSqlQueryModel that refresh on event (for example after tab change). I have created a testcase because i wanted to report the bug to Qt bug tracker but i can't reproduce it in c++ so i have created a testcase in python with the problem and the equivalent code in c++ that not reproduces the problem, maybe i am missing something but it seems like a but in PyQt? I am using now PyQt 4.9 but i had this problem with the previous PyQt version as well, i am using arch x86_64 and python2.7 Regards, Miguel Angel. testcase.rar Description: application/rar ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QTableView with summary footer
Hi, i am trying to create a QTableView subclass that allows me to show a QHeaderView inside the viewport (above the horizontal scrollbar) with summary data of the columns of the model, but i am getting a difficult time getting this to work, anyone have created something like this and can point me in the correct direction please? Thanks. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] SIP first use questions
Hi, i am trying to do my first library wrapper to the libfprint c lib (http://www.freedesktop.org/wiki/Software/fprint/libfprint) using SIP, i have any doubts, sorry if any or all of them are pretty obvious but i develop nearly ever on python, a bit on Qt C++ so all of this it is a bit strange for me. 1- How should i wrap this function from fprint.h? struct fp_dscv_print **fp_discover_prints(); I get this info from sip "sip: fp_discover_devs() unsupported function return type - provide %MethodCode and a C signature" I have read in the documentation the examples about %AccessCode and %MethodCode but i don't understand how to use here. 2- How should i wrap a static inline function defined in fprint.h like this: static inline int fp_enroll_finger(struct fp_dev *dev, struct fp_print_data **print_data) { return fp_enroll_finger_img(dev, print_data, NULL); } 3- i had to define all the include dirs manually with: makefile.extra_include_dirs = ["/tmp/libfprint-0.4.0", "/tmp/libfprint-0.4.0/libfprint", "/usr/include/glib-1.2", "/usr/lib/glib/include", "/usr/include/libusb-1.0"] I am pretty sure that should be a much better way to do this but i can't find how. Thanks, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt Contributors Summit
What's wanted is the ability to replace QML/JavaScript with something that calls the same public C++ API that QML/JavaScript does. I don't have a problem if, at this stage, it isn't possible to define that API, and I am more than happy to contribute to the development of Qt5 to make sure it is suitable for Python/Python. I do have a problem if, by the time Qt5 is released, that API hasn't been properly designed and documented. If that is too "difficult" then QML2 is being rushed - just like QML1 was. Phil Hi Phil, there was an interesting thread in qt5-feedback mailing list about the c++ api to QML, you can read it here http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-May/000162.html and maybe you could join this mailing-list and start discussing how this api should be, the people at Nokia are joining the threads and listening the developers i think (or replying them almost). Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt Contributors Summit
El 08/06/11 11:50, Erik Janssens escribió: Hello Phil, good to hear you're going to the contributors summit, here are my main concerns (pretty much in line with the other responses) : - the OpenGL requirement : will this still work decent through remote desktop and citrix. imho this is important for business applications. - QML / Qt Components : having played a bit with it, I certainly see its value, BUT, I'm afraid of having certain functionality not available through C++ and hence not through PyQt. (like assembling QML scene). for PyQt applications, I see little to no value in writing a part of the app in Javascript/QML, on the contrary, it would increase complexity. After all we have been writing our gui in a dynamic language for years now. - I'm fine with deprecating certain parts of the api, to stay lean and maintainable Good luck and best regards, Erik Hello all, i have the exact same concerns that Erik. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDateEdit is ignoring the sip API level 2
El 07/06/11 13:07, Phil Thompson escribió: On Tue, 7 Jun 2011 11:46:08 +0100, Daniele Esposti wrote: Well, datetime package doesn't support operations with QDate instances, for example QDateEdit().date() + datetime.timedelta(days=1) raises a TypeError. Just use... QDateEdit().date().toPyDate() + datetime.timedelta() IMHO it's more clear to return a datetime instance instead a Qt one, like the QLineEdit.tex() method returns a unicode string instead of a QString if the sip API level for QString is set to 2. Again, IMHO. I felt that QDate and QTime were too useful to remove. Phil I felt the same way that Phil, they are useful clases on their own, i much prefer working with them that with datetime. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Proposal for QPyNullVariant
El 04/01/11 14:08, Phil Thompson escribió: The problem... v2 of the QVariant API (the default for Python v3) eliminates QVariant as a Python type. Python objects are converted to and from C++ QVariants automatically as and when required. An invalid C++ QVariant is converted to and from None. The problem is that there is currently no way to represent a null C++ QVariant as a Python object. This is particularly an issue when using the Qt SQL classes. The proposed solution... A new Python type, QPyNullVariant, will be implemented (as a mapped type) which will automatically be converted to and from a null C++ QVariant. Its __init__ method will take a single argument that is either a Python type object or a string describing a C++ type. It will have type(), typeName() and userType() methods that will delegate to the QVariant's method of the same name. It will have a isNull() method that always returns True. When converting a C++ QVariant to a Python object a null QVariant will be converted to a QPyNullVariant unless the type of the data in the QVariant has an isNull() method. The exception to this rule is a null QString which, even though it has an isNull() method, will be converted to a QPyNullVariant. (The reason for the exception is because - for very good reasons - PyQt converts a null QString to an empty unicode/str object.) This conversion rule means that existing code that populates models will continue to work. For example, when a null QDate is added to a model, it will still be read as a null QDate. It also means that the object retrieved from an SQL model should always have an isNull() method that returns the correct value. The rule introduces an incompatibility for models that may be populated from C++, typically SQL data. For example a null value in an int column of an SQL table will now be returned as a QPyNullVariant rather than an integer with the value 0. This compatibility is considered acceptable, because the current implementation is arguably broken anyway, and will be addressed by a "potential incompatibilities" section in the documentation. (The alternative would be to introduce v3 of the QVariant API.) Comments welcome... Phil I think it is a good fix for the problem working with QtSql using QVariant API v2. Thanks. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt API 2: equivalent of Null QVariant?
El 22/12/10 12:22, Phil Thompson escribió: On Wed, 22 Dec 2010 11:56:20 +0100, "Hans-Peter Jansen" wrote: On Wednesday 22 December 2010, 07:00:01 Phil Thompson wrote: On Wed, 22 Dec 2010 01:33:49 +0100, "Hans-Peter Jansen" wrote: On Tuesday 21 December 2010, 23:58:39 Erik Janssens wrote: you could just access sql through python instead of through qt, NULL would then correspond to None ...by the price of renouncing QtSql neck and crop. That's a high price to pay, isn't it? Sure, Camelot does this, but I really appreciate displaying tables with a million records with a few lines of code without any worry (thanks to Qt's decent fetch mechanics under the model/view covers). On Tue, 2010-12-21 at 23:52 +0100, TP wrote: Phil Thompson wrote: API v1 will be supported until PyQt5 or Python v4. Is it contractual? Why Python v4? It seems to me that nobody knows when Python v4 will appear. It's contractual in the sense that I commit (to you lot) not to break compatibility during the lifetime of currently available major versions of PyQt and Python. Anyway, it seems to be a problem that API2 does not support NULL, even if it corresponds to side cases (as mine). This is unfortunate, since sacrificing API 2 QVariants is a long ranging decision to better make _early_ on - changing it lately in a project will cause headaches, guaranteed (apart from the unpythonic annoyance, that let to inventing it in the first place). The question is, what would be the prize of getting away from that asymmetry? PyQt would always return None for QString::Null QString::null QVariants(), which cannot appended to, etc.. Anything else with significance? How about an QVariant API 3 with this behavior? There are two issues, QVariant and QString. I don't believe the QVariant issue is a significant one as it easy to work around and (arguably) the workaround forces you to write code that is easier to understand. The asymmetric behaviour of the v2 conversion between a null QString and a Python unicode/string object is more of a problem as it makes it impossible to distinguish a database NULL value from an empty string. The root cause of this is the fact that QString() creates a null QString rather than an non-null empty QString - and there is not a lot I can do about that. What about a QString API 3 variant that returns None, if it encounters QString::null values? This would correspond to Pythons expliciteness nicely, doesn't it? The only adverse effect, I can think of, is not being able to use None as a string, eg. appending something to None isn't possible, while this is (sadly) possible with Qt and uninitialized QStrings (aka QString::null). #include int main(int argc, char * argv[]) { // inconsistent Qt API behavior: // Qt should distinguish between QString::null and QString("") QString s; // = QString::null; s.append("test"); qWarning()<< "main:<"<< s<< ">"; return 0; } That's exactly why v3 would be a bad idea. You would have to explicitly test for None in many cases just because Qt returned QString() instead of QString(""). I would be more receptive to introducing a new type (eg. QPyNullVariant) to the QVariant v2 API that wrapped a null QVariant. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt I think this should be done, it is crucial to work with databases through qt to correctly identify null values. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt API 2: equivalent of Null QVariant?
El 22/12/10 07:00, Phil Thompson escribió: On Wed, 22 Dec 2010 01:33:49 +0100, "Hans-Peter Jansen" wrote: On Tuesday 21 December 2010, 23:58:39 Erik Janssens wrote: you could just access sql through python instead of through qt, NULL would then correspond to None ...by the price of renouncing QtSql neck and crop. That's a high price to pay, isn't it? Sure, Camelot does this, but I really appreciate displaying tables with a million records with a few lines of code without any worry (thanks to Qt's decent fetch mechanics under the model/view covers). On Tue, 2010-12-21 at 23:52 +0100, TP wrote: Phil Thompson wrote: API v1 will be supported until PyQt5 or Python v4. Is it contractual? Why Python v4? It seems to me that nobody knows when Python v4 will appear. It's contractual in the sense that I commit (to you lot) not to break compatibility during the lifetime of currently available major versions of PyQt and Python. Anyway, it seems to be a problem that API2 does not support NULL, even if it corresponds to side cases (as mine). This is unfortunate, since sacrificing API 2 QVariants is a long ranging decision to better make _early_ on - changing it lately in a project will cause headaches, guaranteed (apart from the unpythonic annoyance, that let to inventing it in the first place). The question is, what would be the prize of getting away from that asymmetry? PyQt would always return None for QString::Null QVariants(), which cannot appended to, etc.. Anything else with significance? How about an QVariant API 3 with this behavior? There are two issues, QVariant and QString. I don't believe the QVariant issue is a significant one as it easy to work around and (arguably) the workaround forces you to write code that is easier to understand. The asymmetric behaviour of the v2 conversion between a null QString and a Python unicode/string object is more of a problem as it makes it impossible to distinguish a database NULL value from an empty string. The root cause of this is the fact that QString() creates a null QString rather than an non-null empty QString - and there is not a lot I can do about that. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Hi, i am still using v1 api but, if i am understanding correctly, i will be forever, i have created any models and helpers with QtSql to work with databases that uses extensively the .isNull() feature of QVariant to know what to update and when, and not only with string columns. I have less problem with QString as an empty unicode object because i use in the same way getting null than empty string. I think that be pythonic it is overrated in the context of binding of libraries of other languages. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: PyQt v4.8.1 Released
Hello Phil, i have a problem with this version and a QFormLayout, this code in the .ui file: 80 0 AVISO MIN ROTACION: avisoMinimaRotacionSpinBox ends like this in the generated file: self.avisoMinimaRotacionSpinBox = QtGui.QSpinBox(self.datos_generales_tab) self.avisoMinimaRotacionSpinBox.setMinimumSize(QtCore.QSize(80, 0)) self.avisoMinimaRotacionSpinBox.setObjectName(_fromUtf8("avisoMinimaRotacionSpinBox")) self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.avisoMinimaRotacionSpinBox) self.avisoMinimaRotacionLabel = QtGui.QLabel(self.datos_generales_tab) self.avisoMinimaRotacionLabel.setObjectName(_fromUtf8("avisoMinimaRotacionLabel")) self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.avisoMinimaRotacionLabel) self.avisoMaximaRotacionLabel = QtGui.QLabel(self.datos_generales_tab) should be the reverse obviously, the .ui file it is rendered correctly in QT Designer, could this be other pyuic bug? Regards, Miguel Angel. El 30/10/10 13:47, Phil Thompson escribió: PyQt v4.8.1 has been released and is available from the usual place. This is just a minor bug-fix release that fixes the pyuic4 regression introduced in v4.8. Phil ___ 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] could this be a PyQt problem or it is Qt behavior change?
Hello, i have a QTableView with a QSortFilterProxyModel using a QSqlQueryModel as source, in Qt 4.5 i execute after the query has populated the data of the table resizeColumnsToContents() or resizeColumnToContent(int) and it get adjusted to the column contents but in Qt 4.6 if i have not reimplemented the sizeHint method in the delegate and i use the default QStyledItemDelegate.sizeHint method the col get not resized correctly, you can see an example here: http://img819.imageshack.us/img819/804/examplet.png I have printed to console the output of the sizehint of the delegate for the first visible col "SERIE" and row 0 and i get QSize(31, 15) in QT 4.6 and QSize(31, 16) in QT 4.5 but when i print the size of the section from the horizontal QHeaderView after the resize of the col i get 73 in Qt 4.6 and 46 in Qt 4.5, this col it is ever of three chars in all the rows of the model, the same three chars, so i don't understand why happens this difference, can anyone help me with this? Thanks. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqt behavior change
Ok, i have been using this format because it is more compact and a bit faster but i will change my code, any other qt classes that have added lately a __len__() method? From what version can i account this changes? Thanks for the info. Regards, Miguel Angel. El 01/08/10 23:34, Phil Thompson escribió: On Sun, 01 Aug 2010 19:49:11 +0200, Linos wrote: Hello, i don't know if this is a bug or an intended behavior but i am using in my machine Arch Linux pyqt 4.7.4 with sip 4.10.5 and in older versions the behavior was: combo = QComboBox() if combo: print "exists" else: print "is none" would print "exists" and now it prints "is none", i suppose it is a bug because the same test with QLabel still print "exists", i have not tested other classes though. It's a side effect of an intended change that is triggering a bug in your code. QComboBox() now has a __len__() method which changes the behaviour of "if combo". If you want to test for None then you should always do so explicitly... if combo is None: print "is none" else: print "exists" Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyqt behavior change
Hello, i don't know if this is a bug or an intended behavior but i am using in my machine Arch Linux pyqt 4.7.4 with sip 4.10.5 and in older versions the behavior was: combo = QComboBox() if combo: print "exists" else: print "is none" would print "exists" and now it prints "is none", i suppose it is a bug because the same test with QLabel still print "exists", i have not tested other classes though. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QPushButton embeded in QTableView (like forever)
Hi, if you want to use real widget all the time you can use QAbstractItemView.setIndexWidget but when you have many rows this is a performance problem, the usual method it is emulate the widget with QStyle.drawControl in the paint method of the delegate and load the real widget when editrole is active (like you have done), you can see here an example: www.qtcentre.org/threads/26916-inserting-custom-Widget-to-listview and you have many others of the same in the same forum, just search for drawControl. Regards, Miguel Angel. El 26/04/10 07:03, AON LAZIO escribió: Hi, We know how we can use delegate to create a button in QTableView right? So it's like when the user double-click at an index in the table, the button will pop up and when the user click elsewhere, it won't be a push button anymore. Now my question is how to make a QPushButton stay there in QTableView forever (no double click), so the user can click at it anytime. Thanks -- Passion is my style ___ 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] Re: problem with QAbstractItemModel
Vicent Mas escribió: On 2009-11-06 Baz Walter said: ... your implementation of QAbstractItemModel.index is going to get called *a lot* and in many unforseen ways. Yes, but it is a general fact, not something that happens to my particular implementation, right? i think a more sane implementation would be something like this: def index(self, row, column, parent): if self.hasIndex(row, column, parent): branch = self.nodeFromIndex(parent) return self.createIndex(row, column, branch.childAtRow(row)) return QModelIndex() this fixes your immediate bug, and will probably avoid many others. I know that my implementation is very rough, but it is intended just for testing purposes. Of course your workaround and other similar (like the one sent by Linos) fixes the problem, but they leave the main question unanswered: why wrong row values are passed to the index method? Is it expected? If it is developers are forced to include good sanity code in their index method implementation (as you and Linos did), but I've not seen any reference to this in the Qt documentation. IMHO the Qt model implementation should not allow wrong row values to be passed to the index method. In fact, the example in the 'Editable Tree Model Example' section of the Qt documentation doesn't check at all the validity of the row argument passed to the index method implementation. On the other hand the fact that my script works fine with some Qt/PyQt versions but fails with recent versions seems to indicate that there is a bug either in the Qt implemention of models or in that PyQt versions. Vicent PS: Baz, thanks for your code snippet :: Share what you know, learn what you don't Hi, in the qt examples from qt 4.5 documentation you can see they use this in the model: http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treemodel-cpp.html QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const { if (!hasIndex(row, column, parent)) return QModelIndex(); TreeItem *parentItem; if (!parent.isValid()) parentItem = rootItem; else parentItem = static_cast(parent.internalPointer()); TreeItem *childItem = parentItem->child(row); if (childItem) return createIndex(row, column, childItem); else return QModelIndex(); } and this in the item class. http://doc.trolltech.com/4.5/itemviews-simpletreemodel-treeitem-cpp.html TreeItem *TreeItem::child(int row) { return childItems.value(row); } but they can do this because QList .value method dont get an error if it is out of bounds. http://doc.trolltech.com/4.5/qlist.html#value T QList::value ( int i ) const Returns the value at index position i in the list. If the index i is out of bounds, the function returns a default-constructed value. If you are certain that the index is going to be within bounds, you can use at() instead, which is slightly faster. I am using this same strategy but like i am using python list i check before if i can return the children, you can use a "try except" too. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] problem with pyqt 4.6
Phil Thompson escribió: On Fri, 16 Oct 2009 16:27:00 +0200, Linos wrote: i dont know if this is a bug or a change in behaviour but keyPressEvent dont catch the keyboard events in my QWidget or QDialog subclasses. In the example added with PyQt 4.4 you can press any key and get his int code printed but with last snapshot it never prints anything. - CODE # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class TestWidget(QWidget): def __init__(self, parent): super(TestWidget, self).__init__() self.button = QPushButton("test") layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) def keyPressEvent(self, event): print event.key() def main(): app = QApplication(sys.argv) widget = TestWidget(None) widget.show() return app.exec_() if __name__ == "__main__": main() Works fine for me. Phil Yes you have reason i have downloaded, compiled and installed the snapshots sip-4.9.1-snapshot-20091015.tar.gz and PyQt-x11-gpl-4.6.1-snapshot-20091014.tar.gz and now it works, i had installed the old snapshots sip-4.9.1-snapshot-20091010 and PyQt-x11-gpl-4.6.1-snapshot-20091009 before, thanks. Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] problem with pyqt 4.6
i dont know if this is a bug or a change in behaviour but keyPressEvent dont catch the keyboard events in my QWidget or QDialog subclasses. In the example added with PyQt 4.4 you can press any key and get his int code printed but with last snapshot it never prints anything. - CODE # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class TestWidget(QWidget): def __init__(self, parent): super(TestWidget, self).__init__() self.button = QPushButton("test") layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) def keyPressEvent(self, event): print event.key() def main(): app = QApplication(sys.argv) widget = TestWidget(None) widget.show() return app.exec_() if __name__ == "__main__": main() - ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] new problem pyqt 4.6
Hello Phil, i have detected other problem with clases inheriting from a abstract qt subclass and a python subclass. Here you have sample code. it gives me this error when i click the button. TypeError: QAbstractItemModel.rowCount() is abstract and cannot be called as an unbound method CODE # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class TestPythonClass(object): def __init__(self): pass def rowCount(self): return 1 class TestSubClass(QAbstractTableModel, TestPythonClass): def __init__(self, parent): super(TestSubClass, self).__init__() TestPythonClass.__init__(self) class TestWidget(QWidget): def __init__(self, parent): super(TestWidget, self).__init__() self.model = TestSubClass(self) self.button = QPushButton("test") self.connect(self.button, SIGNAL("clicked()"), self.model.rowCount) layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) def main(): app = QApplication(sys.argv) widget = TestWidget(None) widget.show() return app.exec_() if __name__ == "__main__": main() CODE ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] other problem pyqt 4.6
and other code sample as well, if i execute this code i get this error for every connect i try to do in the QThread run() method. QObject: Cannot create children for a parent that is in a different thread. (Parent is TestThread(0x99e09b8), parent's thread is QThread(0x98e60f0), current thread is TestThread(0x99e09b8) CODE # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtSql import * class TestWidget(QWidget): def __init__(self, parent): super(TestWidget, self).__init__() self.setMaximumSize(300, 200) class TestThread(QThread): def __init__(self, parent=None): super(TestThread, self).__init__(parent) self.worker = None def run(self): self.worker = WorkerTest() self.connect(self.worker, SIGNAL("testSignal"), self, SIGNAL("testSignal")) self.exec_() class WorkerTest(QObject): def __init__(self, parent=None): super(WorkerTest, self).__init__(parent) def main(): app = QApplication(sys.argv) widget = TestWidget(None) testThread = TestThread() testThread.start() widget.show() return app.exec_() if __name__ == "__main__": main() CODE I had no problems with this code and the last mail one with pyqt 4.4.4 (but maybe the problem is i am doing it incorrectly and the problem was in pyqt 4.4.4). Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyqt 4.6 error
Hello, i have updated versions to sip 4.9 and pyqt 4.6 and finally i have some time to make reproducible examples of the errors i posted to the mailing list some time ago, this code gives me on my machine (Arch Linux, qt 4.5.2, sip 4.9, pyqt 4.6 and python 2.6.3) this error when i push the button: Traceback (most recent call last): File "error_emit.py", line 18, in testEmit self.emit(SIGNAL("cambiaFoto(QVariant, QVariant)"), QVariant(), QVariant()) TypeError: argument 0 of signal PyQtProxy.ambiaFoto(QVariant,QVariant) has an invalid type ---CODE # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class TestPythonClass(object): def __init__(self): pass class TestSubClass(QAbstractTableModel, TestPythonClass): def __init__(self, parent): super(TestSubClass, self).__init__() TestPythonClass.__init__(self) self.testEmit() def testEmit(self): self.emit(SIGNAL("cambiaFoto(QVariant, QVariant)"), QVariant(), QVariant()) class TestWidget(QWidget): def __init__(self, parent): super(TestWidget, self).__init__() self.model = TestSubClass(self) self.connect(self.model, SIGNAL("cambiaFoto(QVariant, QVariant)"), self.printIsNull) self.button = QPushButton("test") self.connect(self.button, SIGNAL("clicked()"), self.model.testEmit) layout = QVBoxLayout() layout.addWidget(self.button) self.setLayout(layout) def printIsNull(self, one, two): print one.isNull() def main(): app = QApplication(sys.argv) widget = TestWidget(None) widget.show() return app.exec_() if __name__ == "__main__": main() ---CODE Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] upgrade pyqt 4.4.4 to 4.5.4 problems
Hello, i have upgraded my linux development machine from pyqt 4.4.4 to 4.5.4 (and sip 4.7.9 to 4.8.2) and i am getting any errors with my application. My Qt version it is 4.5.2 but errors are related to pyqt version because if i downgrade pyqt all works, well obviously can be problems with my code (i think so), but i mean that with pyqt 4.4.4 the code works. 1) i am using a QThread to populate large sql queries data to a model in background. Inside the class run method i create a worker object (worker it is a QObject subclass) and run an event loop to connect the worker and the thread with signals and slots, it have been running fine with all pyqt 4.4 versions but i now get this error: QObject: Cannot create children for a parent that is in a different thread. (Parent is QueryModelThread(0xa00db20), parent's thread is QThread(0x9f0a748), current thread is QueryModelThread(0xa00db20) code: class QueryModelThread(QThread): def __init__(self, parent=None): super(QueryModelThread, self).__init__(parent) self.worker = None def executeModel(self, texto_query): self.emit(SIGNAL("executeModel"), texto_query) def executeQuery(self, texto_query): self.emit(SIGNAL("executeQuery"), texto_query) def stopIfRunning(self): if self.worker: self.worker.stopIfRunning() def run(self): worker = Worker() self.connect(self, SIGNAL("executeModel"), worker.slotExecuteModel) self.connect(worker, SIGNAL("finalizado"), self, SIGNAL("finalizado")) self.connect(worker, SIGNAL("redimensiona"), self, SIGNAL("redimensiona")) self.connect(worker, SIGNAL("comenzado"), self, SIGNAL("comenzado")) self.connect(worker, SIGNAL("nuevas_filas"), self, SIGNAL("nuevas_filas")) self.connect(self, SIGNAL("executeQuery"), worker.slotExecuteQuery) self.connect(worker, SIGNAL("query_preparada"), self, SIGNAL("query_preparada")) self.worker = worker self.exec_() init of the worker class: class Worker(QObject): def __init__(self, parent=None): super(Worker, self).__init__(parent) self.db = database.conectarDbTienda("QueryModelThread") self.query = QSqlQuery(self.db) self.stop = self.corriendo = False 2) i have many models that use a set of shared methods (apart from Qt's models methods) so i created a python class (editor_documentos_base.EditorDocumentosBaseModel) with all this methods and in my models i use this multiple inheritance. class AlbaranEntradaModel(QAbstractTableModel, editor_documentos_base.EditorDocumentosBaseModel): def __init__(self, parent): super(AlbaranProveedorModel, self).__init__() editor_documentos_base.EditorDocumentosBaseModel.__init__(self) rowCount and columnCount are implemented in this base class and now when i call tableView.setModel(sampleModel) (where sampleModel it is the instance of one of my models) i get this errors: NotImplementedError: QAbstractTableModel.rowCount() is abstract and must be overridden NotImplementedError: QAbstractTableModel.columnCount() is abstract and must be overridden 3) i know that signals and slots have changed with this versions but i thought the old syntax it is still support for compatibility, i get this error emitting this signal, do i am wrong or this is other problem? self.emit(SIGNAL("cambiaFoto(QVariant, QVariant)"), QVariant(), QVariant()) TypeError: argument 0 of signal PyQtProxy.ambiaFoto(QVariant,QVariant) has an invalid type I have never detected a bug in PyQT, i think it is a great piece of software (sip too!) so i suppose all of this is my fault but i need a bit of help to understand where it is the problem, thanks in advance. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] will pyqt follow qt license model?
It is compatible use QT LGPL with pyqt commercial? if this is the case i think it is much more easy to pay pyqt to develop closed source apps that was before qt changed to lgpl, because the price to develop closed source apps with pyqt has decreased greatly. Miguel Angel Arnold Krille escribió: On Friday 10 April 2009 11:07:38 bobbyrw...@gmail.com wrote: Because if they don't an open source alternative will come out making them irrelevant? Sent from my Verizon Wireless BlackBerry The same was probably said when Qt came into business. And see how long they live already. If you think you can easily start something similar to PyQt but is "truely free[TM]" be my guest... And actually there is an open source alternative. Its called PyQt and is usable by open source projects for non-profit (aka free) software. Arnold PS: Discussing about free software and then sending from Verizon is kind of strange... ___ 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] lambda slot problem
Ok, reading about the scoping problem with lambda i now understand the problem, activated it is the bool emitted from the clicked signal so i have changed it to: lambda activated, m=msg: self.changeStatus(m, activated) and now works correctly, thanks Brian. If i have understand the way that lambda works i should define inside the lambda expression any variable that i am using in the call and can change in the future, no? Regards, Miguel Angel. Brian Kelley escribió: You are seeing a scoping issue, to be safe, I would write the lambda as follows lambda changeStatus=self.changeStatus,m=msg,a=activated: changeStatus(m,a) This ensures that the bindings of self, activated and msg are what you expect when the lambda function is executed. On 4/2/09 7:16 PM, "Linos" wrote: Hello, i suppose i am making any mistake here but i dont know why, for example: for checkbox, msg in ((self.printedCheckBox, "printed"), (self.finishedCheckBox, "finished")): self.connect(checkbox, SIGNAL("clicked(bool)"), lambda activated: self.changeStatus(msg, activated)) This one ever passes the last msg, "finished", although the checkbox self.printedCheckBox is checked. self.connect(checkbox, SIGNAL("clicked(bool)"), functools.partial(self.changeStatus, msg) works ok, why the lambda it is only using the last msg string ever? Regards, Miguel Angel. ___ 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] lambda slot problem
Hello, i suppose i am making any mistake here but i dont know why, for example: for checkbox, msg in ((self.printedCheckBox, "printed"), (self.finishedCheckBox, "finished")): self.connect(checkbox, SIGNAL("clicked(bool)"), lambda activated: self.changeStatus(msg, activated)) This one ever passes the last msg, "finished", although the checkbox self.printedCheckBox is checked. self.connect(checkbox, SIGNAL("clicked(bool)"), functools.partial(self.changeStatus, msg) works ok, why the lambda it is only using the last msg string ever? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] best way to manage forms?
simozack escribió: 2009/1/27, Linos : For an example form that i would need to manage i have a customer table and an address table (because for every customer they can have > 1 addresses) so in the same form i would like to edit all the possible data of the customer. It seems a work for two QSqlTableModel... I would like to do without using tables for the fields (well to select the address to edit i can use a table but only to populate the data in the correct widgets), QSqlTableModel or QSqlRelationalTableModel dont seems to fit very well in this scenario, am i supposed to create two different QSqlTableModel and other two different QDataWidgetMapper (one for every table implicated)?, and if i want to select the customer searching for it how could i do?, setting a filter in the two models? i am not interested in next or previous buttons and qdatawidgetmapper seems to be all about them. If you use the QTableView to view the data, you don't need QDataWidgetMapper. You can activate the edit triggers to directly modify the data. How to do that is well explained in the PyQt Book by Mark Summerfield, who posts here sometimes, in particular in the chapter 15. You should download from the book site the source code of that chapter and look to the assetmanager example. Yes i have read the book, anyway i will read other time the chapter 15 only in case i have missed anything important, but i prefer my users edit the information in external widgets, for example the address street it is too long to edit it clearly inside the table, i will use the table to select the information to populate the widgets. Any time ago the people had complaining about the bugs in qdatawidgetmapper, do it works reliable now? I have not used ever it. It is this the best way to create database forms with qt? i have been thinking about use SQLAlchemy to do this but i would like to go only with qt if it is possible because i would like to left open the possibility of a c++ port of the application. Any better idea o suggestion? Thanks. IMHO you don't need SQLAlchemy, you can do everything via the QtSql module. HTH, Simone Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] best way to manage forms?
Hello, i have been reading about qdatawidgetmapper and qsqltablemodel or qsqltablerelationalmodel but i am not sure any combination of them can fills my needs or if i could do in a better way. For an example form that i would need to manage i have a customer table and an address table (because for every customer they can have > 1 addresses) so in the same form i would like to edit all the possible data of the customer. I would like to do without using tables for the fields (well to select the address to edit i can use a table but only to populate the data in the correct widgets), QSqlTableModel or QSqlRelationalTableModel dont seems to fit very well in this scenario, am i supposed to create two different QSqlTableModel and other two different QDataWidgetMapper (one for every table implicated)?, and if i want to select the customer searching for it how could i do?, setting a filter in the two models? i am not interested in next or previous buttons and qdatawidgetmapper seems to be all about them. It is this the best way to create database forms with qt? i have been thinking about use SQLAlchemy to do this but i would like to go only with qt if it is possible because i would like to left open the possibility of a c++ port of the application. Any better idea o suggestion? Thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: Thermal Printer on QPrinter
Hello Eduardo, if you refer to normal receipt printers (like epson pos printers), i use them but after have problems using directly with qt like you are trying i configured the cups spool for the printer in raw format and create a file in the encoding configured for the printer (cp850) in python with the correct codes to format the output (inserting the database desired values with string formatting) and send the file to the raw printer configured in cups with lpr. Regards, Miguel Angel. Eduardo Willians escribió: Well, I'm trying to config a thermal printer (bematech[1]) with 79mm of paper width (72mm of printing capacity) and continous feed. But is not working correctly. Here is untill I got: app = QApplication(sys.argv) printer=QPrinter() printer.setFullPage(True) printer.setPaperSource(printer.Auto) doc=QTextDocument("Hello World!") doc.print_(printer) printer.setPageSize(printer...) method produces no diference, except if using "printer.Custom" that neither works correctly. Thanks. Eduardo Willians [1] http://www.bematech.com.br/produtos/minimp2100th.asp I found out how to say in english the printer I need to config. It's a RECEIPT PRINTER. If you know how config this kind of printer, please help. Thanks again. ___ 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] Long SQL result slow QTableView
Hello, i have any queries that returns a somewhat large (not too much) number of rows (about 5000 with 7~8 columns), i am using now QSqlQueryModel in a QTableView, the problem it is the load at startup (and when i have to refresh the table for an update), i have thought to use a secondary thread to populate the list of the results in the background, should this work ok? maybe i am missing anything better integrated in qt? About the changes in a sql querymodel result do i have any way to update only the row changed without have to make my own model caching the data and emiting dataChanged at finish? i would like qt would have a signal when the underlying sql data has been changed or anything alike. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [Fwd: [PyQt] mem error in windows]
Thank you Phil. Phil Thompson escribió: On Tuesday 06 May 2008, Linos wrote: Phil do you have for download the source of the windows installer? this way i could compile to have an installer without that problem. Regards, Miguel Angel. Attached is the installer source. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[Fwd: [PyQt] mem error in windows]
Phil do you have for download the source of the windows installer? this way i could compile to have an installer without that problem. Regards, Miguel Angel. --- Begin Message --- Hello, i have a problem using odbc driver if i install the binary installer version (PyQt-Py2.5-gpl-4.3.3-2.exe), if i download qt 4.3.3, mingw32, sip-4.7.4 and PyQt-4.3.3 and compile sip and PyQt i dont have this problem, the error it gives me when the script ends is: the instruction at "0x00ea2acf" referenced memory at "0x01013f20". The memory could not be "read". it works, but gives me this error on exit and i have to click on "accept" to close the message window. Any ideas? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt --- End Message --- ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] mem error in windows
Hello, i have a problem using odbc driver if i install the binary installer version (PyQt-Py2.5-gpl-4.3.3-2.exe), if i download qt 4.3.3, mingw32, sip-4.7.4 and PyQt-4.3.3 and compile sip and PyQt i dont have this problem, the error it gives me when the script ends is: the instruction at "0x00ea2acf" referenced memory at "0x01013f20". The memory could not be "read". it works, but gives me this error on exit and i have to click on "accept" to close the message window. Any ideas? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] use c++ files from PyQt
Should be possible to create a model (QAbstractTableModel subclass) and a view (QTableView subclass) in c++ and use it from a PyQt program with sip or any other way? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Question about model/view framework
IloChab escribió: 2008/2/26, Linos <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>: IloChab escribió: > I'm using the couple QTableView+QSqlQueryModel. > > I was wondering if it's possible to extend the table with some columns > not contained in the relation but computed on the fly from the application. > > If it's possible I'd like to know how, because I made some tests without > any success. > > Thank you in advance. > ciao > Licia > > > > > ___ > PyQt mailing listPyQt@riverbankcomputing.com <mailto:PyQt@riverbankcomputing.com> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt Hi, if the values are from computed from database columns values you can do in the sql select, if you need to post any other information not generated from sql i think you will have to subclass the model and reimplement the data method. Yes, this was what I thought to do, but I wasn't able to let me call on column numbers over the last from my db table. So I searched for a method to tell the table header that it was bigger than the table columns number but I didn't find anything useful Perhaps I have to create a temporary table just to contain the new columns? But this will be a big waste of db space. Or I have to manage the table all by my self, extracting data from the relation and then adding the new calculated columns, but in this way I'll loose all the model/view features!! I guess there must be a better way. Regards, Miguel Angel. Ciao Licia Hi, I think i am not understanding well the problem, with qsqlquerymodel you can do anything like this: model.setQuery(QString("SELECT INVOICE_NUMBER, CUSTOMER, TOTAL_INVOICE, TAX_INVOICE, TOTAL_INVOICE+TAX_INVOICE FROM INVOICE"), dbconnection) and the "TOTAL_INVOICE+TAX_INVOICE" should be the fifth, depending on the database you are using you could use many other functions to string formatting for example inside the select query, you can develop your own functions if you any not supported by your database, other way could be create a model where you load in a python object the data you retrieve from a database and other information you want to manipulate/show, and call it with the model data method, i am using this now and works very well, i have inside the model a list of python objects, every line is a object and the class for this objects only have the atributes i retrieve from database (i maintain them in QVariant after database retrieve to avoid innecesary type transformations because i have to retrieve in this type from the model data method to tableview), this way you can manipulate that you retrieved like you want and use the model/view. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Question about model/view framework
IloChab escribió: I'm using the couple QTableView+QSqlQueryModel. I was wondering if it's possible to extend the table with some columns not contained in the relation but computed on the fly from the application. If it's possible I'd like to know how, because I made some tests without any success. Thank you in advance. ciao Licia ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Hi, if the values are from computed from database columns values you can do in the sql select, if you need to post any other information not generated from sql i think you will have to subclass the model and reimplement the data method. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] speed problem
Hello, i have created one pyqt app we are using in my company, it is warehouse application, any fast workers seems to be faster that application because of fast bar code scanners, they are introducing items in a QTableView with an internal QAbstractTableModel subclass and using QItemDelegate, i am using a python class to store the columns in QVariant, every line it is a python object of this class, i have made many profiling and fix all the bottlenecks, when they read too fast it is like the return keypress after read the bar code doesnt works, i can see in the lineedit of the cell many ean13 codes toguether and it fails to load because it doesnt exist. To me it seems like a qt problem because it doesnt close the editor when receive a return keypressevent and read the next code in the same editor, i have been to get 4 ean13 in the same lineEdit if i try very fast, the machine where i am using the application is a pentium4 1.8 so it should be sufficient to use the app correctly, the cpu usage goes on 40% to python, 20% to Xorg, i have tried with psyco and timing the load item/create new line python code it is 1.3 times faster than before but i have the same problem with the editor, anyone has any idea how i can fix this? other question can i develop a model to the tableview or create gui code in c++ and use it from the pyQt application? Regards, Miguel Angel. ___ 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] speed problem
Hello, i have created one pyqt app we are using in my company, it is warehouse application, any fast workers seems to be faster that application because of fast bar code scanners, they are introducing items in a QTableView with an internal QAbstractTableModel subclass and using QItemDelegate, i am using a python class to store the columns in QVariant, every line it is a python object of this class, i have made many profiling and fix all the bottlenecks, when they read too fast it is like the return keypress after read the bar code doesnt works, i can see in the lineedit of the cell many ean13 codes toguether and it fails to load because it doesnt exist. To me it seems like a qt problem because it doesnt close the editor when receive a return keypressevent and read the next code in the same editor, i have been to get 4 ean13 in the same lineEdit if i try very fast, the machine where i am using the application is a pentium4 1.8 so it should be sufficient to use the app correctly, the cpu usage goes on 40% to python, 20% to Xorg, i have tried with psyco and timing the load item/create new line python code it is 1.3 times faster than before but i have the same problem with the editor, anyone has any idea how i can fix this? other question can i develop a model to the tableview or create gui code in c++ and use it from the pyQt application? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Standard font in PyQt applications (Eric included)
Sibylle Koczian escribió: Hello, I'm using PyQt 4.3.3, Qt 4.3.3, Eric 4.0.4(r1711), sip 4.7.3, QScintilla 2.1, Python 2.5.1 on Gentoo Linux, with KDE 3.5.8 as my Desktop manager. After one of the last Gentoo updates the font in Eric and in all my PyQt applications suddenly changed to something very small and quite ugly. Regarding Eric: it's not the font used for the source code - that didn't change and would be easily reset. It's the font for menus, buttons and the like. I don't much want to set a font explicitly in every application, and until this upgrade it was quite nice. What can have happened? Which information would be useful? No change of fonts in other applications, including KDE itself. Regards, Sibylle I dont know if your problem it is the same i had, but i have to emerge older fontconfig version of gentoo to see my qt apps fonts ok. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QListWidget SIGNAL problem
Doug Bell escribió: > Linos wrote: >>> Hello, i have a problem with a listwidget i have created inside a >>> QToolBox page, if doesnt emit signals, i can select the items but it >>> doesnt emit itemDoubleClicked or itemClicked or itemActivated, i >>> have tried with mouse and keyboard without luck, i have installed an >>> event filter and do a print to every event it pass and i get no >>> event in mouse click, double click, or keyboard enter, but i can >>> navigate through items with keyboard or mouse, anyone has any idea >>> what can be the problem here? or any better way that an eventfilter >>> to debug it? > >> I have made an small sample app: > > Your problem is in the signatures of the signals. In C++, the items are > passed a pointers. In PyQt, you need the full signature, including the > "*". For example, replace SIGNAL("itemClicked(QListWidgetItem)") with > SIGNAL("itemClicked(QListWidgetItem*)"). > > Doug. Yes i do it (Phil thompson tell me the same) and now it works, thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QListWidget SIGNAL problem
Phil Thompson escribió: > On Saturday 08 December 2007, Linos wrote: >> Linos escribió: >>> Hello, i have a problem with a listwidget i have created inside a >>> QToolBox page, if doesnt emit signals, i can select the items but it >>> doesnt emit itemDoubleClicked or itemClicked or itemActivated, i have >>> tried with mouse and keyboard without luck, i have installed an event >>> filter and do a print to every event it pass and i get no event in mouse >>> click, double click, or keyboard enter, but i can navigate through items >>> with keyboard or mouse, anyone has any idea what can be the problem here? >>> or any better way that an eventfilter to debug it? >>> >>> Best Regards, >>> Miguel Angel. >>> ___ >>> PyQt mailing listPyQt@riverbankcomputing.com >>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt >> I have made an small sample app: >> >> --- >> -- >> >> #!/usr/bin/env python >> from PyQt4.QtCore import * >> from PyQt4.QtGui import * >> >> class ListWidgetTest(QDialog): >> def __init__(self, parent=None): >> super(ListWidgetTest, self).__init__(parent) >> >> listWidget = QListWidget() >> layout = QVBoxLayout() >> layout.addWidget(listWidget) >> self.setLayout(layout) >> >> self.connect(listWidget, >> SIGNAL("itemDoubleClicked(QListWidgetItem)"), self.printTest) >> self.connect(listWidget, SIGNAL("itemClicked(QListWidgetItem)"), >> self.printTest) self.connect(listWidget, >> SIGNAL("itemActivated(QListWidgetItem)"), self.printTest) item = >> QListWidgetItem(self.tr("TESTING SIGNALS")) >> item.setData(Qt.UserRole, QVariant(1)) >> listWidget.insertItem(0, item) >> >> def printTest(self, item): >> print "ok!!" >> >> >> if __name__ == "__main__": >> import sys >> app = QApplication(sys.argv) >> dialog = ListWidgetTest() >> dialog.show() >> app.exec_() >> >> --- >> -- >> >> anyone knows where can be the problem here? Thanks. > > The argument type of those signals is "QListWidgetItem *" > not "QListWidgetItem". > > Phil > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt Argh i am going to be in hell because this i am sure :(, many thanks Phil. Sorry for the fist private mail i am trying to reply to list but i didnt check the To address. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QListWidget SIGNAL problem
Linos escribió: > Hello, i have a problem with a listwidget i have created inside a QToolBox > page, if doesnt emit signals, i can > select the items but it doesnt emit itemDoubleClicked or itemClicked or > itemActivated, i have tried with mouse > and keyboard without luck, i have installed an event filter and do a print to > every event it pass and i get no > event in mouse click, double click, or keyboard enter, but i can navigate > through items with keyboard or > mouse, anyone has any idea what can be the problem here? or any better way > that an eventfilter to debug it? > > Best Regards, > Miguel Angel. > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt I have made an small sample app: - #!/usr/bin/env python from PyQt4.QtCore import * from PyQt4.QtGui import * class ListWidgetTest(QDialog): def __init__(self, parent=None): super(ListWidgetTest, self).__init__(parent) listWidget = QListWidget() layout = QVBoxLayout() layout.addWidget(listWidget) self.setLayout(layout) self.connect(listWidget, SIGNAL("itemDoubleClicked(QListWidgetItem)"), self.printTest) self.connect(listWidget, SIGNAL("itemClicked(QListWidgetItem)"), self.printTest) self.connect(listWidget, SIGNAL("itemActivated(QListWidgetItem)"), self.printTest) item = QListWidgetItem(self.tr("TESTING SIGNALS")) item.setData(Qt.UserRole, QVariant(1)) listWidget.insertItem(0, item) def printTest(self, item): print "ok!!" if __name__ == "__main__": import sys app = QApplication(sys.argv) dialog = ListWidgetTest() dialog.show() app.exec_() - anyone knows where can be the problem here? Thanks. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QListWidget SIGNAL problem
Hello, i have a problem with a listwidget i have created inside a QToolBox page, if doesnt emit signals, i can select the items but it doesnt emit itemDoubleClicked or itemClicked or itemActivated, i have tried with mouse and keyboard without luck, i have installed an event filter and do a print to every event it pass and i get no event in mouse click, double click, or keyboard enter, but i can navigate through items with keyboard or mouse, anyone has any idea what can be the problem here? or any better way that an eventfilter to debug it? Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] optimization
hello, i would like to know if exist any link about specific optimization tips for python using pyqt i am trying to optimize the code the most possible to try to maintain in pyqt and not have to reprogram in c++, for example do have psyco good results? Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] qsqlquerymodel combobox items cleared
Hello all, inside a dialog i populate the contents of a query in three comboboxes like this: self.subfamiliaModel = QSqlQueryModel() self.subfamiliaComboBox.setModel(self.subfamiliaModel) self.subfamiliaModel.setQuery("SELECT SUBFAMILIA_ID & ' ' & NOMBRE FROM SCHEMA.MODELO_SUBFAMILIA ORDER BY EXPRESSION1", maxdb) self.subfamiliaComboBox.setCurrentIndex(-1) every combobox have his own model, this works well, it is a dialog that can be used many times because it is to search for items codes so i dont create it every time i load the dialog, instead i maintain in memory and in every exec i clear the filters of the lineedit and selections in comboboxes, i use 4 lineedits and 3 comboboxes but one of the comboboxes it is reloaded on every .exec_() to the dialog because his query and contents is changed while editing the other comboboxes. well all works very well but if a leave the program open any time (about 20 minutes) and exec the dialog, the two comboboxes with qsqlquerymodel that are not resetted in every load are empty. do qsqlquerymodel any timeout or anything alike? i cant find in documentation. Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] import speed overhead question
Hello all, i have a question about speed optimization with PyQt, i cant find any clear explanation about this question in google, i am developing an app with many .py files, in the beginning i am using this imports. from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtSql import * to have no problem using classes but i would like to post any questions i suppose any people on the list have to know: 1- if i import a file and this file import the same, it is imported two times wasting the same time in the same imports other time? main.py from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtSql import * import testdlg testdlg.py from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtSql import * 2- i have changed any files to import like this: from PyQt4.QtCore import QRegExp, QString, Qt, SIGNAL, SLOT, QVariant, QChar from PyQt4.QtGui import QLabel, QDialog, QLineEdit, QDialogButtonBox, QGridLayout, QMessageBox, QApplication, QIcon, QInputDialog from PyQt4.QtSql import QSqlQuery i know other people (and pyuic4) use this : from PyQt4 import QtCore and later use ever first QtCore in classes names "QtCore.QString" but i dont like to write too much unnecessary code when i know i will not have name collision, any other way to speed up the imports? 3- is this really important to speed up the application? Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dictionary signal
Phil Thompson escribió: > On Tuesday 20 November 2007, Linos wrote: >> Hello, >> i want to emit a signal from a dialog that contains a dictionary (i >> would >> like to do with a qt class but QMap dont seems to be in PyQt, almost this >> "test = QMap()" doesnt works), i know i can pass a python dictionary in a >> short-circuit signal but i would like to send with a qvariant in the same >> signal, it is this possible? this is that i am using now, but i would like >> to add the dictionary: >> >> self.emit(SIGNAL("ticketcerrado(QVariant)"), codigo_vendedor) >> >> I know i can use other signal (short cirtuit) or send every the dictionary >> value but i think should exist any other better solution i have not found. > > You can pass *any* Python object to a short-circuit signal, including a > wrapped QVariant. > > Phil > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt Yes this works very good, thanks Phil. Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] dictionary signal
Hello, i want to emit a signal from a dialog that contains a dictionary (i would like to do with a qt class but QMap dont seems to be in PyQt, almost this "test = QMap()" doesnt works), i know i can pass a python dictionary in a short-circuit signal but i would like to send with a qvariant in the same signal, it is this possible? this is that i am using now, but i would like to add the dictionary: self.emit(SIGNAL("ticketcerrado(QVariant)"), codigo_vendedor) I know i can use other signal (short cirtuit) or send every the dictionary value but i think should exist any other better solution i have not found. Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Decimal separator Problem
Ingmar Steen escribió: > On Nov 18, 2007 8:44 PM, David Boddie <[EMAIL PROTECTED]> wrote: >> On Tue Nov 13 22:43:29 GMT 2007, Linos wrote: >> >>> Ok, the real problem here it is that i cant use the dot in the numpad to >>> begin decimal numbers, i have checked and spanish locale use comma like >>> decimal separator, i was confused by too many english software i use, >> I'm glad we don't have to try and track down a locale-related bug. :-) >> >>> but i have checked and in almost all the software i can use the dot in >>> numpad to begin decimal numbers (although i view a comma), anyone knows >>> how to map the symbol or other way to do that? >> Do you want a leading comma to appear as a decimal point instead? Is this >> a standard convention when dealing with numbers in Spanish? >> >> David > > Hi David, > > I think he means that he wants to be able to use the dot on the > numeric pad to insert a decimal separator (and if the locale specifies > a comma as decimal separator, that will be inserted instead of a dot). > > Ingmar > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt Yes it is that i means, have get the change with xev and xmodmap, with xev i have seen the keycode the numpad dot launch and i have mapped with xmodmap to a comma and now it works ok, this is that i have used in .xmodmaprc: keycode 91 = comma Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Decimal separator Problem
Ok, the real problem here it is that i cant use the dot in the numpad to begin decimal numbers, i have checked and spanish locale use comma like decimal separator, i was confused by too many english software i use, but i have checked and in almost all the software i can use the dot in numpad to begin decimal numbers (although i view a comma), anyone knows how to map the symbol or other way to do that? Linos escribió: > Hello, > i have a problem with the decimal separator in float numbers, i detect > the problem in a QDoubleSpinBox (the > decimal separator should be "." but it is ",") and i think it is failing in > other objects. My locale in > "es_ES", if i use "locale" command in bash i get this: > > LANG=es_ES > LC_CTYPE="es_ES" > LC_NUMERIC="es_ES" > LC_TIME="es_ES" > LC_COLLATE="es_ES" > LC_MONETARY="es_ES" > LC_MESSAGES="es_ES" > LC_PAPER="es_ES" > LC_NAME="es_ES" > LC_ADDRESS="es_ES" > LC_TELEPHONE="es_ES" > LC_MEASUREMENT="es_ES" > LC_IDENTIFICATION="es_ES" > LC_ALL=es_ES > > i have added this code to the __init__ of a dialog. > > print QString("%L1").arg(10.54) > > locale = QLocale() > country = locale.country() > language = locale.language() > print locale.countryToString(country) > print locale.languageToString(language) > print QString("10,25").toDouble()[0] > > and i get this output: > > 10,54 > Spain > Spanish > 10.25 > > The first localized arg isnt good and the last toDouble it is good printed > because python convert it to a > float and python dont have the problem with the locale. The strange about > this it is i have the same problem > if i exec in a windows machine, what can be the problem? > > Best Regards, > Miguel Angel. > ___ > 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] Decimal separator Problem
Hello, i have a problem with the decimal separator in float numbers, i detect the problem in a QDoubleSpinBox (the decimal separator should be "." but it is ",") and i think it is failing in other objects. My locale in "es_ES", if i use "locale" command in bash i get this: LANG=es_ES LC_CTYPE="es_ES" LC_NUMERIC="es_ES" LC_TIME="es_ES" LC_COLLATE="es_ES" LC_MONETARY="es_ES" LC_MESSAGES="es_ES" LC_PAPER="es_ES" LC_NAME="es_ES" LC_ADDRESS="es_ES" LC_TELEPHONE="es_ES" LC_MEASUREMENT="es_ES" LC_IDENTIFICATION="es_ES" LC_ALL=es_ES i have added this code to the __init__ of a dialog. print QString("%L1").arg(10.54) locale = QLocale() country = locale.country() language = locale.language() print locale.countryToString(country) print locale.languageToString(language) print QString("10,25").toDouble()[0] and i get this output: 10,54 Spain Spanish 10.25 The first localized arg isnt good and the last toDouble it is good printed because python convert it to a float and python dont have the problem with the locale. The strange about this it is i have the same problem if i exec in a windows machine, what can be the problem? Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QLabel setFont does not work
Well i have fixed using html code in qlabel.setText, i have now bold and the size i wanted but i think this is a bug, i dont know if pyqt or qt but it seems a bug. Linos escribió: > Hello all, > i have a problem with a QLabel i want to change the font size and make > bold, i have a dialog created in > designer where i have changed the font, i can view the change ok in the > designer preview but when i launch the > code with the dialog imported it doest not change the standard font, i cant > set from code either i have tried > this: > > print self.totalCuentaLabel.font().toString() > font = QFont("Sans Serif", 12, QFont.Bold) > self.totalCuentaLabel.setFont(font) > self.totalCuentaLabel.update() > print self.totalCuentaLabel.font().toString() > self.totalCuentaLabel.setText(QString("TOTAL CUENTA:")) > font = QFont("Sans Serif", 12, QFont.Bold) > self.totalCuentaLabel.setFont(font) > print self.totalCuentaLabel.font().toString() > > and i get this output: > >>>> Times New Roman,12,-1,5,75,0,0,0,0,0 > Sans Serif,12,-1,5,75,0,0,0,0,0 > Sans Serif,12,-1,5,75,0,0,0,0,0 > > the first font it is from designer but it does not work either. i ever view > in the dialog my standard qlabel > font "Sans Serif,9", anyone know how to fix this? Thanks in advance. > ___ > 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] QLabel setFont does not work
Hello all, i have a problem with a QLabel i want to change the font size and make bold, i have a dialog created in designer where i have changed the font, i can view the change ok in the designer preview but when i launch the code with the dialog imported it doest not change the standard font, i cant set from code either i have tried this: print self.totalCuentaLabel.font().toString() font = QFont("Sans Serif", 12, QFont.Bold) self.totalCuentaLabel.setFont(font) self.totalCuentaLabel.update() print self.totalCuentaLabel.font().toString() self.totalCuentaLabel.setText(QString("TOTAL CUENTA:")) font = QFont("Sans Serif", 12, QFont.Bold) self.totalCuentaLabel.setFont(font) print self.totalCuentaLabel.font().toString() and i get this output: >>> Times New Roman,12,-1,5,75,0,0,0,0,0 Sans Serif,12,-1,5,75,0,0,0,0,0 Sans Serif,12,-1,5,75,0,0,0,0,0 the first font it is from designer but it does not work either. i ever view in the dialog my standard qlabel font "Sans Serif,9", anyone know how to fix this? Thanks in advance. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlQuery Error
Matt Newell escribió: > On Thursday 01 November 2007 08:14, Linos wrote: >> Hello, >> queryinsertmaxdb = QSqlQuery(maxdb) >> queryinsertmaxdb.prepare("INSERT INTO NAMESPACE.MODELO_FAMILIA (FAMILIA_ID, >> NOMBRE, SECCION) VALUES (?, ?, ?)") >> > > I think you should try creating the QSqlQuery and the prepare inside the > loop. > If everything works fine then report the bug to trolltech. > > Matt I have tried and it works well if i execute the prepare method inside the loop. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QSqlQuery Error
Hello, i have a problem with QSqlQuery, i have a column "nombre" with an unique index (constraint), i am doing many inserts from PyQT (ODBC driver), i have the same problem from windows client and linux client, when any of the inserts of the prepared query have a duplicated unique column all the executed later gives me the same error but the insert works, i will explain here: i prepare the query: queryinsertmaxdb = QSqlQuery(maxdb) queryinsertmaxdb.prepare("INSERT INTO NAMESPACE.MODELO_FAMILIA (FAMILIA_ID, NOMBRE, SECCION) VALUES (?, ?, ?)") later inside a loop for every value in a list i do this: queryinsertmaxdb.addBindValue(QVariant(codigo_familia)) queryinsertmaxdb.addBindValue(QVariant(nombre_familia)) queryinsertmaxdb.addBindValue(QVariant(seccion_familia)) queryinsertmaxdb.exec_() all works fine but when it finds an integrity constraint violation: INSERT INTO NAMESPACE.MODELO_FAMILIA (FAMILIA_ID, NOMBRE, SECCION) VALUES (8325, TENIS MUJER, 2) Unable to execute statement: [SAP AG][LIBSQLOD SO][MaxDB] Integrity constraint violation;250 POS(1) Duplicate secondary key:UQ_NOMBRE [SAP AG][LIBSQLOD SO][MaxDB] Integrity constraint violation;250 POS(1) Duplicate secondary key:UQ_NOMBRE this insert does not works and it is correct (because it has the column name duplicated) but all the inserts after this gives me the same errors and all of them do correctly the insert because dont have a duplicate secondary key really, what can be the problem? I suppose with qsqlquery exec method reset the errors of last query but i thinks it is not working. Thanks in advance. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Sql Model Segfault
Hello all, i have a segmentation fault when i close the dialog i am using to test my sql model (using qdialog.accept in a button or exiting with escape i have the same error), i have compiled pyqt and qt with debug support and i have this with gdb: This GDB was configured as "i686-pc-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /usr/bin/python /home/skuda/Desktop/trunk/listviewtablemodel.py [Thread debugging using libthread_db enabled] [New Thread 0xb7cf36c0 (LWP 11172)] Qt: gdb: -nograb added to command-line options. Use the -dograb option to enforce grabbing. 0 255 QSqlDatabasePrivate::removeDatabase: connection 'maxdb' is still in use, all queries will cease to work. Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7cf36c0 (LWP 11172)] 0xb6111c0f in QODBCPrivate::isStmtHandleValid (this=0x81da880, driver=0x81b91c0) at ../../../sql/drivers/odbc/qsql_odbc.cpp:146 146 bool QODBCPrivate::isStmtHandleValid(const QSqlDriver *driver) Current language: auto; currently c++ the only operation i am doing is a select in the model, i load the data in a list of python objects, i can view all the data in the table without problem but when i close the dialog i get this error, what can be the problem? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt book "Rapid GUI Programming with Python and Qt" now available
I recommend this book to anyone that wants to learn PyQt, it is a excellent book with many real world examples with working code and really new stuff (it even use import from future in python). Regards, Miguel Angel. Mark Summerfield escribió: > Hi, > > I am delighted to announce that > > "Rapid GUI Programming with Python and Qt: > The Definitive Guide to PyQt Programming" > > has now been published in the US. > > The book is a hardback, 648 pages, ISBN 0132354187. > > The foreword was written by Phil Thompson (creator of PyQt), who was > also one of the book's five technical reviewers. > > For a brief overview of the book and the table of contents, etc., see > > http://www.qtrac.eu/pyqtbook.html > > This web page also has links to places that sell the book, and has the > full source code for the examples (and model answers to almost every > exercise) available for downloading. > > The book covers PyQt4 (it has no coverage of PyQt3), and is best used > with Python 2.5 and PyQt 4.2 or better, on Windows, Mac OS X, or an > X11-based Unix or Linux. No prior knowledge of GUI programming is > assumed, so don't worry if you've only ever done web programming:-) > > Since this is the only book that covers PyQt4 it is automatically the > "best"---but I have not been complacent, and have worked extremely hard > to make the book as accessible, useful, enjoyable, and interesting as > possible. > > (Note for Safari readers: The printed version of the book uses the PDF I > supplied as is, with fonts and typesetting exactly as I wanted them, > whereas the Safari online edition was retypeset by the publisher.) > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlQueryModel write subclass
well my model its working now (i have tested with tableview and datawidgetmapper) but i have a question to the list about the way i have designed it, now i load with a select the model (original sqlquerymodel) and when from the view add new rows i use an internal buffer (a list of python objects with the same struct as table), i have implemented data, setdata, insertrows and removerows this way and it works ok for me, when i update a sql returned row i use sql directly and relaunch the query to update the view and when i edit a field in the object list edit the list i launch an datachanged signal to update the view and i have created a save() function to save all the buffer to database and clear the buffer, but i have any questions to the list, in qtcentre.org forum a user (that has 7081 posts wow) has post this: ''' In my opinion you shouldn't subclass the sql query model. It might prove easier to implement a model from scratch using QAbstractTableModel or even QStandardItemModel and using QSqlQuery and/or QSqlTableModel behind the scenes. Otherwise you'll have problems with updating the model - after each change to the sql table, you'll have to use select() to fetch the updated model from the database (or it won't update), rendering the whole model-view gain practically useless, because you'll be losing selections, current items, etc. ''' so after think a bit about it i think i can be misusing the model, i could use sqlquery inside the model to load a list of python objects and use it in the model, i am using this now in the editbuffer, emitting datachanged works ok with this, i could do the changes to database in background in the model, but i dont know if the speed would be good with large datasets, any comments about this would be appreciated, thanks. Linos escribió: > David thanks for your reply i get this to work yesterday, the problem was > that i was not implementing > rowcount() so the new line was painted in the view but it did not have real > index so data() and setdata() > could not use it, i am today working in a Qsqlquerymodel subclass with a > buffer of rows to insert it all in a > final transaction if the model have dirty property true. > > Best Regards, > Miguel Angel. > > David Boddie escribió: >> On Wednesday 17 October 2007 12:14:52 +0200, Linos wrote: >> >>> I am goin crazy with this problem, i have tested with qsqltablemodel >>> subclassing and it works ok if a dont write the insertRows method in the >>> subclass: >>> >>> (model) >>> class SkudaSqlTableModel(QSqlTableModel): >>> def __init__(self, dbcursor=None): >>> super(SkudaSqlTableModel, self).__init__() >>> >>> >>> (QDialog) >>> def addRecord(self): >>> row = self.querymodel.rowCount() >>> self.querymodel.insertRow(row) >>> >>> >>> this works ok and gives me an new row with an '*' in the vertical header >>> and i can edit the line but if i do this: >>> >>> (model) >>> class SkudaSqlTableModel(QSqlTableModel): >>> def __init__(self, dbcursor=None): >>> super(SkudaSqlTableModel, self).__init__() >>> >>> def insertRows(self, position, rows=1 , index=QModelIndex()): >>> self.beginInsertRows(QModelIndex(), position, position + rows - 1) >>> self.endInsertRows() >>> return True >> Normally, when you reimplement insertRows() you would do something between >> calling beginInsertRows() and endInsertRows(). Not being familiar with the >> internals of QSqlTableModel, I'm not sure what should be done. >> >>> (QDialog) >>> def addRecord(self): >>> row = self.querymodel.rowCount() >>> self.querymodel.insertRow(row) >>> >>> i get a new line with the next number in the vertical header (not *) and i >>> cant edit the line. So i suppose i have any problem in my insertRows method >>> but i have read the QSqlTableModel source code insertRows method, i paste >>> here the strategy OnRowchange because is what i am using. >> OK, so do you basically want to fine-tune the behaviour of the table model >> or are you trying to achieve something else by subclassing QSqlTableModel? >> >> [...] >> >>> I cant find any other action to implement in my method apart from >>> beginInsertRows and endInsertRows, i am not using the insertIndex number (i >>> use rowCount()), not clearEditBuffer() because i have no buffer to clear in >>> this test and primeInsert is a signal no connected to anything so i dont >>> emit it,
Re: [PyQt] QSqlQueryModel write subclass
David thanks for your reply i get this to work yesterday, the problem was that i was not implementing rowcount() so the new line was painted in the view but it did not have real index so data() and setdata() could not use it, i am today working in a Qsqlquerymodel subclass with a buffer of rows to insert it all in a final transaction if the model have dirty property true. Best Regards, Miguel Angel. David Boddie escribió: > On Wednesday 17 October 2007 12:14:52 +0200, Linos wrote: > >> I am goin crazy with this problem, i have tested with qsqltablemodel >> subclassing and it works ok if a dont write the insertRows method in the >> subclass: >> >> (model) >> class SkudaSqlTableModel(QSqlTableModel): >> def __init__(self, dbcursor=None): >> super(SkudaSqlTableModel, self).__init__() >> >> >> (QDialog) >> def addRecord(self): >> row = self.querymodel.rowCount() >> self.querymodel.insertRow(row) >> >> >> this works ok and gives me an new row with an '*' in the vertical header >> and i can edit the line but if i do this: >> >> (model) >> class SkudaSqlTableModel(QSqlTableModel): >> def __init__(self, dbcursor=None): >> super(SkudaSqlTableModel, self).__init__() >> >> def insertRows(self, position, rows=1 , index=QModelIndex()): >> self.beginInsertRows(QModelIndex(), position, position + rows - 1) >> self.endInsertRows() >> return True > > Normally, when you reimplement insertRows() you would do something between > calling beginInsertRows() and endInsertRows(). Not being familiar with the > internals of QSqlTableModel, I'm not sure what should be done. > >> (QDialog) >> def addRecord(self): >> row = self.querymodel.rowCount() >> self.querymodel.insertRow(row) >> >> i get a new line with the next number in the vertical header (not *) and i >> cant edit the line. So i suppose i have any problem in my insertRows method >> but i have read the QSqlTableModel source code insertRows method, i paste >> here the strategy OnRowchange because is what i am using. > > OK, so do you basically want to fine-tune the behaviour of the table model > or are you trying to achieve something else by subclassing QSqlTableModel? > > [...] > >> I cant find any other action to implement in my method apart from >> beginInsertRows and endInsertRows, i am not using the insertIndex number (i >> use rowCount()), not clearEditBuffer() because i have no buffer to clear in >> this test and primeInsert is a signal no connected to anything so i dont >> emit it, anyway i have tried using exactly the same (all of them) in my >> method with exactly the same problem, can anyone please open my closed mind >> with this annoying problem? > > I suppose that the lines > > d->insertIndex = row; > d->clearEditBuffer(); > > may have some side effects, but it's difficult to see what those could be > without more detailed study. Plus, there's nothing you can do to access > the internals in such a way. > >> i will use qsqltablemodel subclass with >> setQuery (inherited from QSqlQuery) to do joins and other stuff if i cant >> fix this (but this is not recommended in documentation). > > I imagine that using setQuery() might interfere with the normal operation > of the model if you're not careful. > > David > > > ___ > 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] QSqlQueryModel write subclass
I am goin crazy with this problem, i have tested with qsqltablemodel subclassing and it works ok if a dont write the insertRows method in the subclass: (model) class SkudaSqlTableModel(QSqlTableModel): def __init__(self, dbcursor=None): super(SkudaSqlTableModel, self).__init__() (QDialog) def addRecord(self): row = self.querymodel.rowCount() self.querymodel.insertRow(row) this works ok and gives me an new row with an '*' in the vertical header and i can edit the line but if i do this: (model) class SkudaSqlTableModel(QSqlTableModel): def __init__(self, dbcursor=None): super(SkudaSqlTableModel, self).__init__() def insertRows(self, position, rows=1 , index=QModelIndex()): self.beginInsertRows(QModelIndex(), position, position + rows - 1) self.endInsertRows() return True (QDialog) def addRecord(self): row = self.querymodel.rowCount() self.querymodel.insertRow(row) i get a new line with the next number in the vertical header (not *) and i cant edit the line. So i suppose i have any problem in my insertRows method but i have read the QSqlTableModel source code insertRows method, i paste here the strategy OnRowchange because is what i am using. bool QSqlTableModel::insertRows(int row, int count, const QModelIndex &parent) { Q_D(QSqlTableModel); if (row < 0 || count <= 0 || row > rowCount() || parent.isValid()) return false; switch (d->strategy) { case OnRowChange: if (count != 1) return false; beginInsertRows(parent, row, row); d->insertIndex = row; // ### apply dangling changes... d->clearEditBuffer(); emit primeInsert(row, d->editBuffer); break; } endInsertRows(); return true; } I cant find any other action to implement in my method apart from beginInsertRows and endInsertRows, i am not using the insertIndex number (i use rowCount()), not clearEditBuffer() because i have no buffer to clear in this test and primeInsert is a signal no connected to anything so i dont emit it, anyway i have tried using exactly the same (all of them) in my method with exactly the same problem, can anyone please open my closed mind with this annoying problem? i will use qsqltablemodel subclass with setQuery (inherited from QSqlQuery) to do joins and other stuff if i cant fix this (but this is not recommended in documentation). Best Regards, Miguel Angel. Linos escribió: > Hello, > i am trying to subclass QSqlQueryModel to write with it, i need this > because not qsqltablemodel or > qsqlrelationaltablemodel fills my needs, i would like to do joins and insert > in multiple tables, i have > implemented "flags" and "setData" methods and it works ok now, i have made a > "refresh" method to reload the > contents on update because tableView not reload them with datachanged signal > and all works ok but now i am > trying to implement insertrow or insertrows without luck, this is the code i > am using now: > > this in model: > > def insertRows(self, position, rows=1, index=QModelIndex()): > self.beginInsertRows(QModelIndex(), position, position + rows - 1) > setdataquery = QSqlQuery(self.cursor) > setdataquery.exec_(QString("INSERT INTO SCHEMA.FAKE (FAKE1, FAKE2, > FAKE3) VALUES (4, 2, 'PEPITO')")) > self.endInsertRows() > self.dirty = True > return True > > this in qdialog: > > def addRecord(self): > row = self.querymodel.rowCount() > self.querymodel.insertRows(row) > index = self.querymodel.index(row, 0) > self.tableView.setCurrentIndex(index) > self.tableView.edit(index) > > After execute this method i can view the new row in table view but i get this > in stdout. > > edit: index was invalid > edit: editing failed > > I have test the row number rowCount() assign and it is ok, i dont know how to > fix this, anyone can help me please? > > > PD: I get original snippet and the idea about subclass QSqlQueryModel in the > really excellent book "Rapid GUI > Development with Python-PyQT". > ___ > 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] QSqlQueryModel write subclass
Hello, i am trying to subclass QSqlQueryModel to write with it, i need this because not qsqltablemodel or qsqlrelationaltablemodel fills my needs, i would like to do joins and insert in multiple tables, i have implemented "flags" and "setData" methods and it works ok now, i have made a "refresh" method to reload the contents on update because tableView not reload them with datachanged signal and all works ok but now i am trying to implement insertrow or insertrows without luck, this is the code i am using now: this in model: def insertRows(self, position, rows=1, index=QModelIndex()): self.beginInsertRows(QModelIndex(), position, position + rows - 1) setdataquery = QSqlQuery(self.cursor) setdataquery.exec_(QString("INSERT INTO SCHEMA.FAKE (FAKE1, FAKE2, FAKE3) VALUES (4, 2, 'PEPITO')")) self.endInsertRows() self.dirty = True return True this in qdialog: def addRecord(self): row = self.querymodel.rowCount() self.querymodel.insertRows(row) index = self.querymodel.index(row, 0) self.tableView.setCurrentIndex(index) self.tableView.edit(index) After execute this method i can view the new row in table view but i get this in stdout. edit: index was invalid edit: editing failed I have test the row number rowCount() assign and it is ok, i dont know how to fix this, anyone can help me please? PD: I get original snippet and the idea about subclass QSqlQueryModel in the really excellent book "Rapid GUI Development with Python-PyQT". ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] newbie question re docks
Horst Herb escribió: > Hi, > > I am new to PyQt4, trying to write my first app. > > I would like to write an application with multiple docking widgets. The > application should remember the state (size, location) of the docked widgets > (wherever the user has placed them). > > How can I achieve this? Could anybody please explain, perhaps using the > dockwidgets example that comes with the PyQt4 package? > > Many thanks in advance, > Horst > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > I think you can do that with qsettings saving application state and geometry, i have read anything about in the new pyqt4 book (great resource if you want to develop with pyqt). Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: Build PyQt with sql Driver plugins
[EMAIL PROTECTED] escribió: > > Citando Linos <[EMAIL PROTECTED]>: > >> Paulino escribió: >>> Linos escreveu: >>>> [EMAIL PROTECTED] escribió: >>>> >>>>> Citando Linos <[EMAIL PROTECTED]>: >>>>> >>>>> >>>>>> [EMAIL PROTECTED] escribió: >>>>>> >>>>>>> Citando Linos <[EMAIL PROTECTED]>: >>>>>>> >>>>>>> >>>>>>>> Paulino escribió: >>>>>>>> >>>>>>>>> *>Linos* info at linos.es >>>>>>>>> <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> />Tue Sep 25 22:21:33 BST 2007/ >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> The last version in windows works very well for me with odbc >>>>>>>>>> support >>>>>>>>>> but i have compilend by hand (sip >>>>>>>>>> and pyqt, qt installed from binary) i dont know if binary >>>>>>>>>> packages >>>>>>>>>> fail, i have a problem with odbc in >>>>>>>>>> linux but in windows works very well. >>>>>>>>>> >>>>>>>>> I have also compiled by hand sip and PyQt, and instaled qt from >>>>>>>>> binary, but didn't got QODBC available. >>>>>>>>> >>>>>>>>> What options did you gave the PyQt's configure.py? >>>>>>>>> >>>>>>>>> >>>>>>>>> Paulino >>>>>>>>> >>>>>>>>> >>>>>>>> Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7, >>>>>>>> python 2.5.1 and >>>>>>>> qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any >>>>>>>> options in >>>>>>>> configure.py, it detects qsql and >>>>>>>> qodbc while compiling and works ok. >>>>>>>> >>>>>>>> >>>>>>> I used the same packages you refer! >>>>>>> >>>>>>> I wonder why it didn't detected QODBC >>>>>>> >>>>>>> Paulino >>>>>>> >>>>>>> >>>>>> i have in c:\qt\4.3.1\plugins\sqldrivers\ the files: >>>>>> >>>>>> libqsqlodbc4.a >>>>>> qsqlodbc4.dll >>>>>> >>>>>> do you have the same? >>>>>> >>>>>> >>>>> Yes, and also: >>>>> libqsqlite4.a >>>>> qsqlite4.dll >>>>> >>>>> But don't have any driver available. >>>>> >>>>> Paulino >>>>> >>>>> >>>> >>>> i would try recompiling sip and later pyqt, if you have no luck i >>>> can try in other virtual machine to see >>>> if it works for me other time. >>>> >>>> >>>> >>> I tried for 3 times - one on a clean virtual machine. No drivers >>> available. >> >> Paulino i have tried today in a clean virtual machine and it works for >> me, i have done this: >> >> install mingw-5.1.3.exe >> install qt-win-opensource-4.3.1-mingw.exe >> install python-2.5.1.msi >> install pywin32-210.win32-py2.5.exe > > >> add to system path variable: >> c:\python25;C:\MinGW\libexec\gcc\mingw32\3.4.2;c:\MinGW\bin;C:\Qt\4.3.1\bin >> > > I hadn't add this path :C:\MinGW\libexec\gcc\mingw32\3.4.2 > All the others OK > >> cd into sip-4.7 directory: >> python configure.py sorry i did too the -p win32-g++, my memory hehehe. > > I give the "-p win32-g++" flag to configure.py. (I learn it from PyQt > wiki : http://www.diotavelli.net/PyQtWiki/BuildPyQt4Windows) > If i don't I
[PyQt] Re: Build PyQt with sql Driver plugins
Paulino escribió: > Linos escreveu: >> [EMAIL PROTECTED] escribió: >> >>> Citando Linos <[EMAIL PROTECTED]>: >>> >>> >>>> [EMAIL PROTECTED] escribió: >>>> >>>>> Citando Linos <[EMAIL PROTECTED]>: >>>>> >>>>> >>>>>> Paulino escribió: >>>>>> >>>>>>> *>Linos* info at linos.es >>>>>>> <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk> >>>>>>> >>>>>>> >>>>>>> />Tue Sep 25 22:21:33 BST 2007/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> The last version in windows works very well for me with odbc support >>>>>>>> but i have compilend by hand (sip >>>>>>>> and pyqt, qt installed from binary) i dont know if binary packages >>>>>>>> fail, i have a problem with odbc in >>>>>>>> linux but in windows works very well. >>>>>>>> >>>>>>> I have also compiled by hand sip and PyQt, and instaled qt from >>>>>>> binary, but didn't got QODBC available. >>>>>>> >>>>>>> What options did you gave the PyQt's configure.py? >>>>>>> >>>>>>> >>>>>>> Paulino >>>>>>> >>>>>>> >>>>>> Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7, >>>>>> python 2.5.1 and >>>>>> qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any options in >>>>>> configure.py, it detects qsql and >>>>>> qodbc while compiling and works ok. >>>>>> >>>>>> >>>>> I used the same packages you refer! >>>>> >>>>> I wonder why it didn't detected QODBC >>>>> >>>>> Paulino >>>>> >>>>> >>>> i have in c:\qt\4.3.1\plugins\sqldrivers\ the files: >>>> >>>> libqsqlodbc4.a >>>> qsqlodbc4.dll >>>> >>>> do you have the same? >>>> >>>> >>> Yes, and also: >>> libqsqlite4.a >>> qsqlite4.dll >>> >>> But don't have any driver available. >>> >>> Paulino >>> >>> >> >> i would try recompiling sip and later pyqt, if you have no luck i can try in >> other virtual machine to see >> if it works for me other time. >> >> >> > I tried for 3 times - one on a clean virtual machine. No drivers available. Paulino i have tried today in a clean virtual machine and it works for me, i have done this: install mingw-5.1.3.exe install qt-win-opensource-4.3.1-mingw.exe install python-2.5.1.msi install pywin32-210.win32-py2.5.exe add to system path variable: c:\python25;C:\MinGW\libexec\gcc\mingw32\3.4.2;c:\MinGW\bin;C:\Qt\4.3.1\bin cd into sip-4.7 directory: python configure.py mingw32-make mingw32-make install cd into PyQt-win-gpl-4.3 python configure.py mingw32-make mingw32-make install And later it works well for me, i have odbc drivers and it works, i connect to an odbc source with this code. - import os, sys from PyQt4.QtCore import * from PyQt4.QtSql import * from PyQt4.QtGui import * def conectarMaxdb(): '''conexion via ODBC con QT a MAXDB''' maxdb = QSqlDatabase.addDatabase("QODBC", 'maxdb') maxdb.setDatabaseName("DRIVER={MaxDB (Unicode)};HOSTNAME=192.168.1.20;DATABASE=MAXDB2") --> windows code dsn less maxdb.setUserName("FAKE") maxdb.setPassword("FAKE") aperturamaxdb = maxdb.open() if not aperturamaxdb: QMessageBox.warning(None, "Error conexion con la DB", QString("Database Error: %1").arg(maxdb.lastError().text())) sys.exit(1) return maxdb if __name__ == "__main__": app = QApplication(sys.argv) dbmaxdb = conectarMaxdb() print dbmaxdb.isOpen() -> print True print dbmaxdb.isValid() > print True - I hope this can help you. Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: Build PyQt with sql Driver plugins
[EMAIL PROTECTED] escribió: > > Citando Linos <[EMAIL PROTECTED]>: > >> [EMAIL PROTECTED] escribió: >>> >>> Citando Linos <[EMAIL PROTECTED]>: >>> >>>> Paulino escribió: >>>>> *>Linos* info at linos.es >>>>> <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk> >>>>> >>>>> >>>>> />Tue Sep 25 22:21:33 BST 2007/ >>>>> >>>>> >>>>> >>>>>> >>>>>> The last version in windows works very well for me with odbc support >>>>>> but i have compilend by hand (sip >>>>>> and pyqt, qt installed from binary) i dont know if binary packages >>>>>> fail, i have a problem with odbc in >>>>>> linux but in windows works very well. >>>>> >>>>> >>>>> I have also compiled by hand sip and PyQt, and instaled qt from >>>>> binary, but didn't got QODBC available. >>>>> >>>>> What options did you gave the PyQt's configure.py? >>>>> >>>>> >>>>> Paulino >>>>> >>>> Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7, >>>> python 2.5.1 and >>>> qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any options in >>>> configure.py, it detects qsql and >>>> qodbc while compiling and works ok. >>>> >>> >>> I used the same packages you refer! >>> >>> I wonder why it didn't detected QODBC >>> >>> Paulino >>> >> >> i have in c:\qt\4.3.1\plugins\sqldrivers\ the files: >> >> libqsqlodbc4.a >> qsqlodbc4.dll >> >> do you have the same? >> > > Yes, and also: > libqsqlite4.a > qsqlite4.dll > > But don't have any driver available. > > Paulino > i would try recompiling sip and later pyqt, if you have no luck i can try in other virtual machine to see if it works for me other time. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: Build PyQt with sql Driver plugins
[EMAIL PROTECTED] escribió: > > Citando Linos <[EMAIL PROTECTED]>: > >> Paulino escribió: >>> *>Linos* info at linos.es >>> <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk> >>> >>> />Tue Sep 25 22:21:33 BST 2007/ >>> >>> >>>> >>>> The last version in windows works very well for me with odbc support >>>> but i have compilend by hand (sip >>>> and pyqt, qt installed from binary) i dont know if binary packages >>>> fail, i have a problem with odbc in >>>> linux but in windows works very well. >>> >>> >>> I have also compiled by hand sip and PyQt, and instaled qt from >>> binary, but didn't got QODBC available. >>> >>> What options did you gave the PyQt's configure.py? >>> >>> >>> Paulino >>> >> Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7, >> python 2.5.1 and >> qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any options in >> configure.py, it detects qsql and >> qodbc while compiling and works ok. >> > > I used the same packages you refer! > > I wonder why it didn't detected QODBC > > Paulino > i have in c:\qt\4.3.1\plugins\sqldrivers\ the files: libqsqlodbc4.a qsqlodbc4.dll do you have the same? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: Build PyQt with sql Driver plugins
Paulino escribió: > *>Linos* info at linos.es > <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk> > />Tue Sep 25 22:21:33 BST 2007/ > > >> >>The last version in windows works very well for me with odbc support but i >>have compilend by hand (sip >>and pyqt, qt installed from binary) i dont know if binary packages fail, i >>have a problem with odbc in >>linux but in windows works very well. > > > I have also compiled by hand sip and PyQt, and instaled qt from binary, but > didn't got QODBC available. > > What options did you gave the PyQt's configure.py? > > > Paulino > Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7, python 2.5.1 and qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any options in configure.py, it detects qsql and qodbc while compiling and works ok. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Build PyQt with sql Driver plugins
The last version in windows works very well for me with odbc support but i have compilend by hand (sip and pyqt, qt installed from binary) i dont know if binary packages fail, i have a problem with odbc in linux but in windows works very well. Phil Thompson escribió: > On Tuesday 25 September 2007, [EMAIL PROTECTED] wrote: >> In the Pyqt4 docs i find the option -t PLUGIN for the configure command. >> >> By "PLUGIN" I shall write the dll filename (qtsqlodbc4.dll) or the >> driver name QODBC, or the full path to the dll? >> >> I tried -t qtsqlodbc4 and don't have the driver availlable. > > The docs say that the flag is to be used when Qt has been built as static > libraries - so there won't be any .dll files. Look in the plugin directories > to see what .lib files have been created when Qt was built. > > Phil > ___ > 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] ODBC QSqlQuery]
No Paulino, in the first email i explain better, i am trying to access a maxdb server and odbc drivers works very well in unixodbc isql command line, i can log and do sql sentences without problem, but from pyqt i can do the connection but the query it is False ever. Here you have the complete first report: http://www.riverbankcomputing.com/pipermail/pyqt/2007-September/017228.html . Best Regards, Miguel Angel. Paulino escribió: > > I guess You want to acces a MS-SQL Server or MS-Access database from a > linux box, in order to use ODBC... > > If so, this thread may have the answear: > > http://lists.trolltech.com/qt-interest/2003-10/thread00164-0.html > > "(...) > > To access MSSQL on Linux you will need a Linux ODBC driver that can talk > to the MSSQL server. I think there are commercial options for this as > well as an open source project called FreeTDS. I haven't used any other > the products so I can't confirm how they work but do some searching > about on the internet and you should be able to find something. The > commerical sites I found using google are www.easysoft.com and > www.openlinksw.com. > (...)" > > Paulino > >> >> >> Date: Sun, 23 Sep 2007 13:23:24 +0200 >> From: Linos <[EMAIL PROTECTED]> >> Subject: [Fwd: [PyQt] ODBC QSqlQuery] >> To: pyqt@riverbankcomputing.com >> Message-ID: <[EMAIL PROTECTED]> >> Content-Type: text/plain; charset="iso-8859-15" >> >> Hello, >> no one has been the same problem? anyone has used odbc access with >> pyqt4 with qt4 in linux with sucess? >> i cant find a solution myself... >> >> Regards, >> Miguel Angel. >> -- next part -- >> An embedded message was scrubbed... >> From: unknown sender >> Subject: no subject >> Date: no date >> Size: 5471 >> Url: >> http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070923/1ff5d404/PyQtODBCQSqlQuery-0001.eml >> >> >> -- >> >> >> >> >> > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[Fwd: [PyQt] ODBC QSqlQuery]
Hello, no one has been the same problem? anyone has used odbc access with pyqt4 with qt4 in linux with sucess? i cant find a solution myself... Regards, Miguel Angel. --- Begin Message --- Return-Path: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] Received: (qmail 26426 invoked by uid 1010); 19 Sep 2007 12:18:08 +0200 Received: from 209.249.12.202 by centrodatos (envelope-from <[EMAIL PROTECTED]>, uid 1009) with qmail-scanner-2.01st (clamdscan: 0.90.1/2930. spamassassin: 3.1.8. perlscan: 2.01st. Clear:RC:0(209.249.12.202):SA:0(4.4/7.0):. Processed in 4.120808 secs); 19 Sep 2007 10:18:08 - X-Spam-Status: No, hits=4.4 required=7.0 X-Spam-Level: X-Antivirus-LINOS-Mail-From: [EMAIL PROTECTED] via centrodatos X-Antivirus-LINOS: 2.01st (Clear:RC:0(209.249.12.202):SA:0(4.4/7.0):. Processed in 4.120808 secs Process 26403) Received: from 209-249-12-202.ip.openhosting.com (HELO riverbankcomputing.com) (209.249.12.202) by linos.es with SMTP; 19 Sep 2007 12:18:04 +0200 Received: from rvrbank.user.openhosting.com (rvrbank.user.openhosting.com [209.249.12.202]) by riverbankcomputing.com (8.13.6/8.13.6) with ESMTP id l8JAGneg010182; Wed, 19 Sep 2007 11:17:07 +0100 Received: from linos.es (centrodatos.linos.es [86.109.104.181]) by riverbankcomputing.com (8.13.6/8.13.6) with ESMTP id l8JAGldZ010169 for ; Wed, 19 Sep 2007 11:16:48 +0100 Received: (qmail 23647 invoked by uid 1010); 19 Sep 2007 12:07:53 +0200 Received: from 87.220.87.100 ([EMAIL PROTECTED]@87.220.87.100) by centrodatos (envelope-from <[EMAIL PROTECTED]>, uid 1009) with qmail-scanner-2.01st (clamdscan: 0.90.1/2930. spamassassin: 3.1.8. perlscan: 2.01st. Clear:RC:0(87.220.87.100):SA:0(5.6/7.0):. Processed in 3.453316 secs); 19 Sep 2007 10:07:53 - X-Antivirus-LINOS-MOVED-X-Spam-Status: No, hits=5.6 required=7.0 X-Antivirus-LINOS-MOVED-X-Spam-Level: + X-Antivirus-LINOS-Mail-From: [EMAIL PROTECTED] via centrodatos X-Antivirus-LINOS: 2.01st (Clear:RC:0(87.220.87.100):SA:0(5.6/7.0):. Processed in 3.453316 secs Process 23609) Received: from 100.87.220.87.dynamic.jazztel.es (HELO ?192.168.1.4?) ([EMAIL PROTECTED]@87.220.87.100) by linos.es with SMTP; 19 Sep 2007 12:07:50 +0200 Message-ID: <[EMAIL PROTECTED]> Date: Wed, 19 Sep 2007 12:16:37 +0200 From: Linos <[EMAIL PROTECTED]> User-Agent: Thunderbird 2.0.0.6 (X11/20070803) MIME-Version: 1.0 To: pyqt@riverbankcomputing.com Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [PyQt] ODBC QSqlQuery X-BeenThere: pyqt@riverbankcomputing.com X-Mailman-Version: 2.1.5 Precedence: list List-Id: Python Bindings for Qt and KDE List-Unsubscribe: <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>, <mailto:[EMAIL PROTECTED]> List-Archive: <http://www.riverbankcomputing.com/pipermail/pyqt> List-Post: <mailto:pyqt@riverbankcomputing.com> List-Help: <mailto:[EMAIL PROTECTED]> List-Subscribe: <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>, <mailto:[EMAIL PROTECTED]> Sender: [EMAIL PROTECTED] Errors-To: [EMAIL PROTECTED] Hello, i have a problem with QSqlQuery accessing a dsn in linux, i have no problem with exactly the same code in windows and i check i have correctly opened the datasource, here i paste the relevant code snippets. - import os, sys, time, re from PyQt4.QtCore import * from PyQt4.QtSql import * from PyQt4.QtGui import * def conectarMaxdb(): '''conexion via ODBC con QT a MAXDB''' maxdb = QSqlDatabase.addDatabase("QODBC", 'maxdb') #maxdb.setDatabaseName("DRIVER={MaxDB (Unicode)};HOSTNAME=192.168.1.20;DATABASE=MAXDB2") --> windows code dsn less maxdb.setDatabaseName("DRIVER={MAXDB};ServerNode=192.168.1.20;ServerDB=MAXDB2") --> linux code dsn less #maxdb.setDatabaseName("DATABASE") --> linux code with dsn maxdb.setUserName("FAKE") maxdb.setPassword("FAKE") aperturamaxdb = maxdb.open() if not aperturamaxdb: QMessageBox.warning(None, "Error conexion con la DB", QString("Database Error: %1").arg(maxdb.lastError().text())) sys.exit(1) return maxdb if __name__ == "__main__": app = QApplication(sys.argv) dbmaxdb = conectarMaxdb() print dbmaxdb.isOpen() -> print True print dbmaxdb.isValid() > print True query1maxdb =QSqlQuery(dbmaxdb) query1maxdb.exec_(QString("SELECT * FROM DATOS_ANTIGUOS.CLIENTES_ANTIGUO WHERE CLI='03'")) query1maxdb.next() print query1maxdb.isValid() ---> print False in linux, True in windows ---
[PyQt] ODBC QSqlQuery
Hello, i have a problem with QSqlQuery accessing a dsn in linux, i have no problem with exactly the same code in windows and i check i have correctly opened the datasource, here i paste the relevant code snippets. - import os, sys, time, re from PyQt4.QtCore import * from PyQt4.QtSql import * from PyQt4.QtGui import * def conectarMaxdb(): '''conexion via ODBC con QT a MAXDB''' maxdb = QSqlDatabase.addDatabase("QODBC", 'maxdb') #maxdb.setDatabaseName("DRIVER={MaxDB (Unicode)};HOSTNAME=192.168.1.20;DATABASE=MAXDB2") --> windows code dsn less maxdb.setDatabaseName("DRIVER={MAXDB};ServerNode=192.168.1.20;ServerDB=MAXDB2") --> linux code dsn less #maxdb.setDatabaseName("DATABASE") --> linux code with dsn maxdb.setUserName("FAKE") maxdb.setPassword("FAKE") aperturamaxdb = maxdb.open() if not aperturamaxdb: QMessageBox.warning(None, "Error conexion con la DB", QString("Database Error: %1").arg(maxdb.lastError().text())) sys.exit(1) return maxdb if __name__ == "__main__": app = QApplication(sys.argv) dbmaxdb = conectarMaxdb() print dbmaxdb.isOpen() -> print True print dbmaxdb.isValid() > print True query1maxdb =QSqlQuery(dbmaxdb) query1maxdb.exec_(QString("SELECT * FROM DATOS_ANTIGUOS.CLIENTES_ANTIGUO WHERE CLI='03'")) query1maxdb.next() print query1maxdb.isValid() ---> print False in linux, True in windows - When i use unixODBC commandline tool isql with "isql DATABASE FAKE FAKE" i can do SQL commands in the datasource, i have tested in gentoo (gentoo ebuilds) and debian (hand-compiled) with exactly the same results, the same code works well in windows (i only have to uncomment, comment the setDatabaseName method because changes in param names), anyone knows what can be the problem? Best Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt