[PyKDE] bug in pyqt4/python in QTextEdit/QTextBlockUserData
The following example will cause python to segfault in linux and window. tested on latest debian sid pyqt packages and latest windows binary distribution of pyqt on winxp. Just run it and when you close the window, python itself segfaults. I would expect at least some sort of exception raised but i think the program below is correct and should work normal without any segfaulting or raising exceptions. from PyQt4.QtGui import * class UserData(QTextBlockUserData): def __init__(self): QTextBlockUserData.__init__(self) class MainWindow(QMainWindow): def __init__(self, *args): QMainWindow.__init__(self, *args) self.te=QTextEdit() self.setCentralWidget(self.te) self.ud=UserData() self.te.textCursor().block().setUserData(self.ud) app=QApplication(sys.argv) mw=MainWindow() mw.show() app.exec_() ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] Re: pylupdate4 and pyrcc4 will not be built because the Qt XML module is missing.
Hi,Yes, the xml qt4 lib is present :-(- [EMAIL PROTECTED] PyQt4]# ll /software/local/discovery/de/lib/libQtXml*-rw-r--r-- 1 root root 749 Nov 7 13:44 /software/local/discovery/de/lib/libQtXml.la -rw-r--r-- 1 root root 672 Nov 7 13:44 /software/local/discovery/de/lib/libQtXml.prllrwxrwxrwx 1 root root 17 Nov 7 15:11 /software/local/discovery/de/lib/libQtXml.so - libQtXml.so.4.2.1lrwxrwxrwx 1 root root 17 Nov 7 15:11 /software/local/discovery/de/lib/libQtXml.so.4 - libQtXml.so.4.2.1lrwxrwxrwx 1 root root 17 Nov 7 15:11 /software/local/discovery/de/lib/libQtXml.so.4.2 - libQtXml.so.4.2.1-rwxr-xr-x 1 root root 328504 Nov 7 15:11 /software/local/discovery/de/lib/libQtXml.so.4.2.1 -rw-r--r-- 1 root root 1504030 Nov 7 13:54 /software/local/discovery/de/lib/libQtXml.so.4.2.1.debug- and pyqt lib seems correctly linked with the right qt4 libraries as this exemple show you : cd /software/local/discovery/de/lib/python2.4/site-packages/PyQt4[EMAIL PROTECTED] PyQt4]# ldd QtGui.so libQtGui.so.4 = /software/local/discovery/de/lib/libQtGui.so.4 (0x002a95c95000) libpng12.so.0 = /usr/lib64/libpng12.so.0 (0x002a9659d000) libSM.so.6 = /usr/X11R6/lib64/libSM.so.6 (0x002a966c4000) libICE.so.6 = /usr/X11R6/lib64/libICE.so.6 (0x002a967cf000) libQtCore.so.4 = /software/local/discovery/de/lib/libQtCore.so.4 (0x002a968ea000) libpthread.so.0 = /lib64/tls/libpthread.so.0 (0x002a96b93000) libXi.so.6 = /usr/X11R6/lib64/libXi.so.6 (0x002a96ca9000) libXrender.so.1 = /usr/X11R6/lib64/libXrender.so.1 (0x002a96db1000) libXrandr.so.2 = /usr/X11R6/lib64/libXrandr.so.2 (0x002a96eba000) libXfixes.so.3 = /usr/X11R6/lib64/libXfixes.so.3 (0x002a96fbe000) libXcursor.so.1 = /usr/X11R6/lib64/libXcursor.so.1 (0x002a970c3000) libXinerama.so.1 = /usr/X11R6/lib64/libXinerama.so.1 (0x002a971cd000) libfreetype.so.6 = /usr/lib64/libfreetype.so.6 (0x002a972d) libfontconfig.so.1 = /usr/lib64/libfontconfig.so.1 (0x002a9745b000) libXext.so.6 = /usr/X11R6/lib64/libXext.so.6 (0x002a9758e000) libX11.so.6 = /usr/X11R6/lib64/libX11.so.6 (0x002a976a) libdl.so.2 = /lib64/libdl.so.2 (0x002a97899000) libz.so.1 = /usr/lib64/libz.so.1 (0x002a9799c000) libm.so.6 = /lib64/tls/libm.so.6 (0x002a97ab) libglib-2.0.so.0 = /usr/lib64/libglib-2.0.so.0 (0x002a97c36000) libstdc++.so.6 = /usr/lib64/libstdc++.so.6 (0x002a97dbf000) libgcc_s.so.1 = /lib64/libgcc_s.so.1 (0x002a97fb) libc.so.6 = /lib64/tls/libc.so.6 (0x002a980bb000) /lib64/ld-linux-x86-64.so.2 (0x00552000) libexpat.so.0 = /usr/lib64/libexpat.so.0 (0x002a982f)Simon.2006/11/7, Rex Dieter [EMAIL PROTECTED]: simon stockes wrote: Hi All, I got this error when I tried to compile sip-4.5, pyqt4.1, with the last version of Qt-4.2.1 GNU version. The effect is to not construct the QtXml directory in pyqt4.1source directory. This one was constructed without problem in the previous pyqt version ( 4.0.1) on osx 10.4.8 and RHel4. For this pyqt4.1, it works on OSX 10.4.8 but not on a pure Linux RHel4 up2date. Any, idea ? Does your qt4 build indeed include libQtXml? -- Rex ___ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] Gui Python framework comparison
Hi,What are the bad and good points of PyQt compare to PyGtk, wxPython ?Simon ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] Re: Re: pylupdate4 and pyrcc4 will not be built because the Qt XML module is missing.
Thanks for the information but I have to compile it. Firewall, here are blocking yum, apt, etc ...Simon.I'm not root on this machine2006/11/9, Rex Dieter [EMAIL PROTECTED]:simon stockes wrote: Yes, the xml qt4 lib is present:-( OK.dunno then.FYI, you may be interested in the qt4 rpms we provide fromhttp://kde-redhat.sourceforge.net/for rhel4.We've also got PyQt4.i386 rpms (but am currently having issues getting it to build properly on x86_64).-- Rex___PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] pylupdate4 and pyrcc4 will not be built because the Qt XML module is missing.
On Tue Nov 7 18:50:04 MET 2006, simon stockes wrote: I got this error when I tried to compile sip-4.5, pyqt4.1, with the last version of Qt-4.2.1 GNU version. The effect is to not construct the QtXml directory in pyqt4.1sourcedirectory. This one was constructed without problem in the previous pyqt version (4.0.1) on osx 10.4.8 and RHel4. Can you run the configure script again with the -w option then post the output? It may help us to determine what exactly is going wrong. David ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] sender info in Python slot
Hello, hopefully the subject line isn't too misleading. This is my problem: I would like to connect the clicked signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list. How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way? Using PyQt 4 with Python 2.4. Thank you, Koczian -- Dr. Sibylle Koczian Fasanenstrasse 12 D-82293 Mittelstetten ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] pylupdate4 and pyrcc4 will not be built because the Qt XML module is missing.
Hi,this what I got. It seems that /usr/X11R6/lib64/ is not take in account ?! And it is a 64bits machine. I readed somethong recently on the list , No ?:Thank, Simon.[EMAIL PROTECTED] PyQt-x11-gpl-4.1 ]# python configure.py -q /software/local/discovery/de/bin/qmake -wDetermining the layout of your Qt installation.../software/local/discovery/de/bin/qmake -o qtdirs.mk qtdirs.promake -f qtdirs.mkg++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I../mkspecs/linux-g++-64 -I. -I../include/QtCore -I../include/QtCore -I../include -I. -I. -o qtdirs.o qtdirs.cppg++ -m64 -Wl,-rpath,/software/local/discovery/de/lib -o qtdirs qtdirs.o -L/software/local/discovery/de/lib -lQtCore -L/home/master/fr15903/src/qt/qt-x11-opensource-src-4.2.1/lib -lz -lm -L/software/local/desktop/kde/3.5.2/x86_64/lib64 - lglib-2.0 -ldl -lpthread./qtdirsThis is the GPL version of PyQt 4.1 (licensed under the GNU General PublicLicense) for Python 2.4.4 on linux2.Type 'L' to view the license.Type 'yes' to accept the terms of the license. Type 'no' to decline the terms of the license.Do you accept the terms of the license? yesChecking to see if the QtGui module should be built...g++ -DQT_NO_DEBUG -DQT_GUI_LIB -I. -I/software/local/discovery/de/mkspecs/default -I/software/local/discovery/de/include/QtGui -I/software/local/discovery/de/include -I/usr/X11R6/include -pipe -O2 -w -D_REENTRANT cfgtest_QtGui.cpp -o cfgtest_QtGui -L/software/local/discovery/de/lib -L/usr/X11R6/lib -Wl,-rpath,/software/local/discovery/de/lib -lQtGui -L/home/master/fr15903/src/qt/qt- x11-opensource-src-4.2.1/lib -L/usr/X11R6/lib64 -lpng -lSM -lICE -lQtCore -lpthread -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lm -ldl -lXext -lX11 -lm -lpthread/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libSM.so when searching for -lSM /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libSM.a when searching for -lSM/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libICE.so when searching for -lICE/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libICE.a when searching for -lICE /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXi.so when searching for -lXi/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXi.a when searching for -lXi/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXrender.so when searching for -lXrender /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXrender.a when searching for -lXrender/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXrandr.so when searching for -lXrandr/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXrandr.a when searching for -lXrandr /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXfixes.so when searching for -lXfixes/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXfixes.a when searching for -lXfixes/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXcursor.so when searching for -lXcursor /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXcursor.a when searching for -lXcursor/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXinerama.so when searching for -lXinerama/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXinerama.a when searching for -lXinerama /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.so when searching for -lXext/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.a when searching for -lXext/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.so when searching for -lX11 /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.a when searching for -lX11/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.so when searching for -lXext/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.a when searching for -lXext /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.so when searching for -lX11/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.a when searching for -lX11Checking to see if the QtNetwork module should be built... g++ -DQT_NO_DEBUG -DQT_NETWORK_LIB -I. -I/software/local/discovery/de/mkspecs/default -I/software/local/discovery/de/include/QtNetwork -I/software/local/discovery/de/include -I/usr/X11R6/include -pipe -O2 -w -D_REENTRANT cfgtest_QtNetwork.cpp -o cfgtest_QtNetwork -L/software/local/discovery/de/lib -L/usr/X11R6/lib -Wl,-rpath,/software/local/discovery/de/lib -lQtNetwork -L/home/master/fr15903/src/qt/qt- x11-opensource-src-4.2.1/lib -lQtCore -L/home/master/fr15903/src/qt/qt-x11-opensource-src-4.2.1/lib -lz -lm -L/software/local/desktop/kde/3.5.2/x86_64/lib64 -lglib-2.0 -lpthread -ldl -lXext -lX11 -lm -lpthread/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.so when searching for -lXext /usr/bin/ld: skipping incompatible /usr/X11R6/lib/libXext.a when searching for -lXext/usr/bin/ld: cannot find -lXextcollect2: ld returned 1 exit statusChecking to see if the QtOpenGL module should be built... g++ -DQT_NO_DEBUG -DQT_OPENGL_LIB -I. -I/software/local/discovery/de/mkspecs/default -I/software/local/discovery/de/include/QtOpenGL
Re: [PyKDE] sender info in Python slot
You can get the emitting button with the sender() function from the QObject class Sibylle Koczian a écrit : Hello, hopefully the subject line isn't too misleading. This is my problem: I would like to connect the clicked signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list. How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way? Using PyQt 4 with Python 2.4. Thank you, Koczian -- Mathieu Leclaire Ingénieur recherche INRA Unité Eco-Innov BP01 78850 Thiverval Grignon Tel : 01-30-81-52-08 ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] sender info in Python slot
On 09.11.06 16:43:00, Sibylle Koczian wrote: hopefully the subject line isn't too misleading. This is my problem: I would like to connect the clicked signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list. How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way? The unclean solution would be to use the sender() function, the proper one is to have a look at QSignalMapper. Andreas -- Your best consolation is the hope that the things you failed to get weren't really worth having. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] PyQt4 and win98
Le lundi 06 novembre 2006 10:42, Michael Towers a écrit : Hi, I may be doing something stupid (such as trying it on win98!) but it seems not to work - Qt4.2.1 demos work fine, PyQt4.1 installation went ok, but 'from PyQt4 import QtCore' gives 'DLL load failed'. I'm experiencing the same problem on windows XP. PyQt 4.0.1 just worked fine, but after uninstalling it and installing PyQt 4.1, PyQt cannot find mingw32m.dll. This is a PATH problem I guess, but, I don't understand why it worked with PyQt 4.0.1 and is no longer working with 4.1 Thanks, Panard -- HomePage: http://dev.inzenet.org/~panard/ Yzis : http://www.yzis.org Qomics : http://dev.inzenet.org/~panard/qomics Smileys : http://smileys.inzenet.org ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] idle time detection
Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. Thanks for your input, -- sebas http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Political language [...] is designed to make lies sound truthful and murder respectable, and to give an appearance of solidity to pure wind. - George Orwell, 1984 pgpecQXMRYhjo.pgp Description: PGP signature ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] Re: Gui Python framework comparison
simon stockes wrote: Hi, What are the bad and good points of PyQt compare to PyGtk, wxPython ? PyQt and PyKDE have the native lookfeel on all platforms whereas PyGtk and wxPython use the weird GTK widgets on Linux. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On 09.11.06 20:48:40, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. I meant to say for capturing mouse/keyboard activity. Maybe have a look at the kde screensaver code, it may give you an idea... Andreas -- Your boss climbed the corporate ladder, wrong by wrong. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. Andreas -- Communicate! It can't make things any worse. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On Thursday 09 November 2006 20:48, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. Yeah, that's what I read in the KScreensaver code, having zero knowledge of C (and C++) makes that kinds hard, though. So I was asking myself if someone over here already came up with a solution that I can reuse. -- sebas http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - You can't go around building a better world for people. Only people can build a better world for people. Otherwise it's just a cage. - Terry Pratchett pgpVGwcFkTjW9.pgp Description: PGP signature ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On Thursday 09 November 2006 11:48, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. You need to use the XScreenSaver extension. Attached is a c++ class used by older psi that i use in one of my projects. I'm not sure but you can probably achieve the same thing with pure python. /* * idle.h - detect desktop idle time * Copyright (C) 2003 Justin Karneges * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef IDLE_H #define IDLE_H #includeqobject.h class IdlePlatform; class Idle : public QObject { Q_OBJECT public: Idle(QObject * parent=0); ~Idle(); bool isActive() const; bool usingPlatform() const; void start(); void stop(); signals: void secondsIdle(int); private slots: void doCheck(); private: class Private; Private *d; }; class IdlePlatform { public: IdlePlatform(); ~IdlePlatform(); bool init(); int secondsIdle(); private: class Private; Private *d; }; #endif /* * idle_x11.cpp - detect desktop idle time * Copyright (C) 2003 Justin Karneges * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #includeqapplication.h #include QDesktopWidget #include QX11Info #includeidle.h #ifdef NO_XSS IdlePlatform::IdlePlatform() {} IdlePlatform::~IdlePlatform() {} bool IdlePlatform::init() { return false; } int IdlePlatform::secondsIdle() { return 0; } #else #includeX11/Xlib.h #includeX11/Xutil.h #includeX11/extensions/scrnsaver.h static XErrorHandler old_handler = 0; extern C int xerrhandler(Display* dpy, XErrorEvent* err) { if(err-error_code == BadDrawable) return 0; return (*old_handler)(dpy, err); } class IdlePlatform::Private { public: Private() {} XScreenSaverInfo *ss_info; }; IdlePlatform::IdlePlatform() { d = new Private; d-ss_info = 0; } IdlePlatform::~IdlePlatform() { if(d-ss_info) XFree(d-ss_info); if(old_handler) { XSetErrorHandler(old_handler); old_handler = 0; } delete d; } bool IdlePlatform::init() { if(d-ss_info) return true; old_handler = XSetErrorHandler(xerrhandler); int event_base, error_base; if(XScreenSaverQueryExtension(QX11Info::display(), event_base, error_base)) { d-ss_info = XScreenSaverAllocInfo(); return true; } return false; } int IdlePlatform::secondsIdle() { if(!d-ss_info) return 0; if(!XScreenSaverQueryInfo(QX11Info::display(), QX11Info::appRootWindow(), d-ss_info)) return 0; return d-ss_info-idle / 1000; } #endif ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] Plans for PyKDE in KDE 4
Hello all, I've been talking to Jim Bublitz about plans for PyKDE in the up coming KDE 4. We, and I hope a lot of other people here, want PyKDE to be the best, most effective and most enjoyable way of developing KDE applications. The main change is that PyKDE will be developed in the KDE subversion repository, meaning that anyone is free to help develop, improve and test new versions of PyKDE. I've put together this message below explaining these plans in more detail. Once everyone here has a had a chance to give feedback or make corrections as needed, then I'll be sending this message on to the kde-core-devel list, the Technical Working Group and the broader KDE community in general. Feedback is appreciated. (Jim, you might want to read the Platform and Versioning sections again). cheers, Simon Edwards --- Background ~~ The Python bindings consist of a couple of parts. The binding tool SIP which is used to help generate the binding C++ code, PyQt, Python/Qt bindings which use SIP. Both are produced by Phil Thompson at Riverbank Computing[1] in the UK, and are available under the GPL or via a commercial closed source license which can be bought. This model is similar to Trolltech's of course. SIP/PyQt has been available and in commercial use since 1998 and support the same platforms as Qt itself. PyKDE is a set of bindings like PyQt which targets KDE's libraries. It is produced and maintained by Jim Bublitz. PyKDE has also been mature for over 5 years now. One of the stumbling blocks for people wanting to try out PyKDE has been the non-trivial amount of parts of the PyQt/PyKDE stack that need to be compiled before one can begin programming KDE with Python. To help easy installation a copy of SIP, PyQt and PyKDE was put in the KDE's kde-bindings module for KDE 3.3 and setup to compile as one piece. Goals for KDE 4 ~~~ The primary goal is to make sure that each version of KDE ships with complete and updated set of Python bindings. To do this we will move PyKDE development into the kde-bindings module in KDE's subversion repository. Jim Bublitz has traditionally developed PyKDE as a one man team, releasing the software releases and beta versions to the internet from his own workstation. Opening up development will allow those who want to help, to be able to work on PyKDE directly. This will also reduce dependency on Jim Bublitz. Although he has done an excellent job developing and maintaining PyKDE over the years in his free time, he is still one person who has other more important commitments too. During KDE 3, extra support was developed for plugins in Python (David Boddie), and support for i18n, building and installation[2] (Simon Edwards). Open development in KDE's SVN will mean that these kinds of projects can be developed directly as a part of PyKDE; helping form a complete development environment. Shipping PyKDE as part of a KDE release helps remove confusion about which version of PyKDE should be used with which version of KDE. This also helps simplify development and testing, since it no longer be necessary to test a release of PyKDE against multiple versions of KDE. (Each release of PyKDE has traditionally supported multiple versions of KDE). Licensing ~ The core PyKDE 4 libraries will be LGPL licensed in conformance with KDE's licensing policy and the rest of KDE's libraries. Supporting programs such as code generators etc, may be GPL licensed. Platform Support All of the software components that PyKDE builds on, like Qt, Python, PyQt, etc support a large number of platforms. PyKDE has supported the same unix-like platforms that KDE has in the past. This makes it relatively straight forward to add support to PyKDE for the new platforms in KDE 4, such as WIN32. Binary Compatibility Versioning ~ Application programmers using Python rarely have to worry about binary compatibility. Python has had very good source level compatibility during the current 2.x series of releases. Since people and distributions don't move to newer versions of Python at the same time, it will be necessary that PyKDE support the most popular versions of Python. For example, right now that would be 2.3, 2.4 and 2.5. Thankfully SIP handles this for the most part automatically. There is one situation where the picture becomes more complex and that is for applications that use a mix of Python code and their own C++ classes. For example, an application that uses a C++ class for rendering a complex graph, but also uses PyKDE and Python for the rest of the GUI. The application developer is this case would use SIP to create their own bindings for their graph rendering C++ class. People compiling and packaging mixed language applications need to keep in mind that a compiled SIP binding for a C++ class depends on the version of
Re: [PyKDE] sender info in Python slot
On Thu, 9 Nov 2006, Andreas Pakulat wrote: On 09.11.06 16:43:00, Sibylle Koczian wrote: hopefully the subject line isn't too misleading. This is my problem: I would like to connect the clicked signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list. How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way? The unclean solution would be to use the sender() function, the proper one is to have a look at QSignalMapper. An alternative pythonic way to do this is to do something like: class BoundCaller(object): A callable class to wrap a function and its arguments. def __init__(self, fn, *params): self.fn = fn self.params = params def __call__(self, *params): self.fn( *(self.params+params) ) in your class: def __init__(self): self.myslot1 = BoundCaller(myslot, 1) self.myslot2 = BoundCaller(myslot, 2) self.connect(self.mybutton, SIGNAL('clicked()'), self.myslot1) ... def myslot(self, boundarg): print boundarg You have to keep a separate reference to the BoundCaller object (hence the assignment to self), otherwise it gets garbage collected. Jeremy -- Jeremy Sanders [EMAIL PROTECTED] http://www.jeremysanders.net/Cambridge, UK Public Key Server PGP Key ID: E1AAE053 ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] sender info in Python slot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeremy Sanders schrieb: On Thu, 9 Nov 2006, Andreas Pakulat wrote: On 09.11.06 16:43:00, Sibylle Koczian wrote: hopefully the subject line isn't too misleading. This is my problem: I would like to connect the clicked signal of several buttons to one and the same function - but this function should know which button sent the signal. Example: one button to increase a value, another to decrease it, and one single function which adds '+1' or '-1' depending on the sending button. Or a row of buttons with a letter, and clicking one searches for all words beginning with this letter in a list. How can I do this? Subclassing QPushButton seems to be a possibility, but is there a simpler way? The unclean solution would be to use the sender() function, the proper one is to have a look at QSignalMapper. An alternative pythonic way to do this is to do something like: class BoundCaller(object): A callable class to wrap a function and its arguments. def __init__(self, fn, *params): self.fn = fn self.params = params def __call__(self, *params): self.fn( *(self.params+params) ) in your class: def __init__(self): self.myslot1 = BoundCaller(myslot, 1) self.myslot2 = BoundCaller(myslot, 2) self.connect(self.mybutton, SIGNAL('clicked()'), self.myslot1) ... def myslot(self, boundarg): print boundarg You have to keep a separate reference to the BoundCaller object (hence the assignment to self), otherwise it gets garbage collected. Hi, I still think that connect not taking a reference on the slot is a mistake, otherwise you could just use a lambda here. Anyhow, Torsten - -- Torsten Marek [EMAIL PROTECTED] ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858 Keyserver: subkeys.pgp.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFU5V/fMVFHqJEyFgRAgm/AJ9XDJFgK58BdarOPO/zgtGkBtWPcACfSAm5 m1HnJJC0t9hvSTzVgbBLnyo= =b6n3 -END PGP SIGNATURE- ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matt Newell schrieb: On Thursday 09 November 2006 11:48, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. You need to use the XScreenSaver extension. Attached is a c++ class used by older psi that i use in one of my projects. I'm not sure but you can probably achieve the same thing with pure python. Hi, just a heads up, you might want to look at ctypes if you do stuff like that, no need to write a C extension yourself. Remember, ctypes is stdlib in 2.5. best, Torsten - -- Torsten Marek [EMAIL PROTECTED] ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858 Keyserver: subkeys.pgp.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFU5SrfMVFHqJEyFgRAnqPAKCefh718zKM7xpi5tnqvUtnFXoYzgCggDUd XpCxtfxXZPxMWSm6eiLUSlg= =aTtz -END PGP SIGNATURE- ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On Thursday 09 November 2006 10:51, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. Thanks for your input, I'd try subclassing KApplication and overloading the event loop stuff (not quite sure where). Set a QTimer to fire and dim the display or whatever in N seconds and then in the event loop, detect any mouse or keyboard events to reset the QTimer if one is found. Typical watchdog timer application. Seems like that should work, except for dialogs which run their own event loops (you'd probably want to disable the timer during any dialog execution). There's probably a way to do it with event handlers on objects which have the focus too, if there aren't too many possibilities of those, or your app is structured to allow for that. Jim . ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] Re: Gui Python framework comparison
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Christophe Cavalaria schrieb: simon stockes wrote: Hi, What are the bad and good points of PyQt compare to PyGtk, wxPython ? PyQt and PyKDE have the native lookfeel on all platforms whereas PyGtk and wxPython use the weird GTK widgets on Linux. Hi, you seem to have a very secret stash of knowledge which you share with nobody else. best, Torsten - -- Torsten Marek [EMAIL PROTECTED] ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858 Keyserver: subkeys.pgp.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFU5ewfMVFHqJEyFgRAqAvAJ9g19b+GfZHNtd1YQrHvMwHLlUVOQCglMMr S7BsZILwuKsj/gklDAA6DKs= =eha4 -END PGP SIGNATURE- ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
On 09.11.06 21:50:51, Torsten Marek wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matt Newell schrieb: On Thursday 09 November 2006 11:48, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. You need to use the XScreenSaver extension. Attached is a c++ class used by older psi that i use in one of my projects. I'm not sure but you can probably achieve the same thing with pure python. just a heads up, you might want to look at ctypes if you do stuff like that, no need to write a C extension yourself. Remember, ctypes is stdlib in 2.5. Well, I can see a X11 interface module here on my Debian machine: python-xlib, so I guess the same is true for kubuntu. Which means Sebastian could rewrite this small class in plain Python. Andreas -- You'll never see all the places, or read all the books, but fortunately, they're not all recommended. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] idle time detection
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Pakulat schrieb: On 09.11.06 21:50:51, Torsten Marek wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matt Newell schrieb: On Thursday 09 November 2006 11:48, Andreas Pakulat wrote: On 09.11.06 19:51:11, Sebastian Kügler wrote: Can anyone think of some clean way for a PyKDE application to detect idle time? For the Kubuntu powermanager applet, we're currently missing that feature. The usecase would be kicking in a suspend / hibernate / dimming display after N seconds of no mouse or keyboard activity. You have to hook into X11 then, I think. You need to use the XScreenSaver extension. Attached is a c++ class used by older psi that i use in one of my projects. I'm not sure but you can probably achieve the same thing with pure python. just a heads up, you might want to look at ctypes if you do stuff like that, no need to write a C extension yourself. Remember, ctypes is stdlib in 2.5. Well, I can see a X11 interface module here on my Debian machine: python-xlib, so I guess the same is true for kubuntu. Which means Sebastian could rewrite this small class in plain Python. Hi, yes, I'm aware of python-xlib. Apart from that, ctypes is as plain as calling C functions directly from Python gets, and (which was my main point) is in the stdlib. best, Torsten - -- Torsten Marek [EMAIL PROTECTED] ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858 Keyserver: subkeys.pgp.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFU5unfMVFHqJEyFgRAny0AKCYNXfCUlZR0aZowOoBFl00JBPEBQCeMAlV r3I3sMpWUCzPZYY7YcwwBVw= =Yh+3 -END PGP SIGNATURE- ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] signal with return value
Hi, I am not sure whether we can use signal for return value or not. Let me give you my example: I have 3 different classes: Main.py, Header.py, and Operator.py In Main.py: self.connect(self.headerDialog, QtCore.SIGNAL(makeHeader), self.operator.makeNewHeader) in Header.py userProfileDic = {'charset':CHARSET, 'encoding':ENCODING, 'project_id_version':None, 'pot_creation_date':None, 'po_revision_date':None, 'last_translator':str(Last_Translator), 'language_team':str(Language_Team), 'mime_version':None, 'plural_forms':None, 'report_msgid_bugs_to':None} userProfileDic = self.emit(QtCore.SIGNAL(makeHeader), userProfileDic) in Operator.py def makeNewHeader(self, headerDic): header = self.store.makeheader(**headerDic) return po.poheader.parse(str(header)) The goal here is I emit makeHeader signal in Header.py and through in userProfileDic to makeNewHeader(self, headerDic) slot in Operator.py. As a result, I want to get the str(header) back for other use. in Header.py Unfortunately, the result I got is None. Can anybody give me a hint on how do this? Lots of thanks, da -- Ms. Hok Kakada Open Source Engineer KhmerOS project H/P:012 653 155 ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] cellEntered sigal problem
Hello again, I am working with tableWidget,and I got stuck with cellEntered signal. It seems not emit when I entered to the last row, though I enabled mouseTracking feature. Bellow is how my code does: row = self.ui.tableHeader.rowCount() QtCore.QObject.connect(self.ui.tableHeader,QtCore.SIGNAL(cellEntered(row,0)), self.appendRow) def appendRow(self): Append one row to the last lastRow = self.ui.tableHeader.rowCount() +1 self.ui.tableHeader.insertRow(lastRow) Any idea of that? Thanks, da -- Ms. Hok Kakada Open Source Engineer KhmerOS project H/P:012 653 155 ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde