[PyQt] Continued: Taskbar daemon, DBus
lokev wrote: I was wondering if I could get some pointers, or directions to good tutorials or examples for the following: I want to make a daemon that runs with an icon in the system tray/notification area, how to i do this? basweber wrote: http://paste.pocoo.org/show/42329/ or look at real life examples via google code search (I love this google feature) http://www.google.com/codesearch?hl=enlr=q=lang%3Apython+QSystemTrayIconsbtn=Search Regards, Bastian So, to further expand on this .. I want the daemon to be cross platform, Mac/Win/Linux. DBus seemed like a good way to go for communication with the daemon, but: The DBus support module is installed as dbus.mainloop.qt. PyQt does not support Qt's native DBus classes. Instead the module enables the Qt event loop to be used with the standard DBus Python bindings. It is only available for PyQt for X11. Which explains why I could get this example: http://paste.pocoo.org/show/42329/ to run fine on my Ubuntu box, but not on Leopard .. :) So does this mean that if I want to use DBus cross platform, I'll have to develop it in Qt4/C++ ? Or can I develop just parts of it in Qt4/C++ and the rest in PyQt? Or can I use plain python to handle the dbus communication, and PyQt for the rest? Also, I would like for the user to be able to communicate with the Daemon from another host. From my understanding, it is possible to pipe DBus communication through sockets, but since I'm going that route anyway, and use of DBus seems to be limited to X11apps in PyQt, would it be best to just develop it to do all communication through sockets, also local, and not use DBus at all .. (though I would like to avoid this .. ) Can anyone with a bit more experience with both PyQt and software development in general give me some advice on what route to take? Regards, Ole Johan -- View this message in context: http://old.nabble.com/Taskbar-daemon-tp26618709p26739996.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Install script for Python applications
Hello, I've developed a application using Python and PyQt4. What is the best way to make a install.py / setup.py / Makefile for installing this application? It should check if all depencies are found (this should be really simple: try: import xxx except ImportError: print ; sys.exit(2) ) It should compile and copy all *.py/pyc files to python -c from distutils.sysconfig import get_python_lib; print get_python_lib() There are also some files that should be in /usr/share/appname A small wrapper script, that is written to /usr/local/bin would also be nice. Is this possible with distutils? I looked in the source code of eric4 and found a setup.py script, which seems to do everything manually. Is there a template for this? What do you use for distributing your applications for Linux? Thanks for your suggestions, Lukas ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] More QPlainTextEdit weirdness! (was: Missing scrollbar signal...)
On Friday 11 December 2009 07:28:27 Henning Schröder wrote: I have looked at the source of QPlainTextEdit and QTextEdit. Actually the implementations are not consistent. QPlainTextEdit calls verticalBar.blockSignals(True) before it call setValue which would otherwise emit valueChanged. Hi guys, hi Henning, This is what's awesome about this mailing-list: you bring up the most obscure issue, and there's someone with a helpful and interesting answer for you. Brilliant! In my case I worked around the problem by sending the signal manually after calling triggerAction(). Not very clean, but that's workarounds for you. But in the meanwhile more QPlainTextEdit weirdness crept up. As part of a helpful little feature that shows you the bottom of your text in a split screen while you scroll back, I use the awesome QTextDocument.drawContents() method. In short, you feed it a QPainter and a QRectF and it does what it says on the label: a slice of your document as delineated by the QRectF is rendered onto the QPainter. There is, as far as I can tell, no difference between the QTextDocument returned by QTextEdit.document() and QPlainTextEdit.document(). Same class in both cases. And yet in the latter case, drawContents() renders nothing at all. Cursory investigation points to a different QAbstractTextDocumentLayout implementation under the hood depending on the TextEdit flavor in use. So I think I'm going to drop QPlainTextEdit entirely, even though in theory it's better suited to my problem domain. After a few tests, the benefits in speed and memory usage are not obvious anyway. (Which is possibly a testament to QTextEdit's efficiency, when you think of it.) But alternative viewpoints would be welcome! Bye, -- S. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Install script for Python applications
On Fri, Dec 11, 2009 at 6:11 AM, Lukas Hetzenecker l...@gmx.at wrote: Hello, I've developed a application using Python and PyQt4. What is the best way to make a install.py / setup.py / Makefile for installing this application? It should check if all depencies are found (this should be really simple: try: import xxx except ImportError: print ; sys.exit(2) ) It should compile and copy all *.py/pyc files to python -c from distutils.sysconfig import get_python_lib; print get_python_lib() There are also some files that should be in /usr/share/appname A small wrapper script, that is written to /usr/local/bin would also be nice. Is this possible with distutils? I'd advise using distutils. It supports everything you describe, with the exception of dependency checking, which you would have to code yourself. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] More QPlainTextEdit weirdness! (was: Missing scrollbar signal...)
On Fri, Dec 11, 2009 at 1:31 PM, Sundance sunda...@ierne.eu.org wrote: [..] As part of a helpful little feature that shows you the bottom of your text in a split screen while you scroll back, I use the awesome QTextDocument.drawContents() method. In short, you feed it a QPainter and a QRectF and it does what it says on the label: a slice of your document as delineated by the QRectF is rendered onto the QPainter. [..] And yet in the latter case, drawContents() renders nothing at all. Cursory investigation points to a different QAbstractTextDocumentLayout implementation under the hood depending on the TextEdit flavor in use. Have you tried plaintext_edit.document().documentLayout().draw(paint, context) ? Or you could try text_layout = QTextLayout() doc = plaintext_edit.document().clone() doc.setDocumentLayout(my) doc.drawContents(painter, rect) Henning ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Spacing between tabs in QTabWidget etc...
Hi all, I have two questions regarding QTabWidget.. 1)Is it possible for us to leave space between the tab headers(between tab1 and tab2 in the header in this picture)... http://i48.tinypic.com/r2uhxf.jpg http://i48.tinypic.com/r2uhxf.jpg%20 If yes could you tell me how it can be done?? 2)Can we change the background color of only the headers(tab1 and tab2) but not completely?? or shall we place a readymade image instead of the tab header?? Your suggestions are much awaited... Jeba ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Spacing between tabs in QTabWidget etc...
You should be able to use stylesheets to modify the tab margins. See the docs for details: http://doc.trolltech.com/4.5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar example: QTabBar::tab { margin-left: 5; margin-right: 5; } The docs also provide examples on how to change the background color. -Selim Jebagnana Das wrote: Hi all, I have two questions regarding QTabWidget.. 1)Is it possible for us to leave space between the tab headers(between tab1 and tab2 in the header in this picture)... http://i48.tinypic.com/r2uhxf.jpg http://i48.tinypic.com/r2uhxf.jpg%20 If yes could you tell me how it can be done?? 2)Can we change the background color of only the headers(tab1 and tab2) but not completely?? or shall we place a readymade image instead of the tab header?? Your suggestions are much awaited... Jeba ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt attachment: Selim_Tuvi.vcf___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] a small bug in SIP, when using it for C libraries (sorry for previous post, its message was scrubbed)
On Thu, 10 Dec 2009 06:08:07 +0530, Ravi kumar ravi.kumar@gmail.com wrote: Hello, I was trying out the tutorial of SIP from http://www.riverbankcomputing.co.uk/static/Docs/sip4/using.html. When i tried the C++ example there, it worked fine. But when i tried the C example it gave errors. I searched for the error, in generated file sipwordWord.c, in array_Word function, this was generated return sipMalloc(sizeof * (struct Word) * sipNrElem); i modified it to this (which i hope is correct, according to what is desired from the function) : return sipMalloc(sizeof (struct Word) * sipNrElem); and then it worked fine. After this i modified the sip source code, and created a diff patchfile: diff -rup original/sipgen/gencode.c modified/sipgen/gencode.c --- original/sipgen/gencode.c 2009-12-05 09:03:25.0 +0530 +++ modified/sipgen/gencode.c 2009-12-10 05:42:51.0 +0530 @@ -5820,7 +5820,7 @@ static void generateClassFunctions(sipSp if (generating_c) prcode(fp, - return sipMalloc(sizeof * (%S) * sipNrElem);\n + return sipMalloc(sizeof (%S) * sipNrElem);\n , classFQCName(cd)); else prcode(fp, My system specifications are : os : Ubuntu 9.10 gcc : 4.4.1 python : 3.1 sip : sip-4.10-snapshot-20091204 (my patch is made against this very version) and finally, thanks for such a great tool :) Fixed in tonight's snapshot - thanks. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Getting a SystemError: error return without exception set when I try to do QGraphicsScene.addItem(QGraphicsItem)
I have a widget that creates two objects, DisplayScene and DisplayView. DisplayScene inherits from the QGraphicsScene class, and DisplayView inherits from the QGraphicsView class. I also have MyItem that inherits from the QGraphicsItem class. When I run this program and the DisplayScene.Read method is called I create a MyItem object and I try to add it to the DisplayScene. When I do this I get this error: SystemError: error return without exception set Here is my code: class MainWidget(QWidget): def __init__(self): QWidget.__init__(self) self.display = DisplayScene(self) self.view = DisplayView(self.display) self.view.show() self.display.Read() class MyItem(QTreeWidgetItem, QGraphicsItem): def __init__(self, parent=None): QTreeWidgetItem.__init__(self, parent) QGraphicsItem.__init__(self) class DisplayScene(QGraphicsScene): def __init__(self, parent): QGraphicsScene.__init__(self, parent) def Read(self): test =MyItem() self.addItem(test) -- View this message in context: http://old.nabble.com/Getting-a-SystemError%3A-error-return-without-exception-set-when-I-try-to-do-QGraphicsScene.addItem%28QGraphicsItem%29-tp26749026p26749026.html Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Laucnh a JavaScript after and not before the loading of a page in QWebView
Hello, in the following code the JavaScript is launched before the loading of the HTML page. Is there a way to call a JavaScript only when the whole page is loaded in the QWebView ? Best regards. Christophe. == # -*- coding: utf-8 -*- #!/usr/bin/env python # Source # http://www.slideshare.net/tewson/using-qtwebkit-in-pyqt-as-a-n00b import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * app = QApplication(sys.argv) myWebKit = QWebView() myWebKit.show() myWebKit.setUrl(QUrl(http://www.google.fr/;)) myWebKit.page().mainFrame().evaluateJavaScript(alert('Hello, World !');) sys.exit(app.exec_()) # -*- coding: utf-8 -*- #!/usr/bin/env python # Source #http://www.slideshare.net/tewson/using-qtwebkit-in-pyqt-as-a-n00b import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * app = QApplication(sys.argv) myWebKit = QWebView() myWebKit.show() myWebKit.setUrl(QUrl(http://www.google.fr/;)) myWebKit.page().mainFrame().evaluateJavaScript(alert('Hello, World !');) sys.exit(app.exec_())___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Wrong Qt include paths when building PyQt
Hi, I'm having a problem building PyQt 4.6.2 against local builds of Qt4.6.0 and SIP 4.9.3. Basically the includes paths in the calls to g++ point to the wrong place. I have my build of Qt in /home/me/qt4. I try to build PyQt, pointing it to my Qt's qmake: python configure.py -q /home/me/qt4/bin/qmake make It eventually fails due to not being able to find headers: In file included from sipQtCorecmodule.cpp:34: sipAPIQtCore.h:40:21: error: QMetaType: No such file or directory In file included from sip/QtCore/qobject.sip:560, from sipQtCorecmodule.cpp:34: /home/me/PyQt-x11-gpl-4.6.2/qpy/QtCore/qpycore_api.h:36:28: error: QCoreApplication: No such file or directory /home/me/PyQt-x11-gpl-4.6.2/qpy/QtCore/qpycore_api.h:37:19: error: QString: No such file or directory /home/me/PyQt-x11-gpl-4.6.2/qpy/QtCore/qpycore_api.h:38:20: error: QVariant: No such file or directory I noticed this in the build output: Qt v4.6.0 free edition is being used. SIP 4.9.3 is being used. The Qt header files are in /usr/include/qt4. The shared Qt libraries are in /usr/lib. The Qt binaries are in /usr/bin. The Qt mkspecs directory is in /usr/share/qt4. and ended up with these include paths in the calls to g++: -I/usr/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4 All the references to /usr/* are incorrect. They should refer to /home/me/qt4/... Anyone know what I'm missing? Is there a straightforward way to get the include paths to be correct? I've been stuck on this all day. :( Figured I'd check here before doing some heinous hacks. Thanks! Josh ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Drag Drop with QTreeWidget
NARCISO, Rui wrote: Hi again Your approach worked nicely but when I tried to enable sorting using: self.setSortingEnabled(True) self.sortByColumn(0, QtCore.Qt.AscendingOrder) I get a segmentation fault. If i disable the sortByColumn then it works. How then to set the sorting using column 0 by default ? actually, i now think my approach was too crude. the trouble with using rowsInserted is that it is called every time items are added or moved (or sorted). what is really needed is a way to add special handling only for dropped items. unfortunately, there does not appear to be an obvious way to detect what items were dropped and where. so i think the only reliable way to get the behaviour you want is to reimplement qtreewidget's drop event handling (which is probably doable, but not easy). ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Getting a SystemError: error return without exception set when I try to do QGraphicsScene.addItem(QGraphicsItem)
On Fri, 11 Dec 2009 10:15:19 -0800 (PST), dizou di_...@yahoo.com wrote: I have a widget that creates two objects, DisplayScene and DisplayView. DisplayScene inherits from the QGraphicsScene class, and DisplayView inherits from the QGraphicsView class. I also have MyItem that inherits from the QGraphicsItem class. When I run this program and the DisplayScene.Read method is called I create a MyItem object and I try to add it to the DisplayScene. When I do this I get this error: SystemError: error return without exception set Here is my code: class MainWidget(QWidget): def __init__(self): QWidget.__init__(self) self.display = DisplayScene(self) self.view = DisplayView(self.display) self.view.show() self.display.Read() class MyItem(QTreeWidgetItem, QGraphicsItem): def __init__(self, parent=None): QTreeWidgetItem.__init__(self, parent) QGraphicsItem.__init__(self) You can't multiply inherit from two wrapped classes. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Laucnh a JavaScript after and not before the loading of a page in QWebView
On Fri, 11 Dec 2009 19:43:08 +0100 (CET), projet...@club-internet.fr wrote: Hello, in the following code the JavaScript is launched before the loading of the HTML page. Is there a way to call a JavaScript only when the whole page is loaded in the QWebView ? The QWebView.loadFinished() signal? Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Unable to find file QtCore/QtCoremod.sip...
I'm on Windows using Python 2.5, PyQt-win-gpl-4.6.1, sip-4.9.1 and Qt 4.5.2. I have a working graphics primative library that I wrap with SIP. I'd like to add Qt classes to my library, e.g. QString. I've added: %Import QtCore/QtCoremod.sip to my sip file, but I get the error: sip: Unable to find file QtCore/QtCoremod.sip (I get the same error when I try %import PyQt4/QtCore/QtCoremod.sip) I see QtCoremod.sip at: c:\Python25\sip\PyQt4\QtCore\QtCoremod.sip Any help? Thanks - jamie ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt