[PyQt] empty container in QSettings: TypeError
Hi all, When I store a list of strings (but happening to be empty) in QSettings (using QString and QVariant api 2): e.g.: paths = [] QSettings().setValue('paths', paths) Retrieving it yields a TypeError, instead of an empty list: QSettings().value('paths', [], 'QString') Traceback (most recent call last): File stdin, line 1, in module TypeError: unable to convert a QVariant of type 0 to a QMetaType of type 10 What is the most elegant way to circumvent this? cathing the TypeError and returning the empty list? Best regards, Wilbert -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QTextBlockUserData forgotten in SIP 4.14.3, bug?
Op Mon, 11 Mar 2013 14:01:21 + Phil Thompson p...@riverbankcomputing.com schreef: On Mon, 11 Mar 2013 11:13:15 +0100, Wilbert Berendsen wbs...@xs4all.nl wrote: Hi, It seems sip 4.14.3 forgets QTextUserData objects. (...) Note that it isn't forgotten that there is a QTextUserData set, but it is returned as a different object, without the 'value' attribute that was previously set. Is this a bug? It's a PyQt bug - fixed in tonight's snapshot. I tried to work around the bug, but that seems not to be possible. Even when deriving from QTextBlockUserData, the python wrapper is lost when requesting the same object later. Sometime it lives for a few seconds but eventually it dies, forgetting the Python attributes that were set. I see, besides Frescobaldi[1], also Ninja[2] suffering from this problem. [1] https://github.com/wbsoft/frescobaldi [2] https://github.com/ninja-ide/ninja-ide In the case of Frescobaldi, the bug is quite severe: Frescobaldi tokenizes all entered text, caching the tokens (created by a QSyntaxHighlighter) in the QTextBlockUserData for every line of text. Due to this bug the parser runs every time on the whole document, as the parsing state is also lost, causing slowdowns of minutes... The QTextBlockUserData is the only place where custom information can be attached to text lines. I don't know of any other way to store information relating to text blocks. Could the fix for this bug also be forwarded to Linux packagers soon, as many new Linux distros now package recent PyQt4 versions? If I can help, I'd be grateful. best wishes, Wilbert -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QTextBlockUserData forgotten in SIP 4.14.3, bug?
Op 11-03-13 15:01, Phil Thompson schreef: It's a PyQt bug - fixed in tonight's snapshot. Thanks. Users of my application (Frescobaldi) also have some problems that could relate to QTreeWidgetItems also losing their own instance attributes (even when using a subclass of QTreeWidgetItem). Could that be the same bug? (I could not yet debug that fully, because my production systems don't yet have PyQt4-4.9.6) Best regards, and thanks for keeping up such a great tool: PyQt4! Wilbert ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QTreeWidgetItem also forgets its Python counterpart
Hi, I am having a similar bug indeed in sip-4.14.3 / PyQt-4.9.6 where QTreeWidgetItem forgets its Python state when created with a QTreeWidget().invisibleRootItem() as parent. After importing * from PyQt4.QtCore and QtGui: app=QApplication([]) w=QTreeWidget() class Item(QTreeWidgetItem): ... pass ... i=Item(w.invisibleRootItem()) i.value=123 del i w.topLevelItem(0) PyQt4.QtGui.QTreeWidgetItem object at 0xb69ceadc w.topLevelItem(0).value Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'QTreeWidgetItem' object has no attribute 'value' But when I create Item with the treewidget itself as parent, it works: w.clear() i=Item(w) del i w.topLevelItem(0) __main__.Item object at 0xb69ce614 And when I create an Item with a toplevel Item as parent, it also works: j=Item(w.topLevelItem(0)) w.topLevelItem(0).child(0) __main__.Item object at 0xb69ceadc del j w.topLevelItem(0).child(0) __main__.Item object at 0xb69ceadc w.topLevelItem(0).child(0).value=123 w.topLevelItem(0).child(0).value 123 So the bug is only that when creating a QTreeWidgetItem (even if derived) with the QTreeWidget.invisibleRootItem() as parent, its Python counterpart is forgotten and a new wrapped object is created. Wilbert -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QPyNullVariant
Op Mon, 16 Jul 2012 12:11:11 +0100 Phil Thompson p...@riverbankcomputing.com schreef: On Fri, 13 Jul 2012 15:49:48 +0200, Rodolfo Zitellini xhero...@gmail.com wrote: The offending code is in setup.py, when it reads the language: language = QSettings().value(language, ) print language if not language: try: language = locale.getdefaultlocale()[0] except ValueError: pass if not language: language = C return language in linux, language prints None, on osx it prints QPyNullVariant. it will then evaluate False in if not language and then crash when it arrives in __init__.py. This used to work with qt 4.7 on osx. Just upgrading to 4.8 breaks everything. Any ideas? It would suggest that there is a null QVariant stored in the settings for language. If there was no value stored then would be returned. A workaround would therefore be to update or delete the settings data either manually or with a little script. Phil I'm the author of Frescobaldi. I was not expecting QPyNullVariant() to be returned when I specify a default value. Why is it that bool(the returned QPyNullVariant) defaults to True? What is the best way to check for a possible QPyNullVariant to be returned from the QSettings().value() method? (I.e. it should also work on PyQt-4.7 systems). My code uses QSettings().value almost everywhere. I was happy with the simple interface, although it would be nice if the returned value would be forced in the type of the default value if specified. When I must check for more possible types to be returned, I must create a wrapper function for it, I guess Wilbert -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Crash (assert fail) in 'sip_api_convert_from_new_type'
Hi, A SIP-generated binding (python-poppler-qt4) causes a crash with the following message on the console: python: /build/buildd/sip4-4.13.2/siplib/siplib.c:8164: sip_api_convert_from_new_type: Assertion `(((td)-td_flags 0x0007) == 0x)' failed. Aborted (core dumped) The StacktraceTop is: __assert_fail_base (fmt=optimized out, assertion=0x7f9a6665d058 (((td)-td_flags 0x0007) == 0x), file=0x7f9a6665ceb0 /build/buildd/sip4-4.13.2/siplib/siplib.c, line=optimized out, function=optimized out) at assert.c:94 __GI___assert_fail (assertion=0x7f9a6665d058 (((td)-td_flags 0x0007) == 0x), file=0x7f9a6665ceb0 /build/buildd/sip4-4.13.2/siplib/siplib.c, line=8164, function=0x7f9a6665c7f0 sip_api_convert_from_new_type) at assert.c:103 sip_api_convert_from_new_type (cpp=0x2cb8320, td=0x7f9a665f63b0, transferObj=0x0) at /build/buildd/sip4-4.13.2/siplib/siplib.c:8164 meth_Poppler_LinkBrowse_url (sipSelf=LinkBrowse at remote 0x285fb00, sipArgs=optimized out) at build/temp.linux-x86_64-2.7/sippopplerqt4PopplerLinkBrowse.cpp:91 PyEval_EvalFrameEx () Sip 4.13.2 is used, more stacktraces are available here: https://bugs.launchpad.net/ubuntu/+source/frescobaldi/+bug/939196 The binding code is here: http://code.google.com/p/python-poppler-qt4/source/browse/#svn%2Ftrunk%2Fpython-poppler-qt4 What could be the cause of the failed assertion? Is it a bug in the binding code of python-poppler-qt4, or in SIP itself? Thanks for any enlightment :) -- Wilbert Berendsen (http://www.wilbertberendsen.nl) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Text write on effect
Op Mon, 27 Feb 2012 17:02:01 -0800 (PST) JPolk jpolk5...@yahoo.com schreef: okay, this may seem a bit superfluous, but would be a very nice animation effect to have in one's toolbox.. For those that don't know what a write on animation is,...you probably see them on TV everyday,.. but it's when a whole sentence is displayed a character at time, with just a fraction of a second delay in-between each character... Thought this would be trivial at first,...but there's something going on in Qt that senses there's about to be a bunch of fast updates, so it waits until everything is done and updates *once*, which defeats the purpose Here's how the madness unfolds,.. text = Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet accum = QString() for i in range(0, len(text)): accum = accum + text[i] self.label.setText(accum) self.label.update() sleep(.1) So, I accumulate the string char by char calling update() and sleep() at each interval,...a button triggers this function. But instead of seeing the effect progress as expected, it just display the whole string at once... Anybody got any ideas how to achieve this effect ? the sleep function causes the main thread (GUI thread) to be blocked, so the widget is not repainted. It only repaints when the for-loop has terminated, and thus shows the full string at once. A solution would be to use a timer that regularly updates the label text (attached). -- Wilbert Berendsen (http://www.wilbertberendsen.nl) #!/usr/bin/env python import os import sys from PyQt4 import QtCore, QtGui, uic from PyQt4.QtCore import ( QString ) class BasicWindow(QtGui.QMainWindow): def __init__(self, parent=None): super(BasicWindow, self).__init__(parent) #self.setupUi(self) self.label = QtGui.QLabel(self) self.label.setGeometry(QtCore.QRect(73, 110, 574, 331)) self.pushButton = QtGui.QPushButton(self) self.pushButton.setGeometry(QtCore.QRect(66, 30, 75, 27)) self.pushButton.setText(DoIt) scrX = 2048 scrY = 1150 winX = 720 winY = 530 pX = (scrX - winX) / 2 pY = (scrY - winY) / 2 self.setGeometry(pX, pY, winX, winY) self.label.setText('') self.pushButton.clicked.connect(self.DoIt) self.timer = QtCore.QTimer(interval=50, timeout=self.timeout) def DoIt(self): self.textGen = self.generateText() self.timer.start() def generateText(self): text = Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna for i in range(len(text)): yield text[:i] def timeout(self): for accum in self.textGen: self.label.setText(accum) return self.timer.stop() def main(): app = QtGui.QApplication(sys.argv) form = BasicWindow() form.show() app.exec_() if __name__ == '__main__': main() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] stand alone QFileDialog
Op woensdag 11 mei 2011 schreef Janwillem: Is there for opening a file in a non-qui script a PqQt4 equivalent for the TkInter based function below? look for QFileDialog. http://doc.trolltech.com/4.7/qfiledialog.html and http://www.riverbankcomputing.com/static/Docs/PyQt4/html/python_v3.html#qfiledialog w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] event() gets called but C++ object already deleted
Hi, I have a PyQt4 subclass of a QToolButton that implements event() (to show custom tooltips as they need to appear): def event(self, ev): if ev.type() == QEvent.ToolTip: # handle it. return True return super(Button, self).event(ev) The problem is that on Windows, while the application is closing itself, event() gets called (with a QActionEvent) while the super() call results in a RuntimeError: underlying C/C++ object has been deleted. Changing the super() line into 'return QToolButton.event(self, ev)' does not help. Is it a correct workaround to simply wrap the return super... line in a try/except clause? Or is there a better way to prevent this? Can I prevent that event() is called while the c++ object is not living anyway? with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] SOLVED Re: event() gets called but C++ object already deleted
Op woensdag 25 mei 2011 schreef Wilbert: The problem is that on Windows, while the application is closing itself, event() gets called (with a QActionEvent) while the super() call results in I solved the crash by giving the action that was set as defaultAction() for the toolbutton a parent. Deletion is then handled by Qt and now event() is not called on the wrong moment during the object deletion. w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QApplication.saveStateRequest does not work well with PyQt 4.8
Hi, In my application (frescobaldi) (using API 2 for QString and QVariant), if qApp is an QApplication(), def saveState(sm): pass # code saving state qApp.saveStateRequest.connect(saveState) yields: Object::connect: No such signal QApplication::saveStateRequest(QSessionManager) Object::connect: (sender name: 'frescobaldi') Traceback (most recent call last): File ./frescobaldi, line 2, in module import frescobaldi_app.main File /home/fede/src/frescobaldi/frescobaldi_app/main.py, line 41, in module import session # Initialize QSessionManager support File /home/fede/src/frescobaldi/frescobaldi_app/session.py, line 100, in module app.qApp.saveStateRequest.connect(saveState) TypeError: connect() failed between saveStateRequest(QSessionManager) and unislot() So, first QApplication complains, and then PyQt4 errors out. On PyQt 4.7 this works well. On PyQt4.8 the old way of connecting does work, however: QObject.connect(qApp, SIGNAL(saveStateRequest(QSessionManager)), saveState) does work correctly on both PyQt versions (4.7 and 4.8). Is this intended? with many regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] visualizing PDF files in PyQT WIndows
Op maandag 18 april 2011 schreef Jeremy: Is there any recommended way to visualize PDF files with PyQT under Windows? python-poppler-qt4 is a Python binding to the Poppler PDF library: http://code.google.com/p/python-poppler-qt4/ w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] c array question
Hi, I can't get sip to accept a c array definition like this in a specification file: int points[4]; sip simply complains with 'syntax error'. Should I use a different syntax? Or isn't this possible by default and should I write code to get and set items (or the complete array)? with many thanks, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] c array question
Op dinsdag 26 oktober 2010 schreef Phil: You will have to provide some handwritten code. Thanks! best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] KAction gets deleted prematurely
Hi, I just upgraded to KDE 4.4 and SIP 4.10 (using Python 2.6.4). I noticed that when I call addAction() method of a KActionCollection, the resulting KAction object gets deleted as soon as it goes out of scope. But it shouldn't as it is a QObject that has the KActionCollection instance as a parent. When I call action.setParent(collection) to set the actioncollection as the parent (again! but now from Python), the KAction object is not garbage collected. Is this a bug in the PyKDE4 sip definition files or am I doing something wrong? When I connect to the triggered signal in the old way (using QObject.connect(action, SIGNAL(triggered()) etc etc) the KAction gets deleted, but not when I use the modern way: action.triggered.connect(func) w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Python bindings for Poppler-Qt4, pypoppler-qt4
Op donderdag 03 december 2009 schreef Rajeev: However, some other projects have made some mods, but not contributed back. No idea why (or whether its ethical). I would be willing to update and extend the bindings to cover the full api of libpoppler-qt4. Is it OK that I create a small googlecode SVN project for it and maintain the source there, providing versioned tarballs for others to use as soon as it is complete? That way this nice binding could become part of distributions instead of everyone including its own fork (which is OK of course). with many regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Python bindings for Poppler-Qt4, pypoppler-qt4
Op donderdag 03 december 2009 schreef Rajeev: It doesnt have much to do with distributions, because these projects are doing it for their own needs and not for their distributions. I meant that python-poppler-qt4 could become a package in the Linux distribution sense, and that other programs could simply depend om that package, instead of including (some fork of) it in their own source tarball. I write and distribute a free software application (written in Python, called Frescobaldi, see www.frescobaldi.org ). In the future I want to extend that app with a PDF widget based on libpoppler-qt4. But I would rather not include the Python binding with my program (as it requires users to compile code). Users should install the python binding separately. Other projects also can then depend on that package instead of including their own version. But for the binding to be useful for others, the API coverage would need to be completed. I for myself need the links() method of the Page object and the various Link* classes, but I would be willing to make the binding complete and cover and test the full API of libpoppler-qt4. Then the binding could be released as tarballs so that other people can easily install it and (Linux) distributions can include packaged versions of the Python binding for libpoppler-qt4. Why do you need a fork on googlecode ? You can simply checkout on your local, make mods and send me patches. But if its really necessary, I can move it off Pardus' SVN repo and put it on Bitbucket. I would rather not create a fork. If I can contribute patches it's good as well. My main reason for creating a (googlecode) repo, is that it would make it easier for me to work on both my machines and commit to the repo often. And to have a well-known place to provide source tarballs I can point users of my application to. Best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Python bindings for Poppler-Qt4, pypoppler-qt4
Hi, at http://websvn.pardus.org.tr/trunk/playground/pypoppler-qt4/?root=uludag there are Python bindings for Poppler-Qt4. I would really like to use them in my application, but I also need the links() method of the Page object working. This method (and the link classes) is not available. Any chance this nice package gets updated? Otherwise I'll try myself but then I need to learn SIP a lot better. :) with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] object using deleteLater(), signal destroyed() not emitted
Hi, in recent sip releases (on my Karmic system, 4.9.1-snapshot), the signal destroyed() is not emitted (as least not by PyQt) when a remote object destroys itself using deleteLater(). in sip 4.7.9 it works perfectly. The qobject in question is a KDE readonly part (KonsolePart) that destroys itself using deleteLater() when the user logs out of the terminal. I want to notice the logout and hide the widget, recreating the part when the terminal view is requested again. But as said, in sip 4.9.1.x the slot connected to the part's destroyed() signal is not called. Attached is a small (KDE) test app to demonstrate the problem. Is this a bug or should I use another way of doing this? Attached the small test app. When the user logs out the terminal, a message should be printed on stdout. w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi #!/usr/bin/env python import os, sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyKDE4.kdecore import * from PyKDE4.kdeui import * from PyKDE4.kparts import * aboutData = KAboutData( 'libkonsoleparttester', '', ki18n('libkonsoleparttester'), '1.0', ) KCmdLineArgs.init(sys.argv, aboutData) app = KApplication() mainwin = KParts.MainWindow() app.setTopWidget(mainwin) factory = KPluginLoader(libkonsolepart).factory() part = factory.create(mainwin) mainwin.setCentralWidget(part.widget()) part.openUrl(KUrl(os.environ[HOME])) def slotDestroyed(): print Konsole part destroyed QObject.connect(part, SIGNAL(destroyed()), slotDestroyed, Qt.DirectConnection) mainwin.show() app.exec_() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] crash when not saving pointer to KTextEditor.View.selectionRange() result
Hi, Since PyQt4.5.x / KDE 4.3, this segfaults on my system (view is a KTextEditor.View instance): start = view.selectionRange().start() but when I write: selRange = view.selectionRange() start = selRange.start() it does not crash. Why is this? The value saved in start is just a KTextEditor.Cursor instance. w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] PyQt-4.5 KConfigGroup incompatibility problem?
Hi! Since PyQt4.5, a call to a KConfigGroup.readEntry always returns a QVariant: config = KGlobal.config().group('blaat').group('blaat') r = config.readEntry('blaat', 'bla') r PyQt 4.4.3 shows: PyQt4.QtCore.QString(u'bla') PyQt 4.5 shows: PyQt4.QtCore.QVariant object at 0x84b1b6c to keep my program working in both PyQt 4.4 and 4.5 should I change every call to: r = config.readEntry('blaat', QVariant('bla')).toString() ? Many thanks for an enlightening answer, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] [PyKDE4] accessing OkularPart's own methods
Hi, when I embed a okular part (using: part = KPluginLoader(okularpart).factory().create(mymainwindow) I get the kpart, but how can I access it's own methods (besides those of KPart) e.g. slotPrint() ? Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] [PyKDE4] Bug? missing KTextEditor.Editor.setSimpleMode
Hi, I would like to embed KTextEditor in a configurable way in my application, but unfortunately PyKDE4 does not have the setSimpleMode() method on the KTextEditor.Editor object. It seems it's missing from the sip file in KDE 4.1.2 Is this a bug? with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] PyKDE4, KApplication and DBus
Hi, I am writing a kde application in PyKDE4 that embeds katepart and okular. That works fine, but I also want to export my own DBus object to implement a simple general methods (like openUrl) for my app. Currently KApplication, KatePart etc. all register their objects under the bus-name org.myapplication-$pid. where 'myapplication' is set from the homepage URL in the aboutData. But it seems I can't get my own object (created using dbus-python) under the same bus name. Is there a way to add my own (dbus-python) object to the existing busname that is registered by KApplication? with best regards and TIA, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] arbitrary instance attributes on qt widgets?
Hi, Is this legal? q = QListBoxText(listbox) q.bla = 3 this sets a new attribute 'bla' to 3. I could use this to have the listboxitem carry some other data. Or should I subclass QListBoxItem to add such an attribute? with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] kdecore.KProcess.Communication enum not OR-able
Hi, The KDE docs say that you can OR the values of the kdecore.KProcess.Communication enum when start()ing a KProcess.[1] However that seems not to be possible: from kdecore import * p=KProcess() p.setExecutable('cat') True p.start(KProcess.NotifyOnExit, KProcess.Stdin | KProcess.Stdout) Traceback (most recent call last): File stdin, line 1, in module TypeError: argument 2 of KProcess.start() has an invalid type type(KProcess.Stdin | KProcess.Stdout) type 'int' type(KProcess.Stdin) class 'kdecore.Communication' So I can only use the predefined values of the Communication enum (All, AllOuput etc.). Is this a bug and is there a workaround to start a KProcess() and only communicate with stdout and stdin and not stderr? [1]http://api.kde.org/3.5-api/kdelibs-apidocs/kdecore/html/classKProcess.html#31e69eb366082bb93bbdc31e6e281019 TIA, w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kdecore.KProcess.Communication enum not OR-able
I forgot to mention the version of PyKDE: PyKDE 3.16.0 PyQT 3.17.4 KDE 3.5.8 thx, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kdecore.KProcess.Communication enum not OR-able
Op zaterdag 12 april 2008, schreef Jim Bublitz: Phil suggests that this: p.start(KProcess.NotifyOnExit, KProcess.Communication (KProcess.Stdin | KProcess.Stdout)) Thanks, it works! I tried to do that, but tried kdecore.Communication instead of KProcess.Communication should work - I haven't tried it. A couple of other notes: 1. This enum isn't available in KDE4 and 2. A lot of the enums in KDE4/PyKDE4 (and Qt4) will require similar strict type-checking (everything using QFlags). Thanks for the information and explanation. w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[partially solved] Re: [PyQt] KProcess setUsePty not there...
Op donderdag 3 april 2008, schreef Jim Bublitz: On Wednesday 02 April 2008 08:00, Wilbert Berendsen wrote: Hi, I want to run a program that insists on reading from a terminal using KProcess (from within PyKDE), but it seems KProcess::setUsePty() does not exist: Python 2.5.1 (r251:54863, Mar 26 2008, 22:37:08) [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2 Type help, copyright, credits or license for more information. from kdecore import * p=KProcess() p.setUsePty(3,False) It's an error in not providing a #define for a conditional in the h file when generating PyKDE. Is this a bug in KDE, in PyKDE or in Gentoo's compile setup? You can fix it in sip/kdecore/kprocess.sip by changing this (near line 193): %If ( KDE_3_2_0 - KDE_3_4_0 ) void setUsePty (KProcess::Communication, bool); KPty*pty () const; %End to this: %If ( KDE_3_2_0 - ) void setUsePty (KProcess::Communication, bool); KPty*pty () const; %End and then rebuild with python configure.py -lkdecore make su -cmake install I did that and yes, now setUsePty works. Thanks! A remaining question, as I can't ask the users of my LilyKDE module to recompile PyKDE: does setUsePty work in mainstream distributions like Ubuntu? Thanks, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] KProcess setUsePty not there...
Hi, I want to run a program that insists on reading from a terminal using KProcess (from within PyKDE), but it seems KProcess::setUsePty() does not exist: Python 2.5.1 (r251:54863, Mar 26 2008, 22:37:08) [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2 Type help, copyright, credits or license for more information. from kdecore import * p=KProcess() p.setUsePty(3,False) Traceback (most recent call last): File stdin, line 1, in module AttributeError: setUsePty KDE: 3.5.8 dev-python/sip: 4.7.3 dev-python/pykde: 3.16.0 dev-python/PyQt: 3.17.4 How can I fix this? with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ Met vriendelijke groet, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt