Re: [PyQt] ANN: SIP v4.15.1 Released
On Freitag, 23. August 2013 18:44:38 Phil Thompson wrote: SIP v4.15.1 has been released. This fixes a regression in v4.15 related to the handling of hidden virtual methods. PyQt is unaffected. Well, but PyQt3 is: [ 121s] g++ -c -pipe -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DUSE_LIB64_PATHES -fno-strict-aliasing -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DUSE_LIB64_PATHES -fno-strict-aliasing -Wall -W -D_REENTRANT -DNDEBUG -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I. -I/usr/include/ -I/usr/include/python2.7 -I/usr/lib/qt3/mkspecs/default -I/usr/lib/qt3/include -I/usr/X11R6/include -o sipqtQLayout.o sipqtQLayout.cpp [ 121s] qt/sipqtQLayout.cpp: In function 'void* init_QLayout(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)': [ 121s] qt/sipqtQLayout.cpp:1801:48: error: cannot allocate an object of abstract type 'sipQLayout' [ 121s] qt/sipqtQLayout.cpp:105:7: note: because the following virtual functions are pure within 'sipQLayout': [ 121s] In file included from /usr/lib/qt3/include/qabstractlayout.h:50:0, [ 121s] from sip/qt/qlayout.sip:274: [ 121s] /usr/lib/qt3/include/qlayout.h:234:10: note: virtual void QLayout::setGeometry(const QRect) [ 121s] /usr/lib/qt3/include/qlayout.h:235:21: note: virtual QLayoutIterator QLayout::iterator() [ 121s] /usr/lib/qt3/include/qlayout.h:234:10: note: virtual void QLayout::setGeometry(const QRect) [ 121s] /usr/lib/qt3/include/qlayout.h:235:21: note: virtual QLayoutIterator QLayout::iterator() [ 121s] qt/sipqtQLayout.cpp:1816:45: error: cannot allocate an object of abstract type 'sipQLayout' [ 121s] qt/sipqtQLayout.cpp:105:7: note: since type 'sipQLayout' has pure virtual functions [ 121s] qt/sipqtQLayout.cpp:1830:42: error: cannot allocate an object of abstract type 'sipQLayout' [ 121s] qt/sipqtQLayout.cpp:105:7: note: since type 'sipQLayout' has pure virtual functions [ 122s] make[1]: *** [sipqtQLayout.o] Error 1 [ 122s] make[1]: *** Waiting for unfinished jobs [ 122s] make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/PyQt-x11-gpl-3.18.1/qt' [ 122s] make: *** [all] Error 2 [ 122s] error: Bad exit status from /var/tmp/rpm-tmp.chPlXv (%build) https://build.opensuse.org/package/show/home:frispete:PyQt/python-qt3 I know, old unsupported stuff, but this is still in heavy use all over the world ;-) Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QGraphicsView very slow under Linux and Mac OS X
On Mittwoch, 3. April 2013 15:50:46 Clemens Brunner wrote: On 04/03/2013 03:24 PM, Andreas Pakulat wrote: first of all, QTimer gives you no guarantee that it'll fire exactly after the given amount of time. In particular not with such small timeouts and when having non-trivial paint functions like yours. QTimer is bound to the event loop, hence cannot fire if the loop is being blocked by something. If you simplify the paint function the effect will be much less dramatic. Yes, I know that QTimer is not a high-precision timer. This is also not a problem in my example, since I can live with a bit of jitter. That being said, here with Qt4.8 even a full-screen window will not cause a significant slowdown, except during the resize phase. Once the resize is done the timer fires every 25 ms again. So I guess the calculation inside the paint function simply take some time and once the widget doesn't resize anymore the paint function is not called anymore. OK, but (1) I was not referring to the resize phase, and (2) this only works well on Windows. On Mac OS X and Linux, the timer depends on the size of the window being updated -- for a full screen window, the timer fires every 100ms (not during the resize) because QGraphicsView cannot handle the computations within a time frame less than 100ms anymore. If you need high precision timers then you'll need to write platform-specific code. QTimer is not meant for that. Why this works better on Windows with Py(Qt/Side) can have many reasons, the whole graphicsstack is different there, the QTimer might be implemented differently there. Maybe windows delays the painting during resize somewhat more so that there are less repaint-events given to Qt or maybe the functions used in your paint() are more optimized on Windows. Well, the fact that it does work equally well on all three platforms when I use Qt directly from a C++ program indicates that this is an issue with the Python wrapper, and not a different implementation within the Qt framework. Furthermore, since PyQt and PySide produce a Python wrapper that does work just like its C++ counterpart under Windows makes me think that it must be an implementation detail of PyQt/PySide that could probably be fixed. What you see is possibly related to the default Qt graphics engine: when using: QT_GRAPHICSSYSTEM=opengl python graphicsviewtest.py the values are oscillating around 150 here. With native and raster, it's back to 25: openSUSE 12.2/x86_64, 2560x1600x32, nvidia proprietary graphics, python: 2.7.3 sip: 4.14.5-snapshot-054f1676c300 qt4: 4.8.4 pyqt4: snapshot-4.10.1-3ade65901e3e Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QGraphicsView very slow under Linux and Mac OS X
On Mittwoch, 3. April 2013 17:28:28 Clemens Brunner wrote: On 04/03/2013 04:23 PM, Hans-Peter Jansen wrote: What you see is possibly related to the default Qt graphics engine: when using: QT_GRAPHICSSYSTEM=opengl python graphicsviewtest.py the values are oscillating around 150 here. With native and raster, it's back to 25: openSUSE 12.2/x86_64, 2560x1600x32, nvidia proprietary graphics, That's what I suspected initially. However, my graphics engine was set to native by default. I just tried all three engines: * native: around 100ms * raster: around 100ms * opengl: greater than 300ms I tested it on Arch Linux x86_64, 1920x1080, python2 2.7.3-4, sip 4.14.5-1, qt4 4.8.4-16, python2-pyqt 4.10-1. Which graphic driver do you use? (that doesn't tell us much, since the C++ version behave with the same driver, just for the record..) That's really weird... I will try to set up an openSUSE box in my VirtualBox to see if that works. Might be worth to compare the C++ version (that you should publish here¹) and the Python versions with perf. Of course, they differ... python versions, perf running for about 10 sec. QT_GRAPHICSSYSTEM=raster perf record -f python graphicsviewtest.py 21,06% python libc-2.15.so [.] __memmove_ssse3_back 3,34% python libc-2.15.so [.] __strcmp_sse42 2,97% python libpython2.7.so.1.0 [.] PyEval_EvalFrameEx 2,67% python libpython2.7.so.1.0 [.] lookdict_string 2,65% python libQtGui.so.4.8.4[.] QWidget::qt_metacast(char const*) 2,42% python libGL.so.304.64 [.] 0x000a01ed 1,50% python libnvidia-tls.so.304.64 [.] 0x1c70 1,27% python libpython2.7.so.1.0 [.] PyDict_GetItem 1,12% python libpthread-2.15.so [.] pthread_mutex_lock 1,07% python sip.so [.] parsePass1 1,04% python libpthread-2.15.so [.] __pthread_mutex_unlock_usercnt 1,03% python libQtCore.so.4.8.4 [.] QObject::qt_metacast(char const*) 1,00% python libpython2.7.so.1.0 [.] _init QT_GRAPHICSSYSTEM=opengl perf record -f python graphicsviewtest.py 10,12% python libpython2.7.so.1.0 [.] PyEval_EvalFrameEx 4,94% python libpython2.7.so.1.0 [.] lookdict_string 4,63% python libnvidia-glcore.so.304.64 [.] 0x013aed80 3,53% python sip.so [.] parsePass1 3,26% python libpython2.7.so.1.0 [.] PyDict_GetItem 2,68% python libpython2.7.so.1.0 [.] _PyType_Lookup 1,91% python libm-2.15.so[.] __sin_sse2 1,72% python libQtGui.so.4.8.4 [.] QBrush::~QBrush() 1,69% python libQtOpenGL.so.4.8.4[.] QTriangulatingStroker::process(QVectorPath const, QPen const, QRectF 1,51% python libpython2.7.so.1.0 [.] _init 1,39% python libpython2.7.so.1.0 [.] binary_op1 1,29% python libpython2.7.so.1.0 [.] _PyObject_GenericGetAttrWithDict 1,27% python sip.so [.] parsePass2 1,21% python libGL.so.304.64 [.] 0x000a19c6 1,16% python libQtOpenGL.so.4.8.4[.] QTriangulatingStroker::moveTo(double const*) 1,15% python libpython2.7.so.1.0 [.] PyErr_Restore 1,11% python libc-2.15.so[.] _int_free 1,09% python libc-2.15.so[.] malloc 1,08% python libQtGui.so.4.8.4 [.] QPainter::drawLines(QLine const*, int) 1,00% python libQtOpenGL.so.4.8.4[.] QGL2PaintEngineExPrivate::updateMatrix() The former looks nice, it's a great example, why PyQt rocks. The hottest areas are there, where they should be: down under, moving bits. Great. But the latter looks strange indeed. Phil, do you have any idea, why PyEval_EvalFrameEx is the top sucker in this scenario? This looks, like in opengl mode, it is evaluating some python expression in its hottest path (data type conversions or the like?). BTW: the opengl version crashes always on exit for me: Program received signal SIGSEGV, Segmentation fault. XQueryExtension (dpy=dpy@entry=0x0, name=name@entry=0x70a374b4 GLX, major_opcode=major_opcode@entry= 0x7fffd104, first_event=first_event@entry=0x7fffd108, first_error=first_error@entry=0x7fffd10c) at QuExt.c:57 #0 XQueryExtension (dpy=dpy@entry=0x0, name=name@entry=0x70a374b4 GLX, major_opcode=major_opcode@entry= 0x7fffd104, first_event=first_event@entry=0x7fffd108, first_error=first_error@entry=0x7fffd10c) at QuExt.c:57 rep = {type = 0 '\000', pad1 = 0 '\000', sequenceNumber = 0, length = 0, present = 0 '\000', major_opcode = 0 '\000', first_event = 0 '\000', first_error = 0 '\000', pad3 = 1, pad4 = 0, pad5 = 0, pad6 = 4036989387, pad7 = 32767} req = optimized out #1 0x72813492 in XInitExtension (dpy=dpy@entry=0x0, name=name@entry=0x70a374b4 GLX) at InitExt.c:47 codes = {extension = 9386192
Re: [PyQt] PyQt4 original example “dbus” bugged
On Mittwoch, 3. April 2013 18:17:46 Pietro Moras wrote: Hi Andreas, I've not misunderstood, you have. In the sense that “\example\dbus” here considered is an original example provided into the original PyQt4 package and, therefore, as such supposed to work as a model from which to learn how to use it. If not working into the target platform (probably there “forgotten” from other packages aimed at other platforms) it means it is misleading. Feel free to port the dbus stuff to Windows, and you will quickly realize, why it was left out by the Qt developers in the first place... Since PyQt is multi platform by definition, all its examples should be provided everywhere. If you really like to contribute something easy, send over a patch for that example, that shows a QDialog noting DBus is not supported on this platform and exits, if importing QtDBus fails. Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] eric4 and PyQt dtors
Hi Phil, If I remember correctly, you talked about making a new termination scheme default, where you don't call any dtors from a certain point in the termination process. Is this already available as an option? When leaving eric4 running for an extended period of time, I *always* harvest belows seg fault on termination, with current sip/PyQt snapshots. I guess, such an option would be easier then hunting and deleting the last forgotten menu item... Cheers, Pete Application: eric4 (python2.7), signal: Segmentation fault Using host libthread_db library /lib64/libthread_db.so.1. [Current thread is 1 (Thread 0x7faa86595700 (LWP 5604))] Thread 2 (Thread 0x7faa62a5b700 (LWP 9430)): #0 0x7faa85b2a14f in __GI___poll (fds=optimized out, nfds=optimized out, timeout=optimized out) at ../sysdeps/unix/sysv/linux/poll.c:87 #1 0x7faa83991684 in g_main_context_poll (n_fds=1, fds=0x7faa5801d680, timeout=-1, context=0x7faa58002720, priority=optimized out) at gmain.c:3440 #2 g_main_context_iterate (context=context@entry=0x7faa58002720, block=block@entry=1, dispatch=dispatch@entry=1, self=optimized out) at gmain.c:3141 #3 0x7faa839917a4 in g_main_context_iteration (context=0x7faa58002720, may_block=1) at gmain.c:3207 #4 0x7faa84725166 in QEventDispatcherGlib::processEvents (this=0x7faa5801bee0, flags=...) at kernel/qeventdispatcher_glib.cpp:426 #5 0x7faa846f597f in QEventLoop::processEvents (this=this@entry=0x7faa62a5ae50, flags=...) at kernel/qeventloop.cpp:149 #6 0x7faa846f5c08 in QEventLoop::exec (this=0x7faa62a5ae50, flags=...) at kernel/qeventloop.cpp:204 #7 0x7faa845f80e0 in QThread::exec (this=optimized out) at thread/qthread.cpp:542 #8 0x7faa846d60ef in QInotifyFileSystemWatcherEngine::run (this=0x76477a0) at io/qfilesystemwatcher_inotify.cpp:256 #9 0x7faa845fb0bc in QThreadPrivate::start (arg=0x76477a0) at thread/qthread_unix.cpp:338 #10 0x7faa85dfae0e in start_thread (arg=0x7faa62a5b700) at pthread_create.c:305 #11 0x7faa85b322cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115 Thread 1 (Thread 0x7faa86595700 (LWP 5604)): [KCrash Handler] #6 0x7faa81fcf41a in QWidgetPrivate::deleteTLSysExtra (this=0x632e390) at kernel/qwidget_x11.cpp:2884 #7 0x7faa81f8711e in QWidgetPrivate::deleteExtra (this=this@entry=0x632e390) at kernel/qwidget.cpp:1834 #8 0x7faa81f8734d in QWidgetPrivate::~QWidgetPrivate (this=0x632e390, __in_chrg=optimized out) at kernel/qwidget.cpp:361 #9 0x7faa8237c7f9 in ~QMenuPrivate (this=0x632e390, __in_chrg=optimized out) at widgets/qmenu_p.h:171 #10 QMenuPrivate::~QMenuPrivate (this=0x632e390, __in_chrg=optimized out) at widgets/qmenu_p.h:183 #11 0x7faa8470d1cc in cleanup (pointer=optimized out) at ../../src/corelib/tools/qscopedpointer.h:62 #12 ~QScopedPointer (this=0x632e328, __in_chrg=optimized out) at ../../src/corelib/tools/qscopedpointer.h:100 #13 QObject::~QObject (this=0x632e320, __in_chrg=optimized out) at kernel/qobject.cpp:816 #14 0x7faa81f89440 in QWidget::~QWidget (this=0x632e320, __in_chrg=optimized out) at kernel/qwidget.cpp:1556 #15 0x7faa82e8c189 in sipQMenu::~sipQMenu (this=0x632e320, __in_chrg=optimized out) at sipQtGuiQMenu.cpp:316 #16 0x7faa82e8aeb6 in release_QMenu (sipCppV=0x632e320) at sipQtGuiQMenu.cpp:2785 #17 0x7faa834d5bee in forgetObject (sw=sw@entry=0x620) at siplib.c:10427 #18 0x7faa834d7549 in sipWrapper_dealloc (self=0x620) at siplib.c:9979 #19 0x7faa860b8c76 in subtype_dealloc (self=0x620) at Objects/typeobject.c:1014 #20 0x7faa860b2a78 in dict_dealloc (mp=0x631e2d0) at Objects/dictobject.c:985 #21 0x7faa860b2a50 in dict_dealloc (mp=0x7faa54261a80) at Objects/dictobject.c:985 #22 0x7faa834d5033 in sipSimpleWrapper_clear (self=self@entry=0x5fd3200) at siplib.c:9559 #23 0x7faa834d74c2 in sipWrapper_clear (self=0x5fd3200) at siplib.c:9940 #24 0x7faa8610e17d in delete_garbage (old=0x7faa86391f60 generations+96, collectable=0x7b1e86f0) at Modules/gcmodule.c:769 #25 collect (generation=2) at Modules/gcmodule.c:930 #26 0x7faa8610e661 in PyGC_Collect () at Modules/gcmodule.c:1386 #27 0x7faa86103724 in Py_Finalize () at Python/pythonrun.c:444 #28 0x7faa86103248 in Py_Exit (sts=0) at Python/pythonrun.c:1760 #29 0x7faa8610333f in handle_system_exit () at Python/pythonrun.c:1134 #30 0x7faa861033f5 in PyErr_PrintEx (set_sys_last_vars=set_sys_last_vars@entry=1) at Python/pythonrun.c:1144 #31 0x7faa8610369a in PyErr_Print () at Python/pythonrun.c:1047 #32 0x7faa86103a2b in PyRun_SimpleFileExFlags (fp=optimized out, fp@entry=0x2339450, filename=optimized out, filename@entry=0x7b1e9268 /usr/lib64/python2.7/site-packages/eric4/eric4.py, closeit=closeit@entry=1, flags=flags@entry=0x7b1e8920) at Python/pythonrun.c:947 #33 0x7faa86103d33 in PyRun_AnyFileExFlags (fp=fp@entry=0x2339450, filename=filename@entry=0x7b1e9268
Re: [PyQt] PyQt4 issue
Am Dienstag, 5. März 2013, 18:44:24 schrieb Detlev Offenbach: Hello, here is the extract. Checking to see if the QtTest module should be built... g++ -DQT_NO_DEBUG -DQT_TEST_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -I. - I/usr/local/Qt-5.0.1/mkspecs/linux-g++ -I/usr/local/Qt-5.0.1/include/QtTest - I/usr/local/Qt-5.0.1/include -m64 -pipe -O2 -w -D_REENTRANT -fPIE cfgtest_QtTest.cpp -o cfgtest_QtTest -L/usr/local/Qt-5.0.1/lib -Wl,-O1 -Wl,-rpath,/usr/local/Qt-5.0.1/lib -lQt5Test - L/usr/local/Qt-5.0.1/lib -lQt5Core -lpthread -lpthread Checking to see if the QtWebKit module should be built... g++ -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_CORE_LIB -I. - I/usr/local/Qt-5.0.1/mkspecs/linux-g++ -I/usr/local/Qt-5.0.1/include/QtWebKit - I/usr/local/Qt-5.0.1/include/QtWebKitWidgets -I/usr/local/Qt-5.0.1/include/QtCore - I/usr/local/Qt-5.0.1/include -m64 -pipe -O2 -w -D_REENTRANT -fPIE cfgtest_QtWebKit.cpp - o cfgtest_QtWebKit -L/usr/local/Qt-5.0.1/lib -Wl,-O1 -Wl,-rpath,/usr/local/Qt-5.0.1/lib - lQt5WebKit -L/usr/X11R6/lib64 -L/usr/local/Qt-5.0.1/lib -lQt5Network -L/usr/local/Qt-5.0.1/lib - lQt5Core -lpthread -lpthread -lQt5Gui -L/usr/X11R6/lib64 -L/usr/local/Qt-5.0.1/lib -lQt5Core - lpthread -lpthread -lQt5Core -lpthread -lpthread -lQt5Core -lpthread -lpthread /tmp/ccmtGOAm.o: In function `main': cfgtest_QtWebKit.cpp:(.text.startup+0x19): undefined reference to `QWebPage::QWebPage(QObject*)' collect2: error: ld returned 1 exit status Hmm, have you checked the symbols in your libQt5WebKit.so? objdump -T libQt5WebKit.so | grep QWebPage | grep QObject It should show: _ZN8QWebPageC2EP7QObject Feeding to c++filt results in: QWebPage::QWebPage(QObject*) Any other result is an issue down under.. Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QPixmap.loadFromData()
Am Freitag, 25. Januar 2013, 00:41:04 schrieb pa...@paolodestefani.it: Hello I'm trying to create a item delegate for a sql table (postgres db) where i have a field (type bytea) that should contain a PNG image. This is the code of the create editor method: def createEditor(self, parent, option, index): dd = DisplayDialog(parent) ba = index.model().data(index, Qt.DisplayRole) if ba: pix=QPixmap() print(Load, pix.loadFromData(ba, PNG)) try this: print(Load, pix.loadFromData(QByteArray(ba), PNG)) Cheers, Pete dd.lbimage.setPixmap(pix) if dd.exec_() == QDialog.Accepted: pix=dd.getImage() ba = QByteArray() buf = QBuffer(ba) buf.open(QIODevice.WriteOnly) print(Save, pix.save(buf, PNG)) index.model().setData(index, ba, Qt.EditRole) index.model().submit() I want that when te user click in the cell that will contain the PNG image and a dialog popup where a can choose an PNG image file. This dialog have a label that i used for displaying the image (dd.lbimage) But when i test this i see: Load False Save True which means (i guess) tha i can store the image in the db converting it from PNG to QByteArray but when i retrieve it a can not convert from QByteArray to PNG image. What's wrong in my code ? ___ 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] QDBusPendingCall issue with Qt v4.4.3
Hi Phil, as I support some quite old distributions on build service, those builds shake out some compatibility issues. This time, it's related to QDBusPendingCall, which seems to be missing in Qt 4.4.3 at least: [ 267s] This is the GPL version of PyQt 4.9.6 (licensed under the GNU General Public [ 267s] License) for Python 2.6.8 on linux2. [ 267s] Found the license file pyqt-gpl.sip. [ 267s] Checking to see if the QtGui module should be built... [ 267s] Checking to see if the QtHelp module should be built... [ 267s] Checking to see if the QtMultimedia module should be built... [ 267s] Checking to see if the QtNetwork module should be built... [ 267s] Checking to see if the QtDBus module should be built... [ 267s] Checking to see if the QtDeclarative module should be built... [ 267s] Checking to see if the QtOpenGL module should be built... [ 267s] Checking to see if the QtScript module should be built... [ 267s] Checking to see if the QtScriptTools module should be built... [ 267s] Checking to see if the QtSql module should be built... [ 267s] Checking to see if the QtSvg module should be built... [ 267s] Checking to see if the QtTest module should be built... [ 267s] Checking to see if the QtWebKit module should be built... [ 267s] Checking to see if the QtXml module should be built... [ 267s] Checking to see if the QtXmlPatterns module should be built... [ 267s] Checking to see if the phonon module should be built... [ 267s] Checking to see if the QtAssistant module should be built... [ 267s] Checking to see if the QtDesigner module should be built... [ 267s] Checking to see if the dbus support module should be built... [ 267s] Qt v4.4.3 free edition is being used. [ 267s] SIP 4.14.2 is being used. [ 282s] qpydbusreply.cpp:29:28: error: QDBusPendingCall: No such file or directory [ 282s] In file included from qpydbuspendingreply.cpp:30: [ 282s] qpydbuspendingreply.h:32:29: error: QDBusPendingReply: No such file or directory [ 283s] qpydbus_chimera_helpers.cpp: In function 'bool qpydbus_to_pyobject(const QVariant*, PyObject**)': [ 283s] qpydbus_chimera_helpers.cpp:79: error: 'class QDBusArgument' has no member named 'currentType' [ 283s] qpydbus_chimera_helpers.cpp:81: error: 'BasicType' is not a member of 'QDBusArgument' [ 283s] qpydbus_chimera_helpers.cpp:82: error: 'class QDBusArgument' has no member named 'asVariant' [ 283s] qpydbus_chimera_helpers.cpp:85: error: 'VariantType' is not a member of 'QDBusArgument' [ 283s] qpydbus_chimera_helpers.cpp:89: error: 'ArrayType' is not a member of 'QDBusArgument' [ 283s] qpydbus_chimera_helpers.cpp:93: error: 'StructureType' is not a member of 'QDBusArgument' [ 283s] qpydbus_chimera_helpers.cpp:97: error: 'MapType' is not a member of 'QDBusArgument' [ 283s] qpydbus_chimera_helpers.cpp:103: error: 'class QDBusArgument' has no member named 'currentType' [ 283s] qpydbus_chimera_helpers.cpp: In function 'PyObject* from_array_type(const QDBusArgument)': [ 283s] qpydbus_chimera_helpers.cpp:130: error: 'const class QDBusArgument' has no member named 'asVariant' [ 283s] qpydbus_chimera_helpers.cpp: In function 'PyObject* from_structure_type(const QDBusArgument)': [ 283s] qpydbus_chimera_helpers.cpp:164: error: 'const class QDBusArgument' has no member named 'asVariant' [ 283s] qpydbus_chimera_helpers.cpp: In function 'PyObject* from_map_type(const QDBusArgument)': [ 283s] qpydbus_chimera_helpers.cpp:204: error: 'const class QDBusArgument' has no member named 'asVariant' [ 283s] qpydbus_chimera_helpers.cpp:205: error: 'const class QDBusArgument' has no member named 'asVariant' [ 283s] make[2]: *** [qpydbus_chimera_helpers.o] Error 1 [ 283s] make[2]: *** Waiting for unfinished jobs [ 283s] In file included from qpydbuspendingreply.cpp:30: [ 283s] qpydbuspendingreply.h:35: error: expected template-name before '' token [ 283s] qpydbuspendingreply.h:35: error: expected `{' before '' token [ 283s] qpydbuspendingreply.h:35: error: expected unqualified-id before '' token [ 283s] qpydbuspendingreply.cpp:34: error: invalid use of incomplete type 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.h:35: error: forward declaration of 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.cpp:40: error: invalid use of incomplete type 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.h:35: error: forward declaration of 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.cpp:47: error: expected ',' or '...' before '' token [ 283s] qpydbuspendingreply.cpp:47: error: ISO C++ forbids declaration of 'QDBusPendingCall' with no type [ 283s] qpydbuspendingreply.cpp:47: error: invalid use of incomplete type 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.h:35: error: forward declaration of 'class QPyDBusPendingReply' [ 283s] qpydbuspendingreply.cpp:54: error: expected ',' or '...' before '' token [ 283s] qpydbuspendingreply.cpp:54: error: ISO C++ forbids declaration of
Re: [PyQt] HeightForWidth label
Dear Mads, Am Mittwoch, 9. Januar 2013, 15:56:29 schrieb Mads Ipsen: Hi, 4-5 years I needed a widget with the following properties: * Display text incl. HTML * Text should be wrapped on several lines * When the widget is put into a layout, the height of the widget should be adjusted in such a way that the text exactly fits the widget geometry This subwidget should be used in a layout to provide some detail on how the other GUI elements in the layout work but only consume a minimum space to display its content. I thought this was an easy one - but each time I return to the challenge I always end by giving up. The main problem is that the layout breaks down when heightForWidth() is implemented and a QSizePolicy with setHeightForWidth(True) is used. It can shrink to infinitely small. Apparently this is Qt bug. Yes, been there, done that, and failed in similar ways. The best thing I could come up on this was: use a QTextBrowser for the text: self.aboutText.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.aboutText.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.aboutText.setLineWrapMode(QtGui.QTextEdit.NoWrap) self.aboutText.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.aboutText.setHtml(...) w = self.aboutText.document().idealWidth() self.aboutText.document().setTextWidth(w) ds = self.aboutText.document().size() self.aboutText.setMinimumSize(int(ds.width() + 3), int(ds.height() + 3)) self.aboutText.updateGeometry() self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize) with this, you can even provide clickable links (but disable openLinks prop): @QtCore.pyqtSignature(const QUrl ) def on_aboutText_anchorClicked(self, url): QtGui.QDesktopServices.openUrl(url) Maybe it gets you going.. Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Fwd: [Kde-bindings] problem with sip api 2 for QString
Dear Phil, wishing you a successful and pleasable 2013. You might want to look into the attached issue. It looks like it is a sip issue, althrough I wouldn't exclude PyKDE wrapper issues here... Cheers, Pete -- Weitergeleitete Nachricht -- Betreff: [Kde-bindings] problem with sip api 2 for QString Datum: Freitag, 28. Dezember 2012, 15:03:17 Von: Wolfgang Rohdewald wolfg...@rohdewald.de An: KDE bindings for other programming languages kde-bindi...@kde.org Hi, could somebody please have a look at bug 253123? https://bugs.kde.org/show_bug.cgi?id=253123 without this being fixed I will never be able to port the kde game kajongg to the new API. I want to change to the new API before trying the port to python3. re-tested again today: the full test script is: #!/usr/bin/env python3 import sip sip.setapi('QString', 2) from PyKDE4.kdeui import KConfigSkeleton a = KConfigSkeleton() name = 'tilesetName' value = 'I am a value' s = a.addItemString(name, value) print('s.value():', s.value()) # - this prints random garbage, accessing a freed object doing something similar with addItemInt works. it seems the code generated by sip frees the string value object when it should not (by calling sipReleaseType) I know nothing about sip, so I have no idea how to fix this. That bug was always there since I reported it in oct 2010, now I get it with pykde4-4.9.4 with both python 2.7.3 and python 3.2 - so it really is version independent. valgrind says ==6835== Invalid read of size 8 ==6835==at 0x99C74CB: QString::toUcs4() const (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.3) ==6835==by 0xF1B698F: ??? (in /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-32mu.so) ==6835==by 0x79CFB38: sip_api_convert_from_type (in /usr/lib/python3/dist-packages/sip.cpython-32mu.so) ==6835==by 0x1061B01B: meth_KCoreConfigSkeleton_ItemString_value (sipkdecorepart6.cpp:12455) ==6835== Address 0x112f4800 is 0 bytes inside a block of size 8 free'd ==6835==at 0x4C2A44B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==6835==by 0xF0FB872: ??? (in /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-32mu.so) ==6835==by 0x106361F4: meth_KCoreConfigSkeleton_addItemString (sipkdecorepart6.cpp:13726) extracts from sipkdecorepart6.cpp (generated on kubuntu with apt-get --compile source python-kde4): extern C {static PyObject *meth_KCoreConfigSkeleton_ItemString_value(PyObject *, PyObject *);} static PyObject *meth_KCoreConfigSkeleton_ItemString_value(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { KCoreConfigSkeleton::ItemString *sipCpp; if (sipParseArgs(sipParseErr, sipArgs, B, sipSelf, sipType_KCoreConfigSkeleton_ItemString, sipCpp)) { QString *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = sipCpp-value(); --- this is line 12455 Py_END_ALLOW_THREADS return sipConvertFromType(sipRes,sipType_QString,NULL); } } extern C {static PyObject *meth_KCoreConfigSkeleton_addItemString(PyObject *, PyObject *);} static PyObject *meth_KCoreConfigSkeleton_addItemString(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QString * a0; int a0State = 0; QString * a1; int a1State = 0; const QString a2def = QLatin1String(); const QString * a2 = a2def; int a2State = 0; const QString a3def = QString(); const QString * a3 = a3def; int a3State = 0; KCoreConfigSkeleton *sipCpp; if (sipParseArgs(sipParseErr, sipArgs, BJ1J1|J1J1, sipSelf, sipType_KCoreConfigSkeleton, sipCpp, sipType_QString,a0, a0State, sipType_QString,a1, a1State, sipType_QString,a2, a2State, sipType_QString,a3, a3State)) { KCoreConfigSkeleton::ItemString *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = sipCpp-addItemString(*a0,*a1,*a2,*a3); Py_END_ALLOW_THREADS sipReleaseType(const_castQString *(a0),sipType_QString,a0State); sipReleaseType(a1,sipType_QString,a1State); --- this is line 13726 sipReleaseType(const_castQString *(a2),sipType_QString,a2State); sipReleaseType(const_castQString *(a3),sipType_QString,a3State); return sipConvertFromType(sipRes,sipType_KCoreConfigSkeleton_ItemString,NULL); } -- Wolfgang ___ Kde-bindings mailing list kde-bindi...@kde.org https://mail.kde.org/mailman/listinfo/kde-bindings - ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Strange utf-8 conversions in PyQt3
Dear Phil, Am Dienstag, 20. November 2012, 09:56:06 schrieb Phil Thompson: On Wed, 14 Nov 2012 00:39:52 +0100, Hans-Peter Jansen h...@urpla.net wrote: Dear Phil, since one of the more recent versions of SIP (4.14 or 4.14.1), MySQL database table data shows strange characters with PyQt3. The tables hold utf-8 data, and all other database tools handle the utf-8 data as expected. Only PyQt3 apps show this anomaly, PyQt4 is still fine. I can provoke this effect by adding a file sitecustomize.py to /usr/lib64/python2.7/site-packages/, containing: import sys sys.setdefaultencoding('utf-8') Then, a simple query results in: (check 2nd char) LÃBBENAU/SPREEWALD while this was expected: LÜBBENAU/SPREEWALD Converted to hex: 4c c3 83 c2 9c 42 42 45 4e 41 55 2f 53 50 52 45 |LBBENAU/SPRE| 0010 45 57 41 4c 44 0a 4c c3 9c 42 42 45 4e 41 55 2f |EWALD.L..BBENAU/| 0020 53 50 52 45 45 57 41 4c 44 0a|SPREEWALD.| 002a Obviously, bytes 1-5 are converted in some strange way (like encoding utf-8 two times). The bytes at offset 23 and 24 are the expected ones (utf-8 capital U umlaut). If I remove sitecustomize.py, simple queries work, but feeding values as QStrings back into any UI object results in the same mess (e.g. reimplemented QDataTable.paintField, that formats some value, and calls painter.drawText). Does all this ring a bell for you? I'm pretty busted ATM. TIA, Pete python: 2.7.3 sip:4.14 qt4:4.8.3 pyqt4: 4.9.5 qt3:3.3.8c pyqt3: 3.18.1 It's not an x86_64 vs i586 issue at least. Nothing springs to mind, but it's not something I'm going to put any time into. You might try... http://www.riverbankcomputing.com/static/Docs/sip4/using.html#building-a-pri vate-copy-of-the-sip-module ...with a known working version of SIP. After further investigation, it became clear, that the sip version was a red herring. Sorry for that claim, Phil. The encoding problem is a result of the mysql clients (= 5.1), that uses utf8 by default, while the qt3 driver misses utf8 support. FWIW. I was able to fix this issue with the attached patch. PeteIndex: b/src/sql/drivers/mysql/qsql_mysql.cpp === --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -44,6 +44,7 @@ #include qdatetime.h #include qvaluevector.h #include qsqlrecord.h +#include qtextcodec.h #define QMYSQL_DRIVER_NAME QMYSQL3 @@ -89,19 +90,72 @@ bool QMYSQLOpenExtension::open( const QS class QMYSQLDriverPrivate { public: -QMYSQLDriverPrivate() : mysql(0) {} +QMYSQLDriverPrivate() : mysql(0), +#ifndef QT_NO_TEXTCODEC + tc(QTextCodec::codecForLocale()) +#else +tc(0), +#endif + {} MYSQL* mysql; +QTextCodec *tc; }; +static inline QString toUnicode(QTextCodec *tc, const char *str) +{ +#ifdef QT_NO_TEXTCODEC +Q_UNUSED(tc); +return QString::fromLatin1(str); +#else +return tc-toUnicode(str); +#endif +} + +static inline QString toUnicode(QTextCodec *tc, const char *str, int length) +{ +#ifdef QT_NO_TEXTCODEC +Q_UNUSED(tc); +return QString::fromLatin1(str, length); +#else +return tc-toUnicode(str, length); +#endif +} + +static inline QByteArray fromUnicode(QTextCodec *tc, const QString str) +{ +#ifdef QT_NO_TEXTCODEC +Q_UNUSED(tc); +return str.toLatin1(); +#else +return tc-fromUnicode(str); +#endif +} + + class QMYSQLResultPrivate : public QMYSQLDriverPrivate { public: -QMYSQLResultPrivate() : QMYSQLDriverPrivate(), result(0) {} +QMYSQLResultPrivate(const QMYSQLDriver* dp) : QMYSQLDriverPrivate(), driver(dp), result(0) {} +const QMYSQLDriver* driver; MYSQL_RES* result; MYSQL_ROW row; QValueVectorQVariant::Type fieldTypes; }; + +#ifndef QT_NO_TEXTCODEC +static QTextCodec* codec(MYSQL* mysql) +{ +#if MYSQL_VERSION_ID = 32321 +QTextCodec* heuristicCodec = QTextCodec::codecForName(mysql_character_set_name(mysql)); +if (heuristicCodec) +return heuristicCodec; +#endif +return QTextCodec::codecForLocale(); +} +#endif // QT_NO_TEXTCODEC + + QSqlError qMakeError( const QString err, int type, const QMYSQLDriverPrivate* p ) { return QSqlError(QMYSQL_DRIVER_NAME : + err, QString(mysql_error( p-mysql )), type, mysql_errno( p-mysql )); @@ -124,6 +178,9 @@ QVariant::Type qDecodeMYSQLType( int mys type = (flags UNSIGNED_FLAG) ? QVariant::ULongLong : QVariant::LongLong; break; case FIELD_TYPE_DECIMAL : +#if defined(FIELD_TYPE_NEWDECIMAL) +case FIELD_TYPE_NEWDECIMAL: +#endif case FIELD_TYPE_FLOAT : case FIELD_TYPE_DOUBLE : type = QVariant::Double; @@ -158,7 +215,7 @@ QVariant::Type qDecodeMYSQLType( int mys QMYSQLResult::QMYSQLResult( const QMYSQLDriver* db ) : QSqlResult( db ) { -d = new QMYSQLResultPrivate
Re: [PyQt] Problems with pyInstaller 2.0 and qt setWindowIcon Command
Am Mittwoch, 14. November 2012, 12:57:05 schrieb James Goss: Hi All, Wondering if anyone can help, Simple Qt Application: |from PyQt4 import QtGui, QtCore import sys, atexit class ApplicationWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(application main window) self.file_menu= QtGui.QMenu('File', self) self.menuBar().addMenu(self.file_menu) self.menuBar().addSeparator() self.main_widget= QtGui.QWidget(self) qApp= QtGui.QApplication(sys.argv) aw= ApplicationWindow() aw.show() sys.exit(qApp.exec_()) qApp.exec_()| Run's without a problem and I can build an exe using pyInstaller which also runs fine. I add the lines: |iconfile= QtGui.QIcon('C:/pyinstaller/img/image1.png') aw.setWindowIcon() | Just before aw.show() (also tried in other places throughout the code) This run's fine as a python file but when built using pyInstaller the exe crashes at run-time, I've tried using resource files and other image formats but the problem remains. Of course, you _need_ to use a resource file, that you compile with pyrcc4 and import accordingly. E.g. import test_rc [...] iconfile = QtGui.QIcon(':/image1.png') The test.qrc may look like: RCC qresource file alias=image1.pngimg/image1.png/file /qresource /RCC pyrcc4 -o test_rc.py test.qrc Having all resources included in one executable is the reason for pyinstallers existence.. Hth, Pete___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Strange utf-8 conversions in PyQt3
Dear Phil, since one of the more recent versions of SIP (4.14 or 4.14.1), MySQL database table data shows strange characters with PyQt3. The tables hold utf-8 data, and all other database tools handle the utf-8 data as expected. Only PyQt3 apps show this anomaly, PyQt4 is still fine. I can provoke this effect by adding a file sitecustomize.py to /usr/lib64/python2.7/site-packages/, containing: import sys sys.setdefaultencoding('utf-8') Then, a simple query results in: (check 2nd char) LÃBBENAU/SPREEWALD while this was expected: LÜBBENAU/SPREEWALD Converted to hex: 4c c3 83 c2 9c 42 42 45 4e 41 55 2f 53 50 52 45 |LBBENAU/SPRE| 0010 45 57 41 4c 44 0a 4c c3 9c 42 42 45 4e 41 55 2f |EWALD.L..BBENAU/| 0020 53 50 52 45 45 57 41 4c 44 0a|SPREEWALD.| 002a Obviously, bytes 1-5 are converted in some strange way (like encoding utf-8 two times). The bytes at offset 23 and 24 are the expected ones (utf-8 capital U umlaut). If I remove sitecustomize.py, simple queries work, but feeding values as QStrings back into any UI object results in the same mess (e.g. reimplemented QDataTable.paintField, that formats some value, and calls painter.drawText). Does all this ring a bell for you? I'm pretty busted ATM. TIA, Pete python: 2.7.3 sip:4.14 qt4:4.8.3 pyqt4: 4.9.5 qt3:3.3.8c pyqt3: 3.18.1 It's not an x86_64 vs i586 issue at least.___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Python3.2 and PyQt 4.9.5 : undefined symbol: PyUnicode_AsLatin1String
Am Donnerstag, 25. Oktober 2012, 11:54:24 schrieb t...@tobix.eu: Hello, when using python 3.2 to run any python program that uses PyQt 4.9.5 I get the following error: ImportError: /usr/local/lib/python3.2/site-packages/PyQt4/QtCore.so: undefined symbol: PyUnicode_AsLatin1String My setup is: Ubuntu 11.10 Qt 4.8.1 Python 3.2.3 Sip 4.14 PyQt 4.9.5 Before I used Python 3.3 having no problems. Then I had to move to Python 3.2.3. So I compiled and installed Sip and PyQt again for use with Python 3.2.3. I would be pleased to get any suggestions, Obviously, you still have a python/PyQt mismatch for some reason (probably because mixing distribution packages and manually installed ones). I would start over, but build packages the way, your distribution does. Codeword: deterministic setups. Pete___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] clipboard not work on GNOME/Unity?
Am Thursday 20 September 2012 06:36:33 schrieb zw g: Can anyone help me on this? Still stuck. This is rather OT, and you failed to RTFM. http://doc.qt.digia.com/4.7-snapshot/qclipboard.html#notes-for-x11-users Pete Thanks. On Tue, Sep 11, 2012 at 10:12 AM, zw g pekingmas...@gmail.com wrote: Anyone? Some suggestion would be fine. Thanks. On Sat, Sep 8, 2012 at 8:17 PM, zw g pekingmas...@gmail.com wrote: Dear list, How can i copy files between applications on GNOME/Unity desktop(with Nautilus file manager)? The below code works fine on KDE Mac OS X(Finder), but not work on GNOME/Unity-based desktop. The section marked with *bold* were the part i used for copy paster files. (Paste the files i copied from my PyQt app to somewhere on the filesystem, /home/myuser/, etc.) def buildContextMenu(self): self.contextMenu = QMenu(self) copyAction = QAction(self.trUtf8('Copy'), self) self.contextMenu.addAction(copyAction) self.connect(copyAction, SIGNAL('triggered()'), self.copy2clipboard) def copy2clipboard(self): selectedList = self.selectedIndexes() if selectedList: paths = [] for i in selectedList: p = unicode(i.model().filePath(i)) if p not in paths: paths.append(p) * urls = [QUrl.fromLocalFile(i) for i in paths] mime_data = QMimeData() mime_data.setUrls(urls) clipboard = QApplication.clipboard() clipboard.setMimeData(mime_data)* Any help would be appreciated. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Dilemma: Pqt or wxpython
Am Dienstag, 11. September 2012, 16:39:01 schrieb Gour: On Tue, 11 Sep 2012 15:14:42 +0100 Tony Lynch tly...@xype.com wrote: Qt is much better than wx in general, and more widely used. I'd go for Qt/PyQt every time, One pro for wx might be using native toolkits and (probably) looking better which is possible concern on Windows Mac OS X platforms? Well, after fixing all those platform specific wx glitches and coping with behavior deviations, given those are fixable at python level, you start to get an basic idea, why Qt is done that way. Note, that even the DotNet framework follows a similar approach... While dated, here are some more details: http://www.gossamer-threads.com/lists/python/python/391333?do=post_view_threaded#391333 Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Model/view: values of type Decimal not shown
Am Thursday 26 July 2012 20:24:13 schrieb Sibylle Koczian: Hello, I don't know how to get numeric data from my model to my GUI, if they aren't floats but decimal.Decimal. In the following example the last column of the view and the last QLineEdit of the form both stay empty. The model data are printed to the console and it can be seen that the model contains the correct data for the last column and that they have the right type. But the GUI doesn't show them. What should I change? You need to supply a QStyledItemDelegate to handle decimals. It might be feasible to wrap QDoubleSpinBox as editor widget and access the value with cleanText... I contributed the star delegate demo to demonstrate the delegation facility. Hth, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Creating QSplashScreen with a .gif animation
Am Thursday 19 July 2012 19:46:39 schrieb Itay Brandes: Hey, QtGui.QSplashScreen allows to use a static image source for the splash screen, but does not support .gif animations. How can I bind a QtGui.QMovie to the QtGui.QSplashScreen? There are many snap-ins in C++, like thishttp://www.qtcentre.org/threads/18747-QSplashScreen-loading-icon ?p=92814#post92814, but I'm unfimiliar with them, and fail to convert them to python correctly. Seems pretty straight forward. Start over and post your stub (including a link to the animated gif..). Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Creating QSplashScreen with a .gif animation
Am Friday 20 July 2012 13:55:20 schrieb Itay Brandes: Here they are. As you can see, only the first frame is shown, and the others won't get painted. That's for sure, since you're using a QPixmap to display the gif. That guy did his own QSplashScreen class, where he loads the gif with QMovie, but that approach might lack, too, since QMovie needs the event loop running, which is usually not the case during initialization. Oh well. Pete Thanks. On Fri, Jul 20, 2012 at 10:52 AM, Hans-Peter Jansen h...@urpla.net wrote: Am Thursday 19 July 2012 19:46:39 schrieb Itay Brandes: Hey, QtGui.QSplashScreen allows to use a static image source for the splash screen, but does not support .gif animations. How can I bind a QtGui.QMovie to the QtGui.QSplashScreen? There are many snap-ins in C++, like thishttp://www.qtcentre.org/threads/18747-QSplashScreen-loading- icon ?p=92814#post92814, but I'm unfimiliar with them, and fail to convert them to python correctly. Seems pretty straight forward. Start over and post your stub (including a link to the animated gif..). Pete ___ 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] Packaging Error in python-qt [Linux-RPM]
On Thursday 28 June 2012, 11:05:51 Phil Thompson wrote: On Thu, 28 Jun 2012 10:48:21 +0200, Sascha Manns sascha.ma...@open-slx.de wrote: Hello Phil, Am Donnerstag, 28. Juni 2012, 09:27:03 schrieb Phil Thompson: On Wed, 27 Jun 2012 21:48:10 +0200, Sascha Manns sascha.ma...@open-slx.de wrote: Hello mates, i'm trying to package the python-qt and sip components for our Plasma Active Stack. I'm using PyQt-x11-gpl-4.9.3.tar.bz2 and sip-4.13.3+hg20120627. The sip component is packaged as sip and sip is added as BuildRequire and Require in the python-qt4 spec. But python-qt4 makes trouble. I'm getting: + python configure.py --confirm-license --qsci-api -u Error: This version of PyQt requires SIP v4.13.3 or later How the configure.py script detects the right version? By importing the sipconfig module. Do you have any ideas how i can check, why the sipconfig modules gives the false version? Do i need any other Build Depencies than your SIP Package? I don't know - you are not using packages I provide. I don't provide .bz2 files and I don't know what sip-4.12.3+hg20120627 is. Sascha, just check my packages on OBS: Here: https://build.opensuse.org/project/show?project=home%3Afrispete%3APyQt and here: https://build.opensuse.org/project/show?project=home%3Afrispete%3APyQt-next While they are bit rotten¹ for a while now, the basic specs are sound - all new builds are triggered from scripts, which are running for more than nine month without any human intervention - therefor the outcome is still pretty high ;-) Pete ¹) Beg my pardon, but I'm continuesly overloaded ATM - I will look for these things as soon as possible (which doesn't mean anything)... ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Compiler Flags and PyQt
On Sunday 24 June 2012, 19:32:44 Phil Thompson wrote: On Sun, 24 Jun 2012 12:05:15 -0400, Scott Kitterman deb...@kitterman.com wrote: Passing the CCPFLAGS via CFLAGS/CXXFLAGS as discussed yesterday worked great for SIP4. I it mostly working for PyQT, but it doesn't appear that QtCore/QtGui and the Designer plugin aren't getting the all flags. I'm passing these flags: CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat- security -Werror=format-security -D_FORTIFY_SOURCE=2 CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat- security -Werror=format-security -D_FORTIFY_SOURCE=2 LFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro It looks like QtCore/QtGui aren't getting the CXXFLAGS They are as far as I can see. and the plugin isn't getting the LFLAGS. The Designer plugin is built using qmake and doesn't use the SIP build system. One way to get around this issue is propagating the the compiler flags into all qt project files as QMAKE_CXXFLAGS. @Scott: here's how I solved this (line 96 ff.): https://build.opensuse.org/package/view_file?file=python-qt4.specpackage=python-qt4project=home%3Afrispete%3APyQtrev=6161032f9d1629c3293dd3356c02dc49 Be careful: studying sed scripts on an empty stomach may result in serious personal injury. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] How to exclude the Lineedits in QSpinbox
On Monday 25 June 2012, 15:08:46 mani kandan wrote: How do I classify between the acual lineedits, and lineedits of the spin/double spinboxes? Check the names and avoid the qt ones. While this is dirty as hell, it's quite unlikely, that the qt names will change over time.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Possible bug with new signal-slot connection
Hi Alexander, Am Tuesday 15 May 2012 16:34:05 schrieb Alexander Bruy: Hi all, I try to use new style for signal-slot connection [0] in my project. And have one problem that looks like bug in PyQt. There is a dialog window with QDialogButtonBox, which has two buttons OK and Close. During the program execution I need to change behavior of Close button: pressing this button should not close the dialog but invoke another slot. Apart from your issue, consider to subclass QDialog and reimplement reject to conditionally do what you want without continuously fiddling with {dis,}connect. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Disturbing evidence of garbage collection error
Dear Andrew, Am Sunday 29 April 2012 17:21:34 schrieb Andrew Suffield: On Sun, Apr 29, 2012 at 03:51:43PM +0100, Phil Thompson wrote: You might try keeping explicit references to any objects involved in the query where you might be expecting PyQt to keep the reference for you. At the point when it gets collected, it's still in scope as a local variable of the python function that's currently executing on that thread. This is as horribly wrong as it sounds. I keep thinking it should be memory corruption, but valgrind says it's clean. (After spending most of yesterday trying to figure it out, I gave up and rewrote the database code to use multiprocessing instead of QThreads. Trying to get them to work has resulted in me spending entirely too much time using gdb and valgrind to find bugs in python and Qt; it's not worth the trouble when neither of them are very reliable in the presence of threads. If only QtSql was asynchronous like everything else...) following Eriks suggestion of disabling the GC altogether would have given a valuable data point for your issue. Vanishing still referenced local variables in a thread context is more than a disturbing evidence, that deserves some deep examination. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Cannot 'configure' PyQt4.9 before build on Linuxmint
Dear Brian, Am Tuesday 24 April 2012 19:44:17 schrieb Brian Kelley: I got hit by this as well. Apparently having the correct sip in your path may not be enough. I have attached a script that properly builds sip+qt assuming you have downloaded the current tarballs. It also has the command that fails (SLED10-64/Ubuntu10-64) so Phil can take a look at it. Essentially: I had to specifically tell PyQt's configure where the sip include file (include/sip.h) was. sip -V 4.13.2 which sip .../sip-4.13.2/bin/sip python configure.py \ -q .../Trolltech/Qt-4.8.0/bin/qmake \ -e .../sip-4.13.2/include \ -v .../sip-4.13.2/share/sip Note that -e and -v are the same flags as how you configured sip which is how I figured this out in the first place (purely by serendipity, I copied the wrong configure flags in a shell by accident) I kind of think this might be a bug in the PyQt configure, but then I know all about configuration hell so I have some sympathy ( I had to patch Qt 4.8 to properly build WebKit on SLED10-64 as well ). I don't have sympathy for the amount of time it took me to figure this out though, so hopefully this will help future coders. :) You could have spared a significant amount of your time by simply building sip and friends in openSUSEs build service. That typically results in properly installable packages, and a new target (distribution) is mostly a matter of a few clicks. There are plenty of packages/examples in BS, that could serve as the rpm spec template (including mine found here: https://build.opensuse.org/project/show?project=home%3Afrispete http://download.opensuse.org/repositories/home:/frispete:/ ). Pete Brian On 4/19/12 2:09 PM, murison muri...@alpheratz.net wrote: I, too, am stopped cold by this very same problem. Sip 4.13.2, Python 2.7.3, Qt 4.8.1, PyQt 4.9.1 on Ubuntu 11.10. -- View this message in context: http://python.6.n6.nabble.com/Cannot-configure-PyQt4-9-before-build-on-Lin uxmint-tp2309321p4899103.html Sent from the PyQt mailing list archive at Nabble.com. ___ 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] Designer source
Am Thursday 08 March 2012 23:08:09 schrieb Andreas Pakulat: On 08.03.12 19:42:39, Detlev Offenbach wrote: Am Donnerstag, 8. März 2012, 09:49:41 schrieb Andreas Pakulat: On 08.03.12 09:35:51, Andreas Pakulat wrote: On 07.03.12 16:14:18, JPolk wrote: ...'cause it would make it easier for me to merge Designer with Maya ;-) Write Maya in C++ ;P Hmm, on a more serious note, you won't get around writing C++. AFAIK the public API of the QtDesigner library (and hence also the PyQt module) does not include the necessary functions to actually create a designer yourself. One needs to use one or two private headers from QtDesigner for the necessary functions. You could of course simply wrap that private API in a simple class and expose that via sip to Python and then do all the rest in Python. If somebody would do that and maintain it over time I would be the first to use to integrate Designer into the eric IDE. Its not an easy task though, we had something somewhat-working for KDevelop4 in a plugin, but it did require some nasty hacks and workarounds the designer API. Its simply not really meant to be added to arbitrary IDE's, but mainly geared towards the designer standalone app. Note, I'm basing that information on Qt4.5/4.6, i.e. a point in time where QtCreator was still in its early stages. Maybe in more recent Qt versions this got improved to provide better integration for QtCreator. My humble guess is: it's easier to create a module, that resembles the main designer functionality, than wrapping that biest, given, that a lot of the necessary hacks are done to work around the inflexibility of C++ for that purpose. Some deficits in the process of designing and modifying UIs with designer could be accounted to this fact, too. The price redoing it would be loosing the existing designer plug ins. OTOH, done right, this would allow for user customizable UIs, e.g. Camelot could create standard database layouts, which are *easily* *adjustable* to everyones needs. A well done PyQt property editor would be a great addition the project on its own. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] isRunning() returns true after QThread completion
On Tuesday 28 February 2012, 21:08:46 Lars Beiderbecke wrote: Hello Hans-Peter, Thanks for your answer! The connection type default Qt.AutoConnection should be equivalent to Qt.QueuedConnection, which in turn should be the right kind of connection to avoid race conditions. With both types, however, I do experience a race condition. Correct. With type Qt.DirectConnection on the other hand I get a runtime error TypeError: ack() takes exactly 2 arguments (1 given) that I don't understand at the moment. I've attached a self-contained program that can be run to show the race condition (just configure the path to some large(!) image file). The output of the program is: ~ ./racecond.py START: image.jpg RUN: image.jpg WARNING: thread not finished: image.jpg ACK: image.jpg Again, why is the WARNING printed if run() has completed execution? To quote from the documentation for QueuedConnection: The slot is invoked when control returns to the event loop of the receiver's thread. That should give run() plenty of time to finish after emitting the signal, no? No, signals do not serialize in that way, they only make sure to run in the right context. What you seem to be after is: connect the finished signal in your ImgRequest class to a helper method, from where you emit sigDone. Now, your signals are serialized with the finished threads. Again, new style signals trump, just derive your emitting classes from a QObject descendant (QThread is), define your own signal with: sigDone = QtCore.pyqtSignal(QtCore.QThread) and emit with self.sigDone.emit(self) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] isRunning() returns true after QThread completion
Dear Lars, On Sunday 26 February 2012, 15:55:25 Lars Beiderbecke wrote: Hello, In my application some QThreads still return isRunning() == true when they should be completed. More specifically, I'm using QThreads to load images asynchronously in the background. By emitting a signal, the thread notifies the main window that the pixmap has been loaded and the corresponding widget can be updated (code has been simplified): class ImgRequest(QtCore.QThread): def run(self): # ... load image ... self.emit(QtCore.SIGNAL(sigDone), self) class MainWindow(QtGui.QMainWindow): self.requests = set() def request(self, filename): t = ImgRequest(self, filename) self.connect(t, QtCore.SIGNAL(sigDone), self.ack) self.requests.add(t) t.start() def ack(self, t): # ... update image ... if t.isRunning(): print WARNING: thread still running t.wait() self.requests.remove(t) When I run above code, however, I'll often get WARNING messages, i.e., QThread.isRunning() is returning true even though its corresponding run() method has been completed. Is this merely a race condition between the signal and the actual completion of run(), or am I missing something fundamental about QThreads? Do I really need isRunning() and wait()? Since you don't provide a runnable snippet, all I can do is guessing: check out the Qt.ConnectionType parameter of connect, especially QueuedConnection and BlockingQueuedConnection, and see, if they do, what you're after. While at it, please check out http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/new_style_signals_slots.html to further improve your code. And finally, is there a better way to deal with the QThread objects than storing them in a set so that the GC won't kill them while running? Any scheme, that keeps the thread object reference alive, is fine. BTW, the definition of your requests object is wrong. Either initialize it as an instance variable in __init__ or any subsequent method, or as a class variable omitting self. For the sake of clean code, I would prefer the latter, even in the light of a single instance QMainWindow. Finally, you should limit the number of threads to a sane maximum. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] spreadsheet example
Am Monday 20 February 2012 19:30:06 schrieb Phil Thompson: On Mon, 20 Feb 2012 18:20:32 +0100, Hans-Peter Jansen h...@urpla.net wrote: Am Sunday 19 February 2012 12:47:28 schrieb Phil Thompson: On Sat, 11 Feb 2012 01:36:14 +0100, Hans-Peter Jansen h...@urpla.net wrote: Hi Phil, while I'm seriously overloaded at the moment (a bunch of people are much harder to organize then code), I did some relaxations by converting another fine Qt example. As usual, I couldn't resist in pimping it up in some minor ways. Most prominently, I added a way to change the date format globally. Also, a workaround to fetch the correct cell background color is applied. I removed the workaround as (for me) it doesn't seem to be needed and also it breaks the background of the first and last rows. Not here. Does the background color dialog show the correct color for you in all fields? Here, it's showing black by default, while I use some very different background color. It shows black for white fields, and the correct colour for others. This is the same as the C++ version - this is on a Mac. I was more concerned about the incorrect first and last rows. Yes, the C++ version suffers from the same problem. The idea was: only the initial background color was wrong (all zero), but after setting some valid color, the cell background color behaved well. Since it fails for you, and this is just an example, keeping it bug compatible is preferable. A real application would initialize such properties explicitely via proper interfaces. Have a nice day, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] spreadsheet example
Am Sunday 19 February 2012 12:47:28 schrieb Phil Thompson: On Sat, 11 Feb 2012 01:36:14 +0100, Hans-Peter Jansen h...@urpla.net wrote: Hi Phil, while I'm seriously overloaded at the moment (a bunch of people are much harder to organize then code), I did some relaxations by converting another fine Qt example. As usual, I couldn't resist in pimping it up in some minor ways. Most prominently, I added a way to change the date format globally. Also, a workaround to fetch the correct cell background color is applied. I removed the workaround as (for me) it doesn't seem to be needed and also it breaks the background of the first and last rows. Not here. Does the background color dialog show the correct color for you in all fields? Here, it's showing black by default, while I use some very different background color. One thing escaped me, though: the SpreadSheetItem.clone() method. It is finalized with an instance pointer assignment in C++. I've experimented with the baseclass clone call, which resulted in a strange: item = super(SpreadSheetItem, self).clone() RuntimeError: underlying C/C++ object has been deleted but since this doesn't seem to be intented in the original version, feel free to ignore this. I used super().clone() but I'm not sure if the code was ever executed in my testing. What operation were you doing when it happened? I called it manually to investigate it further, while I noticed, that it never got called in normal operation. Anyway, this example shows the powers of Qt in some nice ways. Hopefully you can include it in the upcoming release. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDockWidget issue in Linux, but not Windows, OSX
Am Monday 13 February 2012 21:37:55 schrieb JPolk: Thanks for your help, Pete While your example does indeed fix the problem that my example code showed, unfortunately, when plugging it in to the real program, the problem persists. However, I have been able to reproduce this bug using just Designer. Yup, sure. Same problem. Why can't you adopt my attempt to your problem? Just replace the parent of the dock with a QMainWindow. Case closed. The second best way is analysing the QMainWindow class and find out, what it is doing special for docking widgets. I guess, they fiddle with the window flags. Your approach will suffer from being unpossible to save the dock states and the like anyway, I *guess*. On Windows here,...run Designer Create a MainWindow (default one do) Drop in a QFrame and pull it to just shy of MainWindow Drop in a QDockWidget Select dockWidget Cut Select QFrame Paste and then run it doing a Form-Preview, ...clicked undock button, behaviour is Normal Did the same thing on Linux, but when I click the undock button, the button is stuck at top, just like our problem. Can anyone else confirm this on Linux ? So that's definitely gotta be a Qt bug, right? If it's one, then it's in the highly obscure class of issues (pretty hard to fully solvable in a multi platform toolkit). Any advice about how to fix ? Thanks! Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QDockWidget issue in Linux, but not Windows, OSX
On Friday 10 February 2012, 21:42:52 JPolk wrote: Here is a simplified example of the bug... Again, this behaviour only happens in Linux, not WinXP or OSX...Anybody have any idea or thoughts on this? This is most probably due to differences in window manager behavior, that Qt tries (hard) to cover. It _might_ also be a bug. I don't know. Anyway, if you use dock widgets the usual way, they _do_ work properly with Linux: #!/usr/bin/python import sys from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) # Window win = QtGui.QMainWindow() win.setWindowTitle(Test) win.resize(400,300) win.show() # Dock dock = QtGui.QDockWidget(win) dock.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea) dock.setGeometry(0,0,400,300) win.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock) sys.exit(app.exec_()) BTW, yours was movable, too. Just hold Alt down during move. I guess, with a little window flag trickery _after_ undocking, the desired effects could be archived, too. Cheers, Pete # = #!/usr/bin/python # On linux, when you undock the widget, the resulting window can't be moved (only resized). # import sys from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) # Window win = QtGui.QWidget() win.setWindowTitle(Test) win.resize(400,300) win.show() # Dock dock = QtGui.QDockWidget(win) dock.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetClosable | QtGui.QDockWidget.DockWidgetMovable ) dock.setGeometry(0,0,400,300) dock.show() sys.exit(app.exec_()) # = The Linux Env Centos 5.7 Python 2.6.6 Qt 4.7.4 (qt-everywhere-opensource-src-4.7.4.tar.gz) Sip 4.13.1 PyQt 4.9(PyQt-x11-gpl-4.9.tar.gz) Thank you, -- View this message in context: http://python.6.n6.nabble.com/QDockWidget-issue-in-Linux-but-not-Wind ows-OSX-tp4374122p4384646.html Sent from the PyQt mailing list archive at Nabble.com. ___ 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] spreadsheet example
Hi Phil, while I'm seriously overloaded at the moment (a bunch of people are much harder to organize then code), I did some relaxations by converting another fine Qt example. As usual, I couldn't resist in pimping it up in some minor ways. Most prominently, I added a way to change the date format globally. Also, a workaround to fetch the correct cell background color is applied. One thing escaped me, though: the SpreadSheetItem.clone() method. It is finalized with an instance pointer assignment in C++. I've experimented with the baseclass clone call, which resulted in a strange: item = super(SpreadSheetItem, self).clone() RuntimeError: underlying C/C++ object has been deleted but since this doesn't seem to be intented in the original version, feel free to ignore this. Anyway, this example shows the powers of Qt in some nice ways. Hopefully you can include it in the upcoming release. Pete python: 2.6.2 sip: 4.13.1 qt4: 4.7.1 pyqt4: 4.9 spreadsheet-20120211-003540.tar.bz2 Description: application/tbz ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Can DockWidgets be docked onto anything else except MainWindows?
On Thursday 02 February 2012, 08:55:44 Andreas Pakulat wrote: On 01.02.12 17:37:53, JPolk wrote: Can DockWidgets be docked onto anything else except MainWindows ? Supposed you have either a layout or a widget that's mid-page in a window and want to dock/undock from that layout/widget and not the MainWindow... A really, really evil idea creepes up my mind: has somebody tried to embed a QMainWindow into something else?!? Doesn't look to be possible,...Can anyone confirm this? You can, but that requires writing a layout-manager similar to the one used in QMainWindow (which is not public API so cannot simply be used). So there's no 'out of the box' way to dock QDockWidgets into normal QWidgets, but if you put in enough effort you can do that. Start digging into Qt's QMainWindow code. It might be easier, then it appears to be? Converting sane C++ code to Python is pretty straight forward. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] issue with QPainter.drawPolyline and list of QPoints
On Wednesday 01 February 2012, 09:57:35 Phil Thompson wrote: On Wed, 1 Feb 2012 01:25:57 +0100, Hans-Peter Jansen h...@urpla.net wrote: Hi Phil, shouldn't this work: from PyQt4 import QtCore, QtGui app = QtGui.QApplication([]) pixmap = QtGui.QPixmap(16, 16) painter = QtGui.QPainter(pixmap) plist = [QtCore.QPoint(0, 15), QtCore.QPoint(0, 0), QtCore.QPoint(15, 0)] painter.drawPolyline(plist) No, try... painter.drawPolyline(*plist) Of course, silly me. Thanks, Phil. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
On Wednesday 01 February 2012, 20:47:01 JPolk wrote: ...not sure if this is the proper or elegant way, but I found a workaroundby setting minWidth and minHeight self.widget.setMinimumWidth(minW) self.widget.setMinimumHeight(minH) ...then, once inserted into the TreeWidget, it retains it's height, and isn't clipped... That's perfectly fine, James. It's the other way around - if you start using setGeometry for ui elements (not windows), something is conceptually broken in your code. Badly. We're using layout manager for a reason. You don't *want* to know their innards, unless you have a strong masochistic background. Do you? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] issue with QPainter.drawPolyline and list of QPoints
Hi Phil, shouldn't this work: from PyQt4 import QtCore, QtGui app = QtGui.QApplication([]) pixmap = QtGui.QPixmap(16, 16) painter = QtGui.QPainter(pixmap) plist = [QtCore.QPoint(0, 15), QtCore.QPoint(0, 0), QtCore.QPoint(15, 0)] painter.drawPolyline(plist) With PyQt 4.9, this results in: TypeError: arguments did not match any overloaded call: QPainter.drawPolyline(QPointF, ...): argument 1 has unexpected type 'list' QPainter.drawPolyline(QPolygonF): argument 1 has unexpected type 'list' QPainter.drawPolyline(QPoint, ...): argument 1 has unexpected type 'list' QPainter.drawPolyline(QPolygon): argument 1 has unexpected type 'list' QPaintDevice: Cannot destroy paint device that is being painted Speicherzugriffsfehler although you provide a %MethodCode handler for the list of QPoints case. Ref: line 354 in sip/QtGui/qpainter.sip Hmm, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Parent/Child widget clipping
On Tuesday 31 January 2012, 00:07:24 James Polk wrote: Greetings All, Doing some prototyping where I have a simple QTreeWidget with 3 items. Each item has 3 simple children. Using QTreeWidget.setItemWidget()I set/insert a simple QTableWidget into a child of one of the tree's parent items (first column) The problem is that the child-table width is wider than the parent-tree's first column, so that parent-tree-column2 clips the child-table. This phenomena is pretty much identical to this example on stackoverflow (last pix) http://stackoverflow.com/questions/6133367/qtreewidget-with-multiple- columns-limits-number-of-child-items However, in that example, the problem is solved by manually (or could be automatic) resizing of the parent columns by simply pulling it wider,etc.. But in my prototype, I need the entire child-table to display in it's entirety but I need the columns of the parent-tree to remain the same width. In other words, I need to override the default behaviour of having the tree define the child's display region. Excuse me, but I still don't get, what you really want to archive. If you want your table span the full tree widget width, try this after setItemWidget: self.LargeTable.setFirstItemColumnSpanned(self.LargeTable.topLevelItem(0).child(1), True) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Sending a Signal from a QTableWidget header
On Tuesday 24 January 2012, 00:37:31 starglider.dev wrote: Hi Pete, thank you for your help. I found the anwser in Mark Summerfield's book: Good choice. chapter 14 in file ships-delegate.pyw Here is the code: header = tableView.horizontalHeader() self.connect(header, SIGNAL(sectionClicked(int)), self.sortTable) Better use new style signals'n'slots: header.sectionClicked.connect(self.sortTable) Much easier, less typing and more secure, since it will traceback on startup, if you fail to type the signal name correctly. Pete jorge On 22 January 2012 15:57, Hans-Peter Jansen h...@urpla.net wrote: On Sunday 22 January 2012, 16:38:21 Hans-Peter Jansen wrote: On Saturday 21 January 2012, 23:21:18 starglider.dev wrote: Hi, I need to open a dialog if the user click in the QTableWidget header. There's no such class in PyQt (nor in Qt). If you mean QTable, then QHeader.clicked() is proably, wat you're looking for. Scratch that, I looked up the wrong docs. Since QTableWidget inherits from QTableView, the {horizontal,vertical}Header() methods return a QHeaderView instance, which emits e.g. sectionPressed(int). Sorry for the confusion. Pete ___ 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] Function to open window and return user input
On Monday 23 January 2012, 18:53:46 Christopher Evans wrote: Is there a way to make this non modal? I am using Maya and we did not use exec because it always made the dialog application modal, as in it halts the main thread and doesn't allow users to interface with the parent app while the window is open. Well, I don't have any experience with Maya at all, but what you need seems pretty straight forward. I would subclass QDialog, show (or exec_) the non modal dialog, and collect the data when closed. The gory details depend on how Maya runs such extension code (eg. how QApplication and the event loop is handled). Pete CE On Sun, Jan 22, 2012 at 4:27 PM, Hans-Peter Jansen h...@urpla.net wrote: On Friday 20 January 2012, 20:38:33 Christopher Evans wrote: QInput is designed to get a single input from a user. In my case, we are making a complex remapping dialog that takes two ordered lists as input, allows the users to change the order, then on dialog close, it should return the two re-ordered lists. That's called a modal dialog. Create it, exec_ it (look up QDialog::exec()), process data after close, and be done. Pete ___ 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] Function to open window and return user input
On Friday 20 January 2012, 20:38:33 Christopher Evans wrote: QInput is designed to get a single input from a user. In my case, we are making a complex remapping dialog that takes two ordered lists as input, allows the users to change the order, then on dialog close, it should return the two re-ordered lists. That's called a modal dialog. Create it, exec_ it (look up QDialog::exec()), process data after close, and be done. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Sending a Signal from a QTableWidget header
On Saturday 21 January 2012, 23:21:18 starglider.dev wrote: Hi, I need to open a dialog if the user click in the QTableWidget header. There's no such class in PyQt (nor in Qt). If you mean QTable, then QHeader.clicked() is proably, wat you're looking for. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Cannot 'configure' PyQt4.9 before build on Linuxmint
On Thursday 29 December 2011, 10:48:21 Nico Dufort wrote: Hmm, I'm puzzled then. I have installed another virtual machine with Fedora 16, and it gives the exact same error as I had under LinuxMint 12 and Xubuntu 11.10. Each package was downloaded fresh and rebuilt for each machine, with no special flag/option, just plain vanilla config/make. I had no problem earlier this year with older versions. I'll check other forums if anyone has an idea of what the problem might be. Thanks for your time. Cheers. Start with deinstalling all packages of your distribution, that you're going to replace. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Menu icons missing in Xfce
On Wednesday 07 December 2011, 10:10:39 Mark Summerfield wrote: Hi, I have a Python 3/PyQt 4 application that has standard menus and toolbars and works fine under GNOME 2 on Debian 6. However, on Xubuntu (Xfce 4.8) the icons only show up in the toolbars not in the menus. Yet other applications (e.g., firefox, Archive Manager) have icons in their menus. Does anyone know the fix for this? Not really. Might be window manager related. How does other Qt-Apps appear (designer, assistant, ..)? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Version matching: Qt and PyQt
[Although already answered by Phil, this one errously made it to James only..] Am Friday 02 December 2011 03:13:52 schrieb James Polk: Is there a online guide anywhere to match a version of Qt with it's corresponding version of PyQt ? For example,...on Windows, in order to work with Maya2011, I had to install Qt 4.5.3 and use PyQt 4.7.3 (and sip too) This is a constraint induced by Maya then. Is there a lookup table somewhere where these versions are matched up? Not only Windows, but OSX, and Linux too..? My current dilemma is finding the right version combo for OSX Lion (10.7.2 64bit) Well, in theory, all versions of PyQt4 should work with all versions of Qt4. If you depend on a Qt feature that appeared in a certain version, this feature is available only, if PyQt4 is adapted to that feature and is compiled against a Qt version containing that feature. This is possible due to sips timeline feature and a complex version dependency scheme. In practise, you determine the lowest Qt version that you need to support, and build the newest sip/PyQt4 against it. Keep in mind, that sip/PyQt4 depends on the particular Python revision, it is build with. I cannot say anything about Mayas PyQt bindings, though. Hth, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QLineEdit in QToolBar
Am Thursday 01 December 2011 06:18:02 schrieb Vadym Honcharuk: Hello, I can't understand why QLineEdit can't send signal from QToolBar... trying via addWidget and addAction, for example last edition: self.searchDBLine = QtGui.QLineEdit(self) self.searchDBLineAction = QtGui.QWidgetAction(self) self.searchDBLineAction.setDefaultWidget(self.searchDBLine) self.ui.toolBar.addAction(self.searchDBLineAction) and connected with: * @QtCore.pyqtSignature * usual signal connect (self.connect(self.searchDBLine, QtCore.SIGNAL(textEdited()), self.searchBDLineChanged)) but without any success, could you please advice where is problem? textEdited does not exist. Check the docs: textChanged ( const QString ) You may want to use new style signals, this would have thrown a (hard to ignore) python exception then... self.searchDBLine.textChanged.connect(self.searchBDLineChanged) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] non ascii names in QObject?
On Thursday 24 November 2011, 12:19:09 Victor Varvariuc wrote: #!/usr/bin/env python3 from PyQt4 import QtGui, QtCore, uic class Form(QtGui.QDialog): def __init__(self, parentWidget): super().__init__(parentWidget) self.setupUi() def setupUi(self): uic.loadUi('test.ui', self) def тест(self): '''This method has non ASCII name causing this error: Traceback (most recent call last): File test.py, line 20, in module form = Form(None) File test.py, line 9, in __init__ self.setupUi() File test.py, line 12, in setupUi uic.loadUi('test.ui', self) File /usr/lib/python3/dist-packages/PyQt4/uic/__init__.py, line 221, in loadUi return DynamicUILoader().loadUi(uifile, baseinstance) File /usr/lib/python3/dist-packages/PyQt4/uic/Loader/loader.py, line 71, in loadUi return self.parse(filename, basedir) File /usr/lib/python3/dist-packages/PyQt4/uic/uiparser.py, line 925, in parse elem = document.find(tagname) File /usr/lib/python3.2/xml/etree/ElementTree.py, line 726, in find return self._root.find(path, namespaces) File /usr/lib/python3.2/xml/etree/ElementTree.py, line 363, in find return ElementPath.find(self, path, namespaces) File /usr/lib/python3.2/xml/etree/ElementPath.py, line 285, in find return next(iterfind(elem, path, namespaces)) File /usr/lib/python3.2/xml/etree/ElementPath.py, line 249, in iterfind if path[-1:] == /: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) ''' if __name__ == '__main__': app = QtGui.QApplication([]) form = Form(None) form.show() app.exec() Python3 supports unicode names - which are working. Does Qt support unicode names or it's a PyQt bug (see the example above)? Qt Designer also doesn't allow me to enter non-ascii names for objects. In one word: don't. Since PyQt has to respect the constraints of Qt (C++), what do you expect? After rewriting uic and qt designer, there's even more trouble ahead of your road (qt meta system, translation, ...) I have a hard time to find the upsides from this move in python3. What would you think about some wonderful python open source application, that is written with all kind of _labels_ in hanzi, kanji or hanja? I guess, it would prevent you from modifying anything in that code. Similar, a lot of people in the world are lost with cyrillic labels. Imagine, Phil would write his code in some gaelic language? Even if (mostly) ascii based, only a small population would be able to understand the code. To get this straight: even written with proper english labels, comments and docuemtation, it's hard to grok completely. Try it. Unicode labels are a silly form of obfuscation to me. If you like that, why don't you start hacking in APL, then? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Why won't my dialog show properly when I set its parent on instantiation?
On Tuesday 08 November 2011, 02:47:54 Åke Kullenberg wrote: In the attached example script, why won't the MyDialog instance show properly when I set MyDialog's parent to self on line 20 instead of leaving it blank? Well, is does show properly. The difference is in positioning (as expected). Without a parent, the frameless dialog is positioned somewhere on the screen by the WM, in the other case, it is positioned relative to the main window. For some reason, the WM overlays the main window with the dialog then, but the concrete behavior of this rather esoteric window flag is highly WM dependent anyway. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Storing QString/Unicode in Sqlite Database
On Wednesday 09 November 2011, 10:29:55 Tayfun Kayhan wrote: Thank you, the first one is working well. I tried setting API V2 but it gave an error which says that it has been already set to V1. I'll try fixing this, as well. Quoting http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/incompatible_apis.html (the link, that you got from Andrei): An application calls sip.setapi() to set the version number of a particular API. This call must be made before any module that implements the API is imported. Once set the version number cannot be changed. In short, before your very first: from PyQt4 import QtCore, QtGui Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt4.Gui.QFileDialog
On Monday 31 October 2011, 08:07:00 Janwillem wrote: I want a small script with just a few filedialogs not a full blown gui application . However when I try the code below the dialog does not disappear after clicking the Open button on the dialog but stays on top until the script exits. What am I doing wrong?? Thanks, Janwillem def open_files(default_dir=None): Returns list of filenames optionally given a default dir from sys import argv from os import environ from PyQt4.QtGui import QApplication, QFileDialog,QWidget if default_dir == None: default_dir = environ['HOME'] app = QApplication(argv) fdialog = QFileDialog filenames = fdialog.getOpenFileNames(directory=default_dir) app.exit() return list(filenames) if __name__ == '__main__': from PyQt4.QtCore import QT_VERSION_STR from platform import python_version print('Python %s' % (python_version())) print('PyQt4 %s' %QT_VERSION_STR) print('open dialog') lst = open_files() print('dialog finished') for fname in lst: print(fname) import time time.sleep(2) print 'finished' Without taking a deeper look, you might want to try instancing/exiting QApplication just once per process. Also time.sleep is a (non pyqtonic) blocking function. Use a QTimer.singleShot for this purpose, which would allow you to let the event loop run in the meantime. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QString and unicode problems
Am Tuesday 18 October 2011 11:07:24 schrieb Andrei Kopats: Hi I am developing PyQt app now, and I very often have crashes, connected with QString usage. There are 2 reasons for exceptions: - QString contains unicode characters never had problems with that, as long as you provide proper unicode objects, or convert back to unicode objects. - python method called for Qt string. Sometimes called somewhere deep in 3rdparty code, such as os.path.blabla(QString)) return -ERRORBETWEENCHAIRANDKEYBOARD See code examples at the end It is easy to forget about QString conversions, because there are a few different cases: - if you define string in Python code - it is Python string - if you take it from PyQt4 - it is QString - If you passed Python string through signal-slot - it becomes QString. - use V2 sip API and eliminate QStrings completely http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/incompatible_apis.html Please check, how things work for you using this, and call back. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Icon on OS X
On Sunday 16 October 2011, 16:27:25 Clément Mairet wrote: On 10/16/2011 05:52 AM, Joseph Yeung wrote: I am trying out my application on OS X Lion 10.7.2 and PyQt4 4.8.4 and it is showing the default Python Launcher Icon. But on Ubuntu it is showing the icon which I specify. Wondering if there is a specific thing I need to do on OSX. Thanks. Joseph I had the same problem (although on older versions of OS X and PyQt) and only managed to have a proper icon and application name by using py2app to generate a full-blown OS X application. If an easier, more direct solution exists, I'm interested too! :) Your apps need to comply to the usual Mac OS X Application folder structure, including a correct Info.plist file, since the finder examines those only. This is inherited from the resource fork drain bammage of Mac OS. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setting color of window titlebar or window background
On Sunday 16 October 2011, 21:14:44 Brad Buran wrote: When users of my program run it in test mode, it is not actively saving data. Once in a while, a user forgets that they are in test mode and attempts to run an experiment only to realize that the data wasn't being saved after they're done. Is it possible to change the color of the title bar or background to indicate that it is in test mode? Something like a bright red title bar would be ideal, but I'm ok with anything that I can set to visually indicate the difference between test and data collection mode that's obvious enough to a user. Yes, of course, but the price is high: draw your own and mimic the window manager behavior (move, hide, {min,max}imize, quit..). How about coloring the background of your app, add some text to the title bar or color your icon red? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Delaying splash screen
Am Thursday 08 September 2011 00:32:17 schrieb Muhammad Bashir Al-Noimi: On 07/09/2011 11:27 م, Hans-Peter Jansen wrote: On Wednesday 07 September 2011, 14:04:02 ad...@mbnoimi.net wrote: Hi guys, I wrote a tiny class for delaying splash screen in C++ but when I tired to re-write it in python it didn't work! I got AttributeError TeSplashScreen object has no attribut QFrate although TeSplashScreen inherited from QFrame Could you please help me, I'm still a newbie in PyQt and Python. tesplashscreen.py from PyQt4.QtCore import * from PyQt4.QtGui import * Hmm, that * imports are easily avoided. Thanks a lot Pete, You mean I don't need to use both import lines? Well, do it sanely with (the proposed standard of): from PyQt4 import QtCore, QtGui You will learn something about the structure of Qt, that is also helpful in understanding the basic concepts. import sys class TeSplashScreen(QFrame): Splash doc app = QApplication(sys.argv) sPixmap = QPixmap(10, 10) sMessage = QString() messages = [nothing] sAlignment = 0 sColor = QColor() def __init__(self, pixmap): You need to call the base class c'tor here, e.g.: super(QFrame, self).__init__() Most of your code below has issues with missing self. references, which will result in access to undefined variables and instances, that are prematurely garbarge collected. I did as you mentioned exactly. I got new issue because I don't know how can I use QStringList class, I read in some article that it's unavailable in PyQt Huch Python 2.6.2 (r262:71600, May 25 2011, 11:48:28) [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 Type help, copyright, credits or license for more information. from PyQt4 import QtCore sl = QtCore.QStringList() map(sl.append, (a, b, c, d, e)) [None, None, None, None, None] print sl.join(..) a..b..c..d..e so I tried to use python lists instead but I got an exception at for loop TypeError object of type int has no len() You seem to supply an int as second argument to showSplash. here's the modified class: from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class TeSplashScreen(QFrame): Splash doc app = QApplication(sys.argv) sPixmap = QPixmap(10, 10) sMessage = QString() #messages = [nothing] sAlignment = 0 sColor = QColor() def __init__(self, pixmap): super(QFrame, self).__init__() self.sPixmap = pixmap self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint) self.setAttribute(Qt.WA_TranslucentBackground) self.setFixedSize(self.sPixmap.size()) def clearMessage(self): self.sMessage.clear() self.repaint() def showMessage(self, theMessage, theAlignment, theColor): self.sMessage = theMessage self.sAlignment = theAlignment self.sColor = theColor self.repaint() def paintEvent(self, pe): aTextRect = QRect(self.rect()) aTextRect.setRect(aTextRect.x()+5, aTextRect.y()+5, aTextRect.width()-10, aTextRect.height()-10) aPainter = QPainter(self) aPainter.drawPixmap(self.rect(), self.sPixmap) aPainter.setPen(self.sColor) aPainter.drawText(aTextRect, self.sAlignment, self.sMessage) def showSplash(self, delay, messages, alignment, color): delay = 0 #self.messages = messages alignment = 0 color = QColor(color) class SleeperThread(QThread): msecs = 0 QThread.msleep(msecs) aSplashScreen = TeSplashScreen(self.sPixmap) aSplashScreen.show for i in range(len(messages)): aSplashScreen.showMessage(messages[i], alignment, color) SleeperThread.msleep(delay) Don't expect this to work correctly. Does it? If you want to delay the messages, do it with QTimer triggered updates. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] segv crashes on mac os around signal statements
Am Friday 09 September 2011 00:27:22 schrieb David Cortesi: I am experimenting with trying to implement a custom signal and having a lot of trouble with the syntax of connect, etc, and while making various changes I am getting frequent SEGV crashes in the QtCore plugin. Below is the abbreviated head of a crash report. Does anybody want to know about these? I don't see any way to submit them at riverbank. You did already ;) but you will need to provide a minimum runnable example to get further help. Pete Path: /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Py thon.app/Contents/MacOS/Python Version: 2.6 (2.6) Build Info: python-440200~2 Code Type: X86-64 (Native) PlugIn Path: /Library/Frameworks/QtCore.framework/Versions/4/QtCore PlugIn Identifier: QtCore PlugIn Version:4.7.2 (compatibility 4.7.0) Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0001148cc000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Delaying splash screen
On Wednesday 07 September 2011, 14:04:02 ad...@mbnoimi.net wrote: Hi guys, I wrote a tiny class for delaying splash screen in C++ but when I tired to re-write it in python it didn't work! I got AttributeError TeSplashScreen object has no attribut QFrate although TeSplashScreen inherited from QFrame Could you please help me, I'm still a newbie in PyQt and Python. tesplashscreen.py from PyQt4.QtCore import * from PyQt4.QtGui import * Hmm, that * imports are easily avoided. import sys class TeSplashScreen(QFrame): Splash doc app = QApplication(sys.argv) sPixmap = QPixmap(10, 10) sMessage = QString() messages = [nothing] sAlignment = 0 sColor = QColor() def __init__(self, pixmap): You need to call the base class c'tor here, e.g.: super(QFrame, self).__init__() Most of your code below has issues with missing self. references, which will result in access to undefined variables and instances, that are prematurely garbarge collected. self.sPixmap = pixmap self.QFrame(self, Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint) self.setAttribute(Qt.WA_TranslucentBackground) self.setFixedSize(sPixmap.size()) ^ def clearMessage(self): sMessage.clear() ^ repaint() ^ def showMessage(self, theMessage, theAlignment, theColor): self.sMessage = theMessage self.sAlignment = theAlignment self.sColor = theColor repaint() ^ and so on... Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] removeWidget
On Thursday 25 August 2011, 10:43:20 Vincent Vande Vyvre wrote: Le 25/08/11 07:59, uahmed a écrit : Hi I want to add widget in (f1) function and want to remove the widget from (f2) function . I tried the same thing in same function it do work but when i try to remove the widget from another it doesnt . Any help ? Code : import sys,os from functools import partial from PyQt4 import QtGui, QtCore import Skype4Py import time import socket class main(): def f1(self): print f1 buttons['user'] = QtGui.QToolButton(widget) layout.addWidget(buttons['user']) widget.setLayout(layout) def f2(self): print f2 layout.removeWidget(buttons['user']) widget.setLayout(layout) app = QtGui.QApplication(sys.argv) widget = QtGui.QWidget() layout = QtGui.QVBoxLayout() buttons = {} sk = main() sk.f1() sk.f2() widget.show() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt Remove is NOT delete. Try that: def f2(self): print f2 buttons['user'].deleteLater() layout.removeWidget(buttons['user']) widget.setLayout(layout) Consider using .show() and .hide() Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] removeWidget
[I prefer to not get personal replies on this list] On Thursday 25 August 2011, 11:39:46 uahmed wrote: Hi Thanks for the reply , I used .close() . I guess this will destroy the widget and will not leave memory for it . You cannot close arbitrary widgets, but you can hide and show them without the need to fiddle with the layouts.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Updating Qlabel in widget
On Thursday 25 August 2011, 12:02:52 uahmed wrote: Hi I want to update the Qlabel after the widget is made , Problem is that updating is base on counter so i call that function after 4 seconds , but when it by pass the if statment it go through all the commands give me no errors but it does not update the widet although if i dont putt if statment all lines are executed and Qlabel update too . Can you please tell me where i am wrong Here is code import sys,os from functools import partial from PyQt4 import QtGui, QtCore import time class main(): def f2(self): print f2 global count count +=1 if ( count == 2): msg_label[user] = QtGui.QLabel(update,widget) msg_label[user].setGeometry(10, 10, 100, 100) print count QtCore.QTimer.singleShot(4000, self.f2) app = QtGui.QApplication(sys.argv) widget = QtGui.QWidget() layout = QtGui.QVBoxLayout() buttons = {} count = 0 msg_label = {} sk = main() sk.f2() widget.show() sys.exit(app.exec_()) Don't recreate the widget over and over again. Create it once, and just change the label with setText(). Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Printing from QWebView (contents visible) gives a set of blank pages
On Sunday 21 August 2011, 19:52:41 ivanko.rus wrote: Good afternoon! Recently I was trying to print a Web page from QWebView and ran into a pretty weird problem. It is the following: I can print my QWebView perfectly when setting the QPrinter's output format to PDF or PostScript. But when I try to print to a normal printer, however, it gives me the correct number of pages, only that the pages are all blank. I tried to do this with a virtual PDF printer in Windows, a normal printer (it had ink, btw =), tried to choose the print to file option on Windows, and the results were all the same. The other thing that puzzles me even more is that if I replace the QWebView with a QTextEdit, everything works perfectly with all kinds of printers. So I hope that someone can give me a little help, I would appreciate it very much. Thank you! You missed to tell us something about your versions. Works here with: python: 2.6.2 sip: 4.12.4 qt4: 4.7.1 pyqt4: 4.8.5 os: Linux Note, that printing is implemented quite differently in Windows and Linux, and QWebView is somewhat complex in itself.. It might be a printer _driver_ problem, which aren't that uncommon with Windows (but who cares: it's the industrial standard by definition). Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help needed with SIP
On Sunday 07 August 2011, 15:29:59 Vipul Raheja wrote: Hi, Thanks for your replies, Pete and Phil, I was able to fix the issues and build PyQt on my system by doing a few rebuilds with changes in them. I had earlier installed sip and PyQt using apt-get, but later I did the same by directly building the sources, and it worked. However, now I am facing a different issue. I was able to create a .so file by executing configure.oy with python and doing a make and make install, however, when I do an import of the library in python console, it gives me this error: http://paste.debian.net/125358/ (I hope paste.debian is fine, if not, kindly suggest an alternate way) Hard to say, what's going on. I guess, it cannot locate the ossim.so lib, at least not the version, that you linked to. Maybe, it's just missing a call to ldconfig. Try to check the python site libs with ldd, and compare with the build logs. If that stuff is publically available somewhere, please provide a detailed description on what you did, which versions, etc., and I might try to reproduce your issue in a couple of days.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Please tell me if I have this straight...
On Saturday 06 August 2011, 00:35:51 David Boddie wrote: On Fri Aug 5 19:27:51 BST 2011, David Cortesi wrote: I present a document to a user in a QPlainTextEdit widget. The widget nicely handles most editing functions, but there is a unique operation I want to provide. When the user selects Edit BLEEP, the app is supposed to BLEEP the document. I presume that by BLEEP you do not mean beep, otherwise you could use this: http://doc.qt.nokia.com/4.7/qapplication.html#beep Hmm, guess, there would be easier ways to ring a bell then fetching and restoring the whole document from the QPlainTextEdit, David ;) BLEEP sounds like a magic text transformation of some kind.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help needed with SIP
On Saturday 06 August 2011, 23:28:05 Vipul Raheja wrote: Hi, Thanks for your reply Phil. I had earlier installed SIP and PyQt4 through apt-get in Ubuntu, but was still getting the same problem since there was no QtGuimod.sip file present on my system. Probably, your local sip/PyQt maintainer provides some matching -devel packages somewhere, since without these files, you cannot build any descendant packages ({python-}qscintilla, PyKDE, PyQwt, ..). I removed them and tried installing SIP and PyQt4 again from their sources. I am getting the following error now while building PyQt4 and cannot find any answers over the web : http://pastebin.com/apSq180u Don't provide build logs via paste bin services, please. When they vanish, followers by search engines will fail. This looks like the usual installed by packetmanager/from source dichotomy (for package sip in your case). Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] desktop workspace
On Saturday 06 August 2011, 01:35:55 emmanuel_mays...@lynceantech.com wrote: I am trying to save the geometry and and the workspace where the application has been closed. Is there a way with Python/Qt to get the info on the workspace number!? While Arnold is generally right, there might be cases, where it is useful. At least, you should take changing resolutions and # of desktops into account.. I guess, the class QDesktopWidget provides, what you asked for. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Please tell me if I have this straight...
On Friday 05 August 2011, 20:27:51 David Cortesi wrote: I present a document to a user in a QPlainTextEdit widget. The widget nicely handles most editing functions, but there is a unique operation I want to provide. When the user selects Edit BLEEP, the app is supposed to BLEEP the document. BLEEPing is not something Qt does, I have to implement BLEEP with native Python code. So when the user says BLEEP it, I must: 1. Use QPlainTextEdit toPlainText() to get the document text as a QString 2. Use QString toUTF8() to get Utf-8 text that Python can use No, you just convert the QString to unicode. 3. Apply my Python logic to BLEEP the text 4. Use QString fromUtf8() to return to a QString See above. 5. Use QPlainTextEdit fromPlainText() to replace the document with the BLEEPed contents. Does this sound right? Can PyQt do #2 and #4 automagically? Sure, just do import sip sip.setapi('QString', 2) before any PyQt imports, which does convert QString to unicode behind the scenes. Anyway, no need to encode/decode utf-8 strings here. And what are the performance implications when a document might have one or two megabytes of text? I guess, it mostly depends on the performance of your bleep algorithm. The rest is operating with compiled code, which should be sufficient. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trying insert image into QTableWidget
On Thursday 04 August 2011, 21:45:01 Tony Peña wrote: ok nothing yet i refresh the code again here with QLabel now.. :| airlineCodePath = './airlines/%s.gif' % code_airline try: if os.path.exists(airlineCodePath) is True: airline = QtGui.QLabel() Pixmap = QtGui.QPixmap(airlineCodePath) airline.fileName = airlineCodePath col_airline = QtGui.QLabel.setPixmap(Pixmap) self.ui.PILOT_FullList.setItem(startrow, 0, col_airline) else: code_airline = '-' col_airline = QtGui.QTableWidgetItem(code_airline, 0) self.ui.PILOT_FullList.setItem(startrow, 0, col_airline) except: pass someone can made simple table 1x1 with a simple .gif, .png or .jpg example??? From a cursory look, you seem to forgot to hold a reference to your label. Try: airline = QtGui.QLabel(self) pixmap = QtGui.QPixmap(airlineCodePath) airline.setPixmap(pixmap) Vincent questioned your catch all exception handler already.. It's hard to make some sense from your snippets. Try to provide a minimum runnable example, if you're after substantial help. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trying to learn ...
Dear BigAl, On Wednesday 03 August 2011, 01:27:55 Algis Kabaila wrote: Hi, Pete! Looking at testui.py it seems to me that it should/would work without the decorator @pyqtSlot(). This suggests two questions: 1. What is the advantage, if any, to use the decorator in this case? In short: none. I opted to mangle Magnus' file in a minimum invasive fashion, and @pyqtSlot was one weapon in his quest to get the thing behave... IMHO, after getting used to it, it's usefulness is two fold: it nicely documents the slots in your classes, and helps to disambiguate/fix those cases, were it is needed. E.g. there are some not so obvious cases in esoteric usage pattern of webkit with javascript/PyQt interaction: http://www.riverbankcomputing.com/pipermail/pyqt/2010-November/028600.html 2. Where could one look up the code for this decorator? http://www.riverbankcomputing.com/static/Docs/PyQt4/html/new_style_signals_slots.html#the-pyqtslot-decorator Thanks for your forever careful care of simple questions - there is nothing simple when one does not know how to get it working! Good work! OldAl. I dimly remember my own PyQt quest ten years ago. ;-) BTW, I talked to someone lately, who was involved in a web based ERP system in about the same time span. Finally, they've given up, since they failed to cope with the need to redesign/rewrite the whole thing for the third time (in order to deal with the html/java/javascript/browser evolution).. I cannot qualify their development process, but I imagine, that sustainability of PyQt code is a couple of magnitudes above that level, even if factoring in sip v2 to v4, (Py)Qt v3 to v4 and python v2 to v3 advancements from that time. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Trying to learn ...
Magnus, please keep the conversation on the ML or CC at the very least. Others might want to participate. My personal preference is to NOT receive personal copies. On Tuesday 02 August 2011, 11:20:15 Magnus Wirström wrote: 2011/8/2 Hans-Peter Jansen h...@urpla.net: On Monday 01 August 2011, 22:20:32 Magnus Wirström wrote: Hi I am sorry if this have been asked before :) I am trying to learn using python and pyqt using ERIC 5.1.2. I have a problem with signals and slots. I tried this on 2 different computer with different OS and different version of python. My problem is this... I am creating a test project using Eric ... using one of the tuturials on Eric's webpage. I create a project and a form, then i add a push button. I save the form and i generate the form into code using Eric I also generate dialog code and adding a slot for my push button. So far i have not written a single line of code. In my slot i write a print(Hello), My only self written code. When i run this, i get a window with my button but when i click it nothing happens. When have i done wrong? How can i get my button to execute the slot? You should get the Hello printed in console on start up, don't you? See below. It prints nothing in the console when i start up... Ah, of course not. See below. thanks for the help ... sorry if this is a stupid question ;) Here is the code: # Form implementation generated from reading ui file '/home/magnus/eric/test/testui.ui' # # Created: Mon Aug 1 22:16:17 2011 # by: PyQt4 UI code generator 4.8.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8(Dialog)) Dialog.resize(400, 300) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(140, 130, 83, 25)) self.pushButton.setObjectName(_fromUtf8(pushButton)) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle(QtGui.QApplication.translate(Dialog, Dialog, None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate(Dialog, PushButton, None, QtGui.QApplication.UnicodeUTF8)) if __name__ == __main__: import sys app = QtGui.QApplication(sys.argv) Dialog = QtGui.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) Dialog.show() sys.exit(app.exec_()) -- --- -- -- # -*- coding: utf-8 -*- Module implementing Dialog. from PyQt4.QtCore import * from PyQt4.QtGui import QDialog from .Ui_testui import Ui_Dialog class Dialog(QDialog, Ui_Dialog): Class documentation goes here. def __init__(self, parent = None): Constructor @param parent reference to the parent widget (QWidget) QDialog.__init__(self, parent) self.setupUi(self) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8(clicked())), self.on_pushButton_clicked()) This was an attempt to get it to work. I added this and forgot to remove it. What i understand of the tutorial, the bindings to the slots would be done automatic by this line in the script above QtCore.QMetaObject.connectSlotsByName(Dialog). Yes. For that reason, if you try my fixed script, you get the Hello twice, once from the manual connection, and one from the automatic connection. I think my question is why this is not working. Your app is missing a major part: the usual if __name__ is __main__: Check out the ui file. Not only it carries some such, it is also using sane import clauses. self.pushButton.clicked.connect(self.on_pushButton_clicked) ^^ You're calling the signal handler here, resulting in connecting the signal to None. While at it, use the new style signals/slots: self.pushButton.clicked.connect(self.on_pushButton_clicked) Looking much nicer, doesn't it? Yes ... it looks much nicer... I tried to replace my line with yours but still no joy... still the same result... nothing happens. if i press the pushbutton a couple of times i get this message in the console: QDialog::exec: Recursive call detected When i start to get it ... it appears on every click. This is confusing. You need to run the testui.py script, not the Ui_testui.py script for this to work. The latter is just the dialog
Re: [PyQt] Trying to learn ...
On Monday 01 August 2011, 22:20:32 Magnus Wirström wrote: Hi I am sorry if this have been asked before :) I am trying to learn using python and pyqt using ERIC 5.1.2. I have a problem with signals and slots. I tried this on 2 different computer with different OS and different version of python. My problem is this... I am creating a test project using Eric ... using one of the tuturials on Eric's webpage. I create a project and a form, then i add a push button. I save the form and i generate the form into code using Eric I also generate dialog code and adding a slot for my push button. So far i have not written a single line of code. In my slot i write a print(Hello), My only self written code. When i run this, i get a window with my button but when i click it nothing happens. When have i done wrong? How can i get my button to execute the slot? You should get the Hello printed in console on start up, don't you? See below. thanks for the help ... sorry if this is a stupid question ;) Here is the code: # Form implementation generated from reading ui file '/home/magnus/eric/test/testui.ui' # # Created: Mon Aug 1 22:16:17 2011 # by: PyQt4 UI code generator 4.8.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8(Dialog)) Dialog.resize(400, 300) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(140, 130, 83, 25)) self.pushButton.setObjectName(_fromUtf8(pushButton)) self.retranslateUi(Dialog) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8(clicked())), Dialog.exec) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle(QtGui.QApplication.translate(Dialog, Dialog, None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate(Dialog, PushButton, None, QtGui.QApplication.UnicodeUTF8)) if __name__ == __main__: import sys app = QtGui.QApplication(sys.argv) Dialog = QtGui.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) Dialog.show() sys.exit(app.exec_()) - -- -- # -*- coding: utf-8 -*- Module implementing Dialog. from PyQt4.QtCore import * from PyQt4.QtGui import QDialog from .Ui_testui import Ui_Dialog class Dialog(QDialog, Ui_Dialog): Class documentation goes here. def __init__(self, parent = None): Constructor @param parent reference to the parent widget (QWidget) QDialog.__init__(self, parent) self.setupUi(self) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8(clicked())), self.on_pushButton_clicked()) ^^ You're calling the signal handler here, resulting in connecting the signal to None. While at it, use the new style signals/slots: self.pushButton.clicked.connect(self.on_pushButton_clicked) Looking much nicer, doesn't it? (new, as in only a couple of years old…) And it should do, what you want, does it? @pyqtSlot() def on_pushButton_clicked(self): Slot documentation goes here. print(hello) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QTableWidget - pyuic does not compile several attributes
On Thursday 28 July 2011, 02:58:38 Protopia wrote: I am not sure whether anyone has found this problem before, however I can't find it in the archives on Gmane. I first came across this problem when I designed a table in QT Designer, and set fonts on certain cells. But when I ran the code, no formatting. Looking at the code generated by pyuic I could not see the code I would expect to set the fonts. So, I generated a test UI file in Designer with all properties on the table widget, the vertical and horizontal titles and cells themselves (attached) And then I ran the compiler and looked at the code (attached) and found the following things missing: QTableWidget: 1. .font.Kerning not compiled. 2. .font.Antialiasing not compiled 3. .QTableView.sortingEnabled is placed in reTranslateUI - however this does not seem to be concerned with internationalisation and I feel should be in the main code (though I could easily be wrong here) 4. .QTableWidget.rowCount .columnCount - if these are specified explicitly in QT Designer then they appear twice in the .py file. (Of course this won't cause major problems, but is nevertheless inappropriate.) QTableWidgetItem 1. Horizontal and Vertical header tooltips, whatsthis, fonts, textalign, background and foreground are not compiled at all. 2. Cell tooltips, whatsthis, fonts and textalign are not compiled at all. 3. Cell background and foreground are compiled, however sequence of statements is wrong - sets brush twice, then assigns second definition to both background and foreground. First of all, what are you trying to archive? In order to breathe life into these objects, you need to add some code, generated by yourself (brain and all..). Designers output is a suitable basement for this task (in terms of subclassing or calling into), but in no way it's meant to be exhaustive. If you question the output of pyuic4, the very next thing to do is comparing it with the output of uic. Since that is the reference implementation for pyuic4, any significant differences should be dealt with, and I guess, if nobody jumps up and provide patches, Phil will sometime (depending on his priorities and importance..). Whilst we are looking at this code, it would also be helpful if we were to leave a blank line between code for QTableWidget, Horizontal Headers, Vertical Headers and Cells. Since pyuic4 output is not meant for human consumption (apart from debugging purposes), a patch from you in this area is highly unlikely to be applied by Phil.. [Hint: sed is your friend for such tasks] Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QListWidget data fetching
On Tuesday 26 July 2011, 14:05:45 ad3d wrote: Hi guys, i am trying to get data from listWidget but i am getting it in a PyQt4.QListWidget object format..where as i want it in QString or string [item.text() for item in listWidget.items()] Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Fwd: QFileDialog error
On Saturday 23 July 2011, 07:49:02 Martin Airs wrote: On Saturday 23 July 2011 07:41:18 Vincent Vande Vyvre wrote: It's normal, lineedit.text() returns a QString and Python don't like that. Use : os.path.split(str(self.lineedit.text())) -- Vincent V.V. Oqapy . Qarte+7 . PaQager Aha, thats got it, thankyou very much While at it, either use unicode instead of str or begin your script (before the first PyQt4 import) with: import sip sip.setapi('QString', 2) which would convert all QStrings to unicode strings behind the scenes for you, hence your snippet wouldn't have thrown that exception in the first place. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QRunnable issue
On Monday 18 July 2011, 20:36:53 Jeremy Sanders wrote: Hi - I'm having problems with the following code where a QRunnable emits a signal then ends. If you click the button it should print 1,2,3. It sometimes works for the first few times but the wrong number of arguments is given to the slot after that. Is this a PyQt bug? I can confirm, that there are issues with your code. At least as long as you use old style signals and slots. If you're interested in how this _could_ look nowadays, see attached script runnable2.py. While at it, I pimped up the code a bit in order to exercise the signal and slot mechanics a bit harder. It not only looks smarter, it delivers a million signals per push without a hitch, if you call it like this: python runnable2.py 1000 Compare this with running: python runnable2-old.py This should deliver 100 signals, but most of the time, PyQt misses to deliver the arguments for the signals at all. It might take a few pushes and some scrolling back to see some of them. I'm using 4.8.3 on Ubuntu (x86). I've tried setting autodelete on the runnable to be false but that causes a crash. Well, you missed to tell us about the versions you use, and I'm too lazy to look them up now.. Anyway, I think, that there are some races in the old style signal and slot argument handling code. Looks like Phils call.. Cheers, Pete python: 2.6.2 sip: 4.12.3 qt4: 4.7.1 pyqt4: 4.8.4 runnable2.py Description: application/python runnable2-old.py Description: application/python ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QGraphicsScene background
On Friday 22 July 2011, 21:04:44 Lee Harr wrote: I work on a turtle graphics application written using PyQt (pynguin.googlecode.com) and I am stuck on one particular feature that I would like to add. Right now, I am using QGraphicsScene and when the turtle draws, it uses QGraphicsItem based objects to show the results. Mostly QGraphicsPathItem, QGraphicsEllipseItem and QGraphicsSimpleTextItem. It works quite well, but in long-running programs when many many items have been added, the scene starts to slow down. Two options I have looked at are: Re-implementing drawBackground. I save a QPixmap as self.bg in my QGraphicsScene subclass, then do painter.drawPixmap(rect, self.bg, sourcerect) in drawBackground. It works, but when the zoom level is anything but 1:1 it gets very slow. The other way was to add a QGraphicsPixmapItem as the lowest item on the stack. That also seems like it might work, but again, as soon as the zoom level is anything but 1:1 the speed goes way down instantly. What I think I want to be able to do is to take all of those graphics items and flatten them down on to the background and then delete those items. Is there any way that an approach like this will be able to speed up the application (including the ability to zoom to arbitrary levels...)? Any suggestions greatly appreciated! Did you checked the navigation pad example? It uses some tricks, e.g. by (optionally) using OpenGL and various transformations, that might be helpful for your issue, too. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A dire warning message
On Friday 08 July 2011, 08:07:16 Algis Kabaila wrote: On Fri, 8 Jul 2011 01:37:35 PM Baz Walter wrote: On 08/07/11 02:36, Algis Kabaila wrote: On Fri, 8 Jul 2011 03:36:40 AM Baz Walter wrote: you would need to reboot for it to have an effect, as the plugin would still be loaded in memory. in any case, it's not a real solution to your problem - just a possible workaround if you don't want/need the functionality the plugin provides. really, i can't understand why kde chose to force this plugin on users. i appreciate that many people want unified dialogs and so forth, but it's pretty rude not to give users the option to disable something which affects non-kde applications. Baz, Good point! After deleting the plugin and a reboot: ak@supremo:~/save$ ls -la /usr/lib/kde4/plugins/gui_platform/ total 8 drwxr-xr-x 2 root root 4096 2011-07-08 15:02 . drwxr-xr-x 9 root root 4096 2011-04-27 21:15 .. ak@supremo:~/save$ ak@supremo:~/save$ python3 save.py KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work ak@supremo:~/save$ Since you're working on an adult system, there's probably a 64bit version of that darn thing hanging around somewhere.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A dire warning message
On Friday 08 July 2011, 02:01:46 Algis Kabaila wrote: @Pete - I really do appreciate your helpful comments. It is people like you that keep me interested in software issues at the sunset of my life (as my even older sister says - I don't mind dying, just not today - and not tomorrow):) Al, thank you for the kind words. It's people like you, that keep the world turn around. Knowing you age, I can only adhere, that age is mostly a state of mind, and from that POV, you're younger than a lot of people I got to know. Keep your head up, keep up your interests. You're a true gain for our little community (of people, that know who is the real Mc Coy..). Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A dire warning message
Dear Al, On Thursday 07 July 2011, 11:22:34 Algis Kabaila wrote: This bothersome warning message probably has nothing to do with PyQt. However, it does occur whenever I use PyQt. No great harm seems to occur and the programs function normally, except for that message. Is there something wrong with my setup or should I just forget all about it? I attach a little test program open.py. It does not do anything - and just tries to open a file dialog after a click on the pushButton. That produces the error message. The program is mainly filled with the message itself and some comments. I would think that this probably has been dealt with, but I will not know if I do not ask... so thanks again for your patience. OTH, may be other people will find this informative, too - or am the only one being subjected to this warning? #!/usr/bin/env python3.2 ''' open.py - a sample program to show the dire warning it generates and every other program that tries to use a file read dialog. Platform - kubuntu 11.04 natty Python 3.2 Qt 4.7.2 (from natty binaries. PyQt4 4.8.4 - bound to Python 3.2 whilst compiling On opening a file dialog, I get this warning: KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work Search on the net seems to give some grim news: quote start Re: VLC Hangs on Open File dialog Postby Rémi Denis-Courmont » Sat Jan 29, 2011 11:58 pm In the mean time, someone in KDE actually looked at the issue. It turns to be a longstanding known bug in the QProcess class from Qt4. That bug gets triggered by a new feature in KDE 4.6 relative to MIME types in the Open and Save dialogs, that happens to involve the QProcess class. In the end, VLC is blaming KDE, KDE is blaming Qt, and Qt is blaming the kernel. quote end ''' Hmm, at the first glance, this is a KDE problem, since KDE plugs its own file dialog into Qt, but fails to properly deal with locales there after due to them not being initialized correctly. This is going to produce issues, if you're calling QFileDialogs and expects them being localized correctly. It might be possible to circumvent these issues by instancing KApplication instead of QApplication (and doing the proper KDE4 setup sequence). Detlev is doing a nice trick in eric4: it checks, if PyKDE4 is available, and uses it, otherwise it uses plain Qt4. How this could be related to QProcess escapes me but what do I know.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A dire warning message
On Thursday 07 July 2011, 14:00:28 Algis Kabaila wrote: On Thu, 7 Jul 2011 09:03:47 PM Hans-Peter Jansen wrote: Dear Al, On Thursday 07 July 2011, 11:22:34 Algis Kabaila wrote: This bothersome warning message probably has nothing to do with PyQt. However, it does occur whenever I use PyQt. No great harm seems to occur and the programs function normally, except for that message. Is there something wrong with my setup or should I just forget all about it? I attach a little test program open.py. It does not do anything - and just tries to open a file dialog after a click on the pushButton. That produces the error message. The program is mainly filled with the message itself and some comments. I would think that this probably has been dealt with, but I will not know if I do not ask... so thanks again for your patience. OTH, may be other people will find this informative, too - or am the only one being subjected to this warning? #!/usr/bin/env python3.2 ''' open.py - a sample program to show the dire warning it generates and every other program that tries to use a file read dialog. Platform - kubuntu 11.04 natty Python 3.2 Qt 4.7.2 (from natty binaries. PyQt4 4.8.4 - bound to Python 3.2 whilst compiling On opening a file dialog, I get this warning: KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work Search on the net seems to give some grim news: quote start Re: VLC Hangs on Open File dialog Postby Rémi Denis-Courmont » Sat Jan 29, 2011 11:58 pm In the mean time, someone in KDE actually looked at the issue. It turns to be a longstanding known bug in the QProcess class from Qt4. That bug gets triggered by a new feature in KDE 4.6 relative to MIME types in the Open and Save dialogs, that happens to involve the QProcess class. In the end, VLC is blaming KDE, KDE is blaming Qt, and Qt is blaming the kernel. quote end ''' Hmm, at the first glance, this is a KDE problem, since KDE plugs its own file dialog into Qt, but fails to properly deal with locales there after due to them not being initialized correctly. This is going to produce issues, if you're calling QFileDialogs and expects them being localized correctly. It might be possible to circumvent these issues by instancing KApplication instead of QApplication (and doing the proper KDE4 setup sequence). Detlev is doing a nice trick in eric4: it checks, if PyKDE4 is available, and uses it, otherwise it uses plain Qt4. How this could be related to QProcess escapes me but what do I know.. Pete Yes, I recall Detlev putting me right on other issues with PyKDE4 - requires putting a tick on one of the configuration boxes of eric. I am using eric5 (that's the python3 version). I will install the newest version and look for the box to tick - Detlev is a very helpful guy! Yes, and eric is awesome. But unfortunately, even eric (4.4.16 at least) using PyKDE4 code suffer from this, too. Hence I was wrong. The message does occur exactly the same way when the scripts are fired from CLI. I should try it on a gnome desktop in order to avoid PyKDE4. No, it's not a PyKDE4 issue. It's triggered deep under the covers somewhere between KDE4 and Qt4. We will have to wait for the respective people to have it fixed one day. You will get rid of it, if you deinstall kdelibs4 and all dependencies, but probably, it's easier to wait and live with it. IIRIC, PyKDE4 is not windows compatible. And that is a problem if one wants to ensure compatibility with Windows - I do not really care about that. Too late for me :). That was a red herring. See above. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Designer issues, WYS-is not-WYG
On Tuesday 28 June 2011, 01:08:38 James Polk wrote: I like Designer and have been using it more and more... but I've been noticing that many times what you see in the Designer window ends up not matching when you run your program later. For example, small offsets in X and Y...look good in Designer, but don't end up in the same place in the program. Many times, it's not that consequential, but in a more complex UI, with very precise positioning, this can be very frustrating. One example,...create a MainWindow, drop a horizontal slider into it, and make it's height 60, so you get a kinda' tall main marker. Save it as a .ui file,...load it into your program, and the tall marker is now short. ( I dynamically load my UI's with uic.loadUiType(), but the same phenomena happens either way.) Using Designer's preview is consistent with what's in Designer, but something is lost in translation later when it goes into the program. I often get positon offset weirdness using QFrames, QGroupBoxes,etc... They look good in Designer, then off in main program, so I have to make them look off in Designer, so they'll end up in the right place when they're used. This all sounds like you're using fixed geometries and no layouts. I cannot recommend doing this in any sane project. The ability of combining different layouts in a top level container constitutes one of Qt's strength, resulting in resolution independent user interfaces. Please provide an example UI, that demonstrates your issues. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QLineEdit vs. menu keyboard shortcuts
On Tuesday 28 June 2011, 19:56:35 Nathan Weston wrote: On 6/28/2011 1:48 PM, Baz Walter wrote: On 28/06/11 16:50, Nathan Weston wrote: QLineEdit has some keyboard shortcuts (e.g. Ctrl+Z for Undo) that clash with the shortcuts for QActions in my application menus. When a QLineEdit has keyboard focus, it intercepts these shortcuts and my QActions are never triggered. I'd like to give application-level shortcuts precedence over QLineEdit's shortcuts, but I can't seem to find a clean and general way to do this. Alternatively, is there a way to customize the keyboard shortcuts in QLineEdit? If I could disable some of the problematic shortcuts that would be a reasonable workaround. the default key bindings for QLineEdit are hard-coded, but the actual key sequences used are platform-dependent (and the same goes for most (all?) other widgets which have them). but what is your reason for wanting to change the default behaviour? as a user, i would expect all the 'normal' shortcuts to work when typing in a line edit. if Ctrl+Z undid something in some other widget that i wasn't looking at, it could become very confusing. (IIRC this was how things used to work with qt3 - and good riddance to that!). I have a subclass of QLineEdit for entering numbers. The user can either type in a number, or drag the mouse to increase/decrease the value, like a slider (similar widgets are often found in After Effects and other video editing software). In the latter mode, the widget is temporarily set as non-editable, so its built-in Undo behavior doesn't work at all (but it still eats the keyboard event!). If you're subclassing QLineEdit anyway, what does stop you from overriding keyPressEvent to catch and accept() any unwanted key presses? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QPainter::end: Painter ended with 2 saved states
On Tuesday 28 June 2011, 20:52:12 Eric Frederich wrote: I was trying to get an example working with a QThread. I wound up creating one but after running it for a while and pressing buttons I got the error... QPainter::end: Painter ended with 2 saved states Am I doing something wrong? I wanted an example where a worker thread would query a database or some other long running operation and leave the GUI responsive (although disabling certain elements like the button it was launched from). This is the code I was running from PyQt4.QtCore import * from PyQt4.QtGui import * class Blah(QThread): def __init__(self, parent=None): super(Blah, self).__init__(parent) print 'new thread created' def run(self): print 'running' self.parent().setEnabled(False) import time for i in xrange(10): self.parent().setText(%02d % i) time.sleep(.1) self.parent().setText(Push Me) self.parent().setEnabled(True) You're doing bad things here, that you shouldn't do from a thread, e.g. using methods, that trigger redraws. You should create signals in your thread, that signals operations to the main thread, where you would actually process these operations without fear. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Image doesn't show up
On Saturday 25 June 2011, 06:57:05 Algis Kabaila wrote: But how to change the old style signal/slot statement to the new style?... exit.triggered.connect(self.close) perhaps? Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug report: multiple QApplication instances cause a segfault
On Friday 24 June 2011, 03:35:55 Algis Kabaila wrote: On Thu, 23 Jun 2011 10:08:50 PM Hans-Peter Jansen wrote: Dear Al, On Thursday 23 June 2011, 13:26:02 Algis Kabaila wrote: On Thu, 23 Jun 2011 07:06:49 PM Hans-Peter Jansen wrote: [snip...] Following Pete's advise, I've installed 23 new packages that appeared to be dbg related (169 MiB downloaded, 802 MiB additional space of hdd used). The gdb was then invoked with the command, shown immediately after the marker. After that in the invoked IDLE Python Shell given were the following commands: from PyQt4 import QtGui app = QtGui.QApplication([]) app.quit() app = QtGui.QApplication([]) app.quit() app = QtGui.QApplication([]) At that point the IDLE Shell froze. Typed on the CLI shell was *bt*. The whole dialog is shown between the markers. ak@supremo:~$ gdb python3 -ex set args /usr/bin/idle-python3.2 -n -ex run GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as x86_64-linux-gnu. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/bin/python3...Reading symbols from /usr/lib/debug/usr/bin/python3.2mu...done. done. Python symbols could be loaded. Fine. Starting program: /usr/bin/python3 /usr/bin/idle-python3.2 -n [Thread debugging using libthread_db enabled] [New Thread 0x7fffef1cd700 (LWP 2347)] Program received signal SIGSEGV, Segmentation fault. 0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4 libQtGui symbols are still missing. They should appear in /usr/lib/debug/usr/lib/. (gdb) bt #0 0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4 #1 0x7053ad3f in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #2 0x70537fb1 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #3 0x70538aa6 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #4 0x7052e48d in XQueryTree () from /usr/lib/x86_64-linux- gnu/libX11.so.6 For this case, libX11 symbols could be useful, too. I've no idea, why these libs appear in /usr/lib/x86_64-linux-gnu? Does that mean, that ubuntu hosts 32bit libs in /usr/lib? Confusing. #5 0x70b8a246 in Tk_HandleEvent () from /usr/lib/libtk8.5.so.0 #6 0x70b8a7c0 in ?? () from /usr/lib/libtk8.5.so.0 #7 0x708d564f in Tcl_ServiceEvent () from /usr/lib/libtcl8.5.so.0 #8 0x708d58d5 in Tcl_DoOneEvent () from /usr/lib/libtcl8.5.so.0 #9 0x711ba2e9 in ?? () from /usr/lib/python3.2/lib- dynload/_tkinter.cpython-32mu.so #10 0x00465d28 in call_function (f=value optimised out, throwflag=value optimised out) at ../Python/ceval.c:3875 #11 PyEval_EvalFrameEx (f=value optimised out, throwflag=value optimised out) at ../Python/ceval.c:2673 #12 0x004675f2 in PyEval_EvalCodeEx (_co=value optimised out, globals=value optimised out, locals=value optimised out, args=value optimised out, argcount=1, kws=0x12a0d40, kwcount=0, defs=0xe76ba8, defcount=1, kwdefs=0x0, closure=0x0) at ../Python/ceval.c:3311 In these frames you can see the difference to missing symbols. While a lot of values are optimized out, you see the function arguments, the source code line, etc. instead of ?? (). [...] It is clear that there is segmentation fault. I do not know how to read the dbg output and would appreciate advice whether the output is useful or not. @ Pete - do you want me to do any more testing? If yes, just let me know. Thanks again! The whole issue might be hunting a red herring. It looks like an unfortunate interaction of tcl, tk, X, Qt and python GC. Would you try Baz' suggestion of assigning None to app before creating another instance? In my environment, I'm able to construct and quit a dozen app instances without segfaults (even without None assignment in between): python: 2.6.2 sip: 4.12.3 qt4: 4.7.1 pyqt4: 4.8.4 Still 32bit. Yes, I'm backward.. Creating an QApplication object is one of the most involved Qt calls from an interaction with other parts of the system perspective, where the other parts depend on each other and even interact behind the scenes. Now mix in pythons garbarge collector behavior, and you get a feeling, why these kind of issues are unpossible to get right in all kinds of possible permutations of elements. I chimed into the discussion to show, how using gdb is able to shed some light on such issues. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug report: multiple QApplication instances cause a segfault
On Thursday 23 June 2011, 08:28:06 David Townshend wrote: If it vanishes, it implies a segfault which you will probably see if you run idle form the command line. You should be able to get a backtrace by running idle through gdb, i.e, from the command line, run gdb idle. Then in gdb type run. Idle should start as usual, so get it to crash. Then within gdb type bt. This will give a backtrace which will hopefully at least point to whether its python, pyqt or qt. Close, but no cigar. after installing assorted .debug packages of python(3), sip, qt, PyQt, and probably glibc, glib, libstdc++, you usually invoke a python script with gdb similar to: gdb python3 -ex set args /usr/bin/idle -ex run Hth, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug report: multiple QApplication instances cause a segfault
Dear Al, On Thursday 23 June 2011, 13:26:02 Algis Kabaila wrote: On Thu, 23 Jun 2011 07:06:49 PM Hans-Peter Jansen wrote: On Thursday 23 June 2011, 08:28:06 David Townshend wrote: If it vanishes, it implies a segfault which you will probably see if you run idle form the command line. You should be able to get a backtrace by running idle through gdb, i.e, from the command line, run gdb idle. Then in gdb type run. Idle should start as usual, so get it to crash. Then within gdb type bt. This will give a backtrace which will hopefully at least point to whether its python, pyqt or qt. Close, but no cigar. after installing assorted .debug packages of python(3), sip, qt, PyQt, and probably glibc, glib, libstdc++, you usually invoke a python script with gdb similar to: gdb python3 -ex set args /usr/bin/idle -ex run Hth, Pete Hi Pete, David et al, I know sweet all about the gdb, so will need to read up on it (at least a little bit). I put in the CLI your command and attach the listing, warts and all. It does not tell *me* much, so I list it all below. You will see that idle could not be found at the location suggested, so I ran it with the command that IDLE gui had in the properties. Sure, that's why I wrote similar to ;-). So IDLE did start ok and it failed after the entry of the same commands under (gdb) as has been tried on idle window earlier (without invoking gdb): from PyQt4 import QtGui app = QtGui.QApplication([]) app.quit() app = QtGui.QApplication([]) app.quit() -- frozen text in IDLE Python Shell. At this point bt command was entered within the gdb shell. As expected there are segmentation faults. The following are the grim details: ** ak@supremo:~$ gdb python3 -ex set args /usr/bin/idle -ex run Starting program: /usr/bin/python3 /usr/bin/idle [Thread debugging using libthread_db enabled] /usr/bin/python3: can't open file '/usr/bin/idle': [Errno 2] No such file or directory Program exited with code 02. (gdb) /usr/bin/idle-python3.2 -n Undefined command: . Try help. (gdb) run /usr/bin/idle-python3.2 -n Starting program: /usr/bin/python3 /usr/bin/idle-python3.2 -n [Thread debugging using libthread_db enabled] [New Thread 0x7fffef1cd700 (LWP 1705)] Program received signal SIGSEGV, Segmentation fault. 0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4 (gdb) bt #0 0x7fffec894b1f in ?? () from /usr/lib/libQtGui.so.4 #1 0x7053ad3f in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #2 0x70537fb1 in ?? () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #3 0x70538aa6 in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6 #4 0x7052e48d in XQueryTree () from /usr/lib/x86_64-linux- gnu/libX11.so.6 That's pretty much useless in this form. That's why I wrote about debug packages. I'm sure, that ubuntu provides them somewhere. In your case, you need to install the libqt4 (or however Ubuntu calls it) debug packages at least to make this backtrace useful. Cheers, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt application frozen if run in localhost; OK if SSH'd to another host
On Thursday 23 June 2011, 18:26:52 Arrieta wrote: Consider the following PyQT application (helloworld.py): import sys from PyQt4 import QtGui def main(): app = QtGui.QApplication(sys.argv) win = QtGui.QPushButton(Hello, World!) win.show() return app.exec_() if __name__ == __main__: sys.exit(main()) If I run ($python helloworld.py) this application from a shell in my ^ It looks, like $python is some unusual shell variable, that we cannot interprete. computer, I see the main container for the button, but the button itself never renders. What happens, if you run python interactively, and paste the above into the python shell? After a few clicks on the [x] of the main container, I receive a warning window stating: Window with title helloworld.py is not responding. This window belongs to application helloworld.py (PID=2000, hostname=localhost). Do you wish to terminate this application? (All unsaved data in this application will be lost.) [Yes] [No] This is the window manager chiming in. For some reason, the communication to the X server seems to be stalled. xauth issues? If I then use the same shell window to SSH to another machine in our network and run the exact same program (we have an NFS file system; I see the same files in every machine) it runs as expected. In fact, even if I SSH back to my original computer I can run the application. Well, ssh -X creates a private communication channel to the X server. This happens with all the PyQt applications I have developed for my group, and it happens on every computer in our network: the applications won't run locally, but run perfectly fine if the user is connected to the terminal via SSH (let me insist, even if SSH'd to your local, physical computer!) I cannot see a single reason, how PyQt could be the culprit here. The whole issue sounds like a major misconfiguration of X, selinux, or some other security feature running wild.. Do you have any suggestion for debugging/tracking down this problem? You might want to recode the script in C++. Due to the nature of PyQt, I expect this to fail in a similar way, or your PyQt build is busted in non trivial ways. Many thanks. Python 2.6.5 Qt 4.6.2 Red Hat Linux Enterprise Edition (4) Since you asked here, you might want to tell us the versions of sip and PyQt you use. Even, if it happens that you discover the reason being something unrelated to sip/PyQt, report this back here, please. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP, PyQt compatibility with QT version
On Tuesday 14 June 2011, 07:09:27 Vivek Narvekar wrote: Hello, I was previously using SIP 3.3 and PyQt 3.3 versions with Qt 3.0.8. Now I am planning to migrate to QT 3.3.6-8. This might work, but nobody will care, if it doesn't. Can you please tell me if SIP 3.3 and PyQt 3.3 version are compatible with QT 3.3.6-8 ? Well, being backwards isn't a crime per se, but for your own safety, I would strongly advise to use the the latest sip and PyQt3 releases: sip: 4.12.3 PyQt3: 3.18.1 That way, your PyQt3 code has good chances of still working properly, and you have the foundation for using PyQt4 in parallel, too. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] SIP, PyQt compatibility with QT version
On Tuesday 14 June 2011, 14:49:16 Nahuel Greco wrote: Be careful, I think using PyQt3 3.18.1 with SIP 4.12.1 introduces memory leaks (these are the versions on latest Debian unstable). Don't know about using SIP 4.12.3. Check my post here: http://old.nabble.com/Simple-usage-of-QListView-seems-to-leak-memory-in-P yQt-3.18.1-td31812404.html I noticed your post on this list and can confirm your findings. It might be worth to convert your memory leak exploit into C++ just to rule out a Qt bug. Otherwise, this is Phils call (IFAICT, please understand, that PyQt3 bugs are handled with very low priority only, if at all). Pete Saludos, Nahuel Greco. On Tue, Jun 14, 2011 at 6:28 AM, Hans-Peter Jansen h...@urpla.net wrote: On Tuesday 14 June 2011, 07:09:27 Vivek Narvekar wrote: Hello, I was previously using SIP 3.3 and PyQt 3.3 versions with Qt 3.0.8. Now I am planning to migrate to QT 3.3.6-8. This might work, but nobody will care, if it doesn't. Can you please tell me if SIP 3.3 and PyQt 3.3 version are compatible with QT 3.3.6-8 ? Well, being backwards isn't a crime per se, but for your own safety, I would strongly advise to use the the latest sip and PyQt3 releases: sip: 4.12.3 PyQt3: 3.18.1 That way, your PyQt3 code has good chances of still working properly, and you have the foundation for using PyQt4 in parallel, too. Pete ___ PyQt mailing list PyQt@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] Comppiling QScintilla with python 3.2
On Wednesday 15 June 2011, 03:04:32 Algis Kabaila wrote: After long trepidation, I started moving my python scripts from python 2.x to python 3.2. Pleasant surprise - sip-4.12.3 and PyQt-x11-gpl-4.8.4 compiled without problems! Python 3.2 IDLE does not work well with this version of PyQt. Anyway, eric 5.x would be better, so it is necessary to install python 3 version of QScintilla. Downloaded QScintilla-gpl-2.5.1.tar.gz, expanded the tar ball and attempted to compile: Changed the current dir to QScintilla-gpl-2.5.1/Python/ and tried the first step: $ python3.2 configure.py It immediately responded with the message: Qsci/qsciglobal.h could not be found in /usr/include/qt4. If QScintilla is installed then use the -n argument to explicitly specify the correct directory. You need to compile and install the qscintilla C++ lib before generating the python wrappers: pushd Qt4 qmake qscintilla.pro sudo make install popd I am using a freshly installed kubuntu 11.04 natty OS and had a python 2.x version of QScintilla installed from ubuntu binaries. I thought that the message may simply be because of the installed binaries, so completely removed the installed QScintilla with the aid of synaptic program and tried to repeat the first step of compilation. It failed again with an identical message. I suspect I am doing someting wrong, but what? So where do I go from here? Al, manually compiling stuff like this should be done as the last resort only. One of the most compelling reasons to use Linux is the distributions package manager. OTOH, mixing that with manual builds is the source for many strange failures. My advice is: go through the hassle of building packages for your distribution. Even better, as far as I know, Ubuntu has something similar to openSUSE build service, or you might want to use that, since it is able to create ubuntu builds, too. Just needing the packages on a second system will pay off for the initial hassle. Guaranteed. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: dip v0.3 Released
On Monday 13 June 2011, 10:12:03 Phil Thompson wrote: On Sun, 12 Jun 2011 20:06:45 +0200, Wolfgang Keller felip...@gmx.net wrote: Hello, It also includes the ability to bind GUIs created using traditional means (ie. standard PyQt calls or Qt Designer) to models so that those models are automatically updated by the GUI and vice versa. Would dip be suitable (i.e. make it easier than naked PyQt) to put a GUI onto a bunch of SQlAlchemy objects? Having thought about this a bit more... No, but it's an interesting idea and may not be too difficult to do. I'll think about it a bit more... As an aside, SQLAlchemy is the most advanced and therefore popular SQL ORM in the python world today. It would raise the out of box value of dip greatly. I could imagine, that there's a need for a SQLAlchemy PyQt integration module (QSql replacement) as a glue layer in between. Lots of hand waving, I know. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] job postings OK?
On Thursday 09 June 2011, 23:49:29 Kerri Reno wrote: Is it OK to post job openings here? IMHO, as long as they're serious offerings strongly related to PyQt, emitted directly from the principal (no head hunter), preferably in plain ASCII format, nobody would oppose this attempt here. If the number of requests raises above a dozen per month over time, Phil might add another ML, eg. [PyQt-Jobs] for that specific topic. Phil, please object, if you disagree. Good luck, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QModelIndex.internalPointer
On Sunday 22 May 2011, 11:42:38 Phil Thompson wrote: On Sun, 22 May 2011 02:23:35 +0200, Hans-Peter Jansen h...@urpla.net wrote: On Wednesday 18 May 2011, 16:03:59 Andrei Kopats wrote: Here is example. Unfortunately, with it I can reproduce crash only if reference to integer was passed to createIndex() In the attachment you can find test script, and execution log. The log also contains my system info. Confirmed, and from what I can see, this should not happen. Mind converting it to C++, and posting code and results here, just to exclude an Qt issue? It's working as intended. If you pass an int then it is assumed that this is a memory address, otherwise it is assumed to be a borrowed reference to a Python object. If you want an int to be interpreted differently then wrap it in a class. Okay, that makes sense. Thanks for the clarification. I would have supplied a doc patch for this matter, but couldn't locate the doc source. Guess, it is generated from the Qt docs directly.. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QModelIndex.internalPointer
On Wednesday 18 May 2011, 16:03:59 Andrei Kopats wrote: Here is example. Unfortunately, with it I can reproduce crash only if reference to integer was passed to createIndex() In the attachment you can find test script, and execution log. The log also contains my system info. Confirmed, and from what I can see, this should not happen. Mind converting it to C++, and posting code and results here, just to exclude an Qt issue? gdb python -ex set args test2.py -ex run Starting program: /usr/bin/python test2.py [Thread debugging using libthread_db enabled] Program received signal SIGSEGV, Segmentation fault. meth_QModelIndex_internalPointer (sipSelf=0xb7c3bf44, sipArgs=0xb7c4f02c) at /usr/src/debug/PyQt-x11-gpl-snapshot-4.8.5-4bd2045a6bc8/sip/QtCore/qabstractitemmodel.sip:52 52 Py_INCREF(sipRes); Current language: auto; currently c++ (gdb) bt #0 meth_QModelIndex_internalPointer (sipSelf=0xb7c3bf44, sipArgs=0xb7c4f02c) at /usr/src/debug/PyQt-x11-gpl-snapshot-4.8.5-4bd2045a6bc8/sip/QtCore/qabstractitemmodel.sip:52 #1 0xb7e9d815 in PyCFunction_Call (func=0x80e824c, arg=0xb7c4f02c, kw=0x0) at Objects/methodobject.c:81 #2 0xb7ef04c5 in PyEval_EvalFrameEx (f=0x8133d2c, throwflag=0) at Python/ceval.c:3679 #3 0xb7ef027d in PyEval_EvalFrameEx (f=0x805ece4, throwflag=0) at Python/ceval.c:3765 #4 0xb7ef5dbf in PyEval_EvalCodeEx (co=0xb7c7c7b8, globals=0xb7c7302c, locals=0xb7c7302c, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2942 #5 0xb7eedcb3 in PyEval_EvalCode (co=0xb7c7c7b8, globals=0xb7c7302c, locals=0xb7c7302c) at Python/ceval.c:515 #6 0xb7f0fb1c in run_mod (mod=value optimized out, filename=value optimized out, globals=0xb7c7302c, locals=0xb7c7302c, flags=0xbfffeba8, arena=0x8076008) at Python/pythonrun.c:1330 #7 0xb7f0fbdb in PyRun_FileExFlags (fp=0x80ac1e8, filename=0xbfffef5e test2.py, start=257, globals=0xb7c7302c, locals=0xb7c7302c, closeit=1, flags=0xbfffeba8) at Python/pythonrun.c:1316 #8 0xb7f105cf in PyRun_SimpleFileExFlags (fp=0x80ac1e8, filename=0xbfffef5e test2.py, closeit=1, flags=0xbfffeba8) at Python/pythonrun.c:926 #9 0xb7f10858 in PyRun_AnyFileExFlags (fp=0x80ac1e8, filename=0xbfffef5e test2.py, closeit=1, flags=0xbfffeba8) at Python/pythonrun.c:731 #10 0xb7f1ce52 in Py_Main (argc=1, argv=0xbfffec74) at Modules/main.c:597 #11 0x08048692 in main (argc=Cannot access memory at address 0x0 ) at Modules/python.c:23 python: 2.6 sip: 4.12.3-snapshot-274e38133e7a qt4: 4.7.1 pyqt4: snapshot-4.8.5-4bd2045a6bc8 Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Reasign event
On Friday 20 May 2011, 01:46:36 Hugo Leveille wrote: Ok So for my exemple,what would be the correct syntax thanks alot -- Hugo Leveille Compositing TD Vision Globale hu...@fastmail.net Sent from my iPhone Send me one over, and we're fine ;-) On May 19, 2011, at 7:30 PM, Hans-Peter Jansen h...@urpla.net wrote: On Friday 20 May 2011, 00:12:14 Hugo Léveillé wrote: Newbie in using event in pyqt Let say I just want a keyPressEvent to happen with a certain QLineEdit I tried : self.myLineEDit.keyPressEvent = self.myEvent def myEvent(self,event): print Hello world QtGui.QLineEdit.keyPressEvent(self, event) Sure enought its working. Now it only print hello world when I am typing in that line edit. But the problem is that the text I am typing does not appear in the line edit. Only the printing of Hello world happend What am I missing ? Calling the base class. You're disrupting the event handler chain. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Reasign event
On Friday 20 May 2011, 00:12:14 Hugo Léveillé wrote: Newbie in using event in pyqt Let say I just want a keyPressEvent to happen with a certain QLineEdit I tried : self.myLineEDit.keyPressEvent = self.myEvent def myEvent(self,event): print Hello world Sure enought its working. Now it only print hello world when I am typing in that line edit. But the problem is that the text I am typing does not appear in the line edit. Only the printing of Hello world happend What am I missing ? Calling the base class. You're disrupting the event handler chain. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Links in QMessageBox.about() not working
On Wednesday 18 May 2011, 19:29:04 Detlev Offenbach wrote: On Dienstag, 17. Mai 2011, Joel B. Mohler wrote: On Tuesday, May 17, 2011 08:46:57 am David Boddie wrote: On Tue May 17 10:21:04 BST 2011, Hans-Peter Jansen wrote: On Monday 16 May 2011, 14:28:00 Anoop Panavalappil wrote: I am developing a simple cross platform GUI using PyQt. I have tried to show the about dialog using QMessageBox.about() with richtext formatting with html tags (b, br, and a). The dialog correctly renders the HTML but the links are not working. Interestingly, when I tried the QMessageBox.aboutQt() to show the About Qt dialog, the links in that dialog doesn't work either. Same with the About Qt dialog form the help menu of Qt Designer also. Is there any workaround for the issue? Or is it a reported bug? Works for me. Since you didn't told us your OS/versions, I will leave it up to you to find out mine. Hehe. Anoop and I discussed the problem on IRC. We're both using Qt 4.7.2. The problem occurs with KDE 4 on Kubuntu (10.10, if I remember correctly). On the other hand, on KDE 3 and Windows, it apparently works fine. I concur that the links don't work on ubuntu 10.04 with qt 4.6.2 in a PyQt application. They do work in the kmail kde about box. It is also working on my windows install, but I forget the exact versions and am in linux at the moment. I can confirm this issue for Kubuntu 11.4. It works on other Linux flavours (like openSUSE) and Win systems. Then this might be a Kubuntu Qt build issue. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] App Color/Style Themes
On Monday 16 May 2011, 18:44:59 James Polk wrote: Anyone have any experience working with,tweeking, and/or creating new app color schemes? You can change your applications color scheme by tweaking QPalette and calling QApplication.setPalette(). ...the one's specificed with app.setStyle()... Of the released ones: Plastique, CDE, motif, SGI, Windows, CleanLooks, Mac is there a way to tweek the colors in these? Where are they found? Can one create a new one from scratch? or a derivative of the above? You're mixing color schemes and styles here. Since some QStyles are loaded as a plugin, Phil doesn't support QStyle subclassing at all. To support this, an auxilliary sip module needs to be created, that copes with the nature of plugins. Please refer to a discussion of mine with Phil half a year ago on this list. Are these themes related to or the same as styleSheets ? Well, themes derive from QStyle and stylesheets manipulate QStyle attributes. Hth, Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Links in QMessageBox.about() not working
On Monday 16 May 2011, 14:28:00 Anoop Panavalappil wrote: Hi There, I am developing a simple cross platform GUI using PyQt. I have tried to show the about dialog using QMessageBox.about() with richtext formatting with html tags (b, br, and a). The dialog correctly renders the HTML but the links are not working. Interestingly, when I tried the QMessageBox.aboutQt() to show the About Qt dialog, the links in that dialog doesn't work either. Same with the About Qt dialog form the help menu of Qt Designer also. Is there any workaround for the issue? Or is it a reported bug? Works for me. Since you didn't told us your OS/versions, I will leave it up to you to find out mine. Hehe. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSpinBox does not recognize returnPressed event
On Wednesday 11 May 2011, 11:13:24 Adrian Casey wrote: I want to connect the returnPressed() event to a QSpinBox widget but it is not working. I use the same approach with a QComboBox and it works. I'm using Qt 4.7.0 and PyQt on Kubuntu 10.10. Here is a simple form containing a combobox and a spinbox. Only the combobox registers the returnPressed event. Can anyone tell me why the spinbox does not see the returnPressed event? From a cursory look, I would call this a Qt bug. Obviously, they handle the keyEvent for the return key in some way (by selecting the text), but forget to emit the signal, nor call the QLineEdit base class event method. A look into the Qt source would clarify things and often gives an idea for a work around. As a starter, you could install some kind of event filter on the lineEdit widget and emit the signal yourself. Pete #!/usr/bin/python # simple.py import sys from PyQt4 import QtGui def do_it(): print 'Return pressed!' app = QtGui.QApplication(sys.argv) widget = QtGui.QWidget() widget.resize(250, 150) widget.setWindowTitle('Signal Test') layout = QtGui.QBoxLayout(2, widget) cb = QtGui.QComboBox(widget) cb.setEditable(True) sb = QtGui.QSpinBox(widget) layout.addWidget(sb) layout.addWidget(cb) cb.lineEdit().returnPressed.connect(do_it) sb.lineEdit().returnPressed.connect(do_it) widget.show() sys.exit(app.exec_()) ___ 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] QModelIndex.internalPointer
On Friday 29 April 2011, 09:59:40 Andrei Kopats wrote: Hi, Few days ago QModelIndex.internalPointer was discussed here. I also have problems with it. I can't say exactly, when crash occurs, and when it doesn't, but, this code generates crash for me: index = self.createIndex(row, column, True) print index.internalPointer() I tried to pass object (which has other references, so, is not destroyed by gc), integer, bool value as internalPoitner, and have crashes in any case. I use the latest PyQt and SIP snapshots. You need to provide a minimal runnable example, and describe the procedure to provoke the failure. Don't forget to mention your environment, and paste in python and gdb tracebacks. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt