[PyQt] QListWidget and scrolling
Hi,I created an application that contains a worker thread (derived from QThread) sending a signal to the main UI thread which displays status messages in a QListWidget.Adding strings to the QListWidget works fine, however the list doesn't scroll to the end. I'd like the list to scroll to the bottom every time a new string is added.I tried scrollToBottom() and it froze the application. Another thing I tried is retrieve the last item and call scrollToItem(), with the same result.I am running PyQt 4.7 and Python 2.5 on Vista 64.What am I doing wrong :-( ?Thanks,Christian ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] signal propagating
Hello, Here's a stripped down example of my problem. I have a group of widgets that I keep together with a class called MyWidgetGroup. It holds a line edit and a label which together have a meaning (getMeaning) but by themselves mean nothing. I need to make connections to a method so it'll get called whenever the widget's text changes but I don't want the reference to the line edit, I want the reference to the widget group (so I can getMeaning on it). To do this I wound up creating a dummy method that just propagates the signal so that it comes from the widget group instead of just the line edit. I have a bad feeling about this. There must be a better way to do this right? Can this be accomplished by connecting signals to signals? class MyWidgetGroup(QWidget): def __init__(self, parent=None): super(MyWidgetGroup, self).__init__(parent) self.myLabel = MyLabel(self) self.myEdit = MyLineEdit(self) self.connect(self.myEdit, SIGNAL("textChanged(QString)"), self.pointless) def pointless(self, qstring): self.emit(SIGNAL("theValueChanged")) def getMeaning(self): return self.myLabel.text() + '-' + self.myEdit.text() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] can't drop external data onto QTreeView
stupid me. I had: if not index.isValid(): return QtCore.Qt.NoItemFlags in my flags() override. doh! D ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
Hmm interesting topic, I recently had to switch back from ui files to py files because I couldnt get py2exe to package the ui files correctly (Any help appreciated though) Secondly using ui files I loose the comfort of auto-completion with pydev and Eclipse, because pydev wouldnt know how to deal with the ui xml data. If there is anybody out there having advice on that, I'd gladly take it :) Am 28.09.2010 21:46, schrieb fpp: On Tue, Sep 28, 2010 at 6:19 PM, pard wrote: Hi I have found that some people use pyuic4 to compile their ui files and some load them dynamically using loadUI. Does anyone have the pro's and con's of each of these methods? What is the recommended PyQT way of doing this? Thanks for starting the discussion, I've often wondered myself. I have no opinion one way or another, but since most seem to favour loadUI, I'll play the devil's advocate for pyuic4 :-) I can think of several reasons to prefer compiled ui files : 1) if you're using eric4 as an IDE, it does everything for you, so why not ? 2) on a reasonably recent PC, and for common UIs, the additional launch time, CPU& memory usage due to loadUI are probably not even measurable, compared to the Python, Qt and PyQt startup load. For extremely complex and widget-heavy UIs this might be less evident : parsing XML is not the most efficient thing in the world after all. And if we're running on mobile platforms with more limited power/CPU/RAM and slow Flash I/O, like Nokia's Symbian or Maemo smartphones, it could become quite perceptible. 3) during the early design phases, it's sometimes handy to be able to manually modify a generated Python UI file, just to check out the effect of some minor change, without having to do it in Designer (especially if it involves sizers :-) 4) if for some reason you wish or need to distribute only binaries, as sometimes happens, you can exclude the .ui source files and ship only the UI .pyc/pyo files. Dumb, yes, but not entirely impossible :-) ___ 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] can't drop external data onto QTreeView
Howdy, I'm having trouble dropping "text/plain" QMimeData onto a QTreeView. The subtlety is that I am trying to drag onto an empty root. The context is that I want to use drag and drop to help build the tree. If I have an existing item in the tree, then I can drop onto that just fine. The trouble is that I want to drag below the bottom of the tree or onto an empty tree and have that act like dragging onto the hidden root. I have read through all the examples I could find and looked through the documentation. I have overridden the following methods of QAbstractItem: flags() supportedDropActions(), mimeTypes(), dropMimeData(). In the QTreeView I have set setAcceptDrop(True), setDropIndicatorShown(True), and even overridden: def dragEnterEvent(self, event): if event.mimeData.hasFormat("text/plain"): event.acceptProposedAction() def dragMoveEvent(self, event): if event.mimeData.hasFormat("text/plain"): event.acceptProposedAction() None of this lets me drop onto the background of the tree. Can anyone suggest what I might need to override or set so that I can get dropMimeData in the model to fire when I drop over an invalid item in the QTreeView? thanks, Danny ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
On Tue, Sep 28, 2010 at 6:19 PM, pard wrote: > Hi > I have found that some people use pyuic4 to compile their ui files and some > load them dynamically using loadUI. > Does anyone have the pro's and con's of each of these methods? What is the > recommended PyQT way of doing this? Thanks for starting the discussion, I've often wondered myself. I have no opinion one way or another, but since most seem to favour loadUI, I'll play the devil's advocate for pyuic4 :-) I can think of several reasons to prefer compiled ui files : 1) if you're using eric4 as an IDE, it does everything for you, so why not ? 2) on a reasonably recent PC, and for common UIs, the additional launch time, CPU & memory usage due to loadUI are probably not even measurable, compared to the Python, Qt and PyQt startup load. For extremely complex and widget-heavy UIs this might be less evident : parsing XML is not the most efficient thing in the world after all. And if we're running on mobile platforms with more limited power/CPU/RAM and slow Flash I/O, like Nokia's Symbian or Maemo smartphones, it could become quite perceptible. 3) during the early design phases, it's sometimes handy to be able to manually modify a generated Python UI file, just to check out the effect of some minor change, without having to do it in Designer (especially if it involves sizers :-) 4) if for some reason you wish or need to distribute only binaries, as sometimes happens, you can exclude the .ui source files and ship only the UI .pyc/pyo files. Dumb, yes, but not entirely impossible :-) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Another pyuic/qstring problem
Hello, I'm using latest sip/pyqt snapshots and latest Qt 4.7.0. When I try to run this code: -- from PyQt4 import uic from PyQt4.Qt import QApplication import sys app = QApplication(sys.argv) uic.loadUi("system-config-printer.ui") -- I got the trace below: -- Traceback (most recent call last): File "hede.py", line 9, in uic.loadUi("/usr/share/kde4/apps/system-config-printer-kde/system-config-printer.ui") File "/usr/lib/python2.7/site-packages/PyQt4/uic/__init__.py", line 188, in loadUi return DynamicUILoader().loadUi(uifile, baseinstance) File "/usr/lib/python2.7/site-packages/PyQt4/uic/Loader/loader.py", line 28, in loadUi return self.parse(filename, QtCore.QFileInfo(filename).path()) File "/usr/lib/python2.7/site-packages/PyQt4/uic/uiparser.py", line 830, in parse actor(elem) File "/usr/lib/python2.7/site-packages/PyQt4/uic/uiparser.py", line 675, in createUserInterface self.wprops.setProperties(self.toplevelWidget, elem) File "/usr/lib/python2.7/site-packages/PyQt4/uic/properties.py", line 369, in setProperties prop_value = self.convert(prop, widget) File "/usr/lib/python2.7/site-packages/PyQt4/uic/properties.py", line 334, in convert return func(prop[0], **args) File "/usr/lib/python2.7/site-packages/PyQt4/uic/properties.py", line 162, in _iconset return self.icon_cache.get_icon(prop) File "/usr/lib/python2.7/site-packages/PyQt4/uic/icon_cache.py", line 28, in get_icon iset = _IconSet(iconset, self._base_dir) File "/usr/lib/python2.7/site-packages/PyQt4/uic/icon_cache.py", line 61, in __init__ self._fallback = self._file_name(iconset.text, base_dir) File "/usr/lib/python2.7/site-packages/PyQt4/uic/icon_cache.py", line 85, in _file_name fname = os.path.join(base_dir, fname) File "/usr/lib/python2.7/posixpath.py", line 67, in join elif path == '' or path.endswith('/'): AttributeError: 'QString' object has no attribute 'endswith' -- This may be related to the QString workaround in loader.py: 26 # By using QFileInfo.path() rather than os.path.dirname() we allow 27 # QString file names. 28 return self.parse(filename, QtCore.QFileInfo(filename).path()) Any ideas? -- Gökçen Eraslan ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
On Tuesday 28 September 2010, 18:19:43 pard wrote: > Hi > > I have found that some people use pyuic4 to compile their ui files and > some load them dynamically using loadUI. > Does anyone have the pro's and con's of each of these methods? What is > the recommended PyQT way of doing > this? Being impatient, I always keep an eye on any avoidable delays, and that's one of them. And since I have to run auxiliary tools anyway (pyrcc4, pylupdate4, lrelease), compiling the UI is more or less free anyway.. Here are some simplified Makefile excerpts: PYRESOURCES = $(patsubst %.qrc,%_rc.py,resources.qrc) PYUIFILES = $(patsubst %.ui,Ui_%.py,$(wildcard *.ui)) %_rc.py: %.qrc pyrcc4 -o $@ $< %.py: %.ui pyuic4 -o $@ $< all: $(PYUIFILES) $(PYRESOURCES) Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
On 9/28/2010 1:19 PM, Wolfgang Rohdewald wrote: On Dienstag 28 September 2010, Sebastian Wiesner wrote: So basically it "just works", whereas pyuic4 means additional work. UI compilers are fine for C++, where you have to compile anyway, but in Python things are easier. Just my opinion ... +1 however I never tested how much time either variant takes for the application to start. In my case, kajongg, there are only 2 small .ui so time does not matter +1 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kdebindings 4.4.4 build failure with sip-4.11.1 continues
28 Eylül 2010 Salı günü (saat 19:01:26) Phil Thompson şunları yazmıştı: > I'll probably be able to look at it on Thursday. For now, I'm able to build PyKDE with the workaround patch attached. FYI. -- Gökçen Eraslan Pardus Developer diff -Naur PyQt-x11-gpl-snapshot-4.8-eac5dd92c907-orig//sip/QtCore/qglobal.sip PyQt-x11-gpl-snapshot-4.8-eac5dd92c907/sip/QtCore/qglobal.sip --- PyQt-x11-gpl-snapshot-4.8-eac5dd92c907-orig//sip/QtCore/qglobal.sip 2010-09-28 14:06:40.68247 +0300 +++ PyQt-x11-gpl-snapshot-4.8-eac5dd92c907/sip/QtCore/qglobal.sip 2010-09-28 14:07:22.95247 +0300 @@ -304,22 +304,6 @@ //QFlags operator&(ENUM f) const; QFlags operator~() const; -// These are here to ensure consistency between, for example: -// Qt.AlignLeft | Qt.AlignTop | Qt.TextWordWrap and -// Qt.AlignLeft | Qt.TextWordWrap | Qt.AlignTop -// In the first of the above Qt.TextWordWrap is ored with a -// Qt.AlignmentFlag enum. In the second it is being ored with a -// Qt.Alignment class. -QFlags operator|(int f); -%MethodCode -sipRes = new QFlags(*a0 | (ENUM(a1))); -%End - -QFlags operator^(int f); -%MethodCode -sipRes = new QFlags(*a0 ^ (ENUM(a1))); -%End - // These are necessary to prevent Python comparing object IDs. bool operator==(const QFlags &f) const; %MethodCode signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
On Dienstag 28 September 2010, Sebastian Wiesner wrote: > So basically it "just works", whereas pyuic4 means additional > work. UI compilers are fine for C++, where you have to > compile anyway, but in Python things are easier. Just my > opinion ... +1 however I never tested how much time either variant takes for the application to start. In my case, kajongg, there are only 2 small .ui so time does not matter -- Wolfgang ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tuesday 28 September 2010 18:44:17 Baz Walter wrote: > On 28/09/10 11:11, Sybren A. Stüvel wrote: > > PS: Please reply to just the list, there is no need to do reply-all, > > I'm on the list too. With a reply-all I get your mail twice. > > there is a mailman option to prevent this. > > go here: http://www.riverbankcomputing.com/mailman/options/pyqt > > and look for the option "Avoid duplicate copies of messages?" (should be > last in the list). > > note that the option can be set globally. Note that this seriously messes up any filter that filters on the mailinglist- id... Arnold signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 vs uic.loadUI
Hi, I prefer uic.loadUi, it's simply much more convenient and much easier to use. It saves the tedious invocation of pyuic4 during development. And no risk of weird errors caused by a forgotten compilation of your user interface ... the application automatically uses the user interface, that you just saved in the designer. And you can deploy UI files with standard distutils as "package data" along with the application code (pyuic4 would require some custom solution to compile UI files during installation or packaging, unless you want to have generated could lingering around in the source tree). So basically it "just works", whereas pyuic4 means additional work. UI compilers are fine for C++, where you have to compile anyway, but in Python things are easier. Just my opinion ... Sebastian Wiesner ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On 28/09/10 11:11, Sybren A. Stüvel wrote: PS: Please reply to just the list, there is no need to do reply-all, I'm on the list too. With a reply-all I get your mail twice. there is a mailman option to prevent this. go here: http://www.riverbankcomputing.com/mailman/options/pyqt and look for the option "Avoid duplicate copies of messages?" (should be last in the list). note that the option can be set globally. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug in sip-4.11.1 and PyQt-4.7.7 ?
On 27/09/10 19:45, Gerard Vermeulen wrote: Phil, when running the following code #!/usr/bin/env python # -*- coding: utf-8 -*- import PyQt4.Qt as Qt class MyWidget(Qt.QWidget): def __init__(self, parent=None): super(Qt.QWidget, self).__init__(parent) # __init__() # class MyWidget def bar(widget): pass # bar() def foo(widget): print type(widget) # BUG? For me widget is a Python type, but not for widget.connect(). widget.connect(widget, Qt.SIGNAL('item_changed(widget)'), bar) "item_changed" is a new PyQt4 signal defined dynamically. so you need to write either: widget.connect(widget, Qt.SIGNAL('item_changed'), bar) or possibly: widget.connect(widget, Qt.SIGNAL('item_changed(PyQt_PyObject)'), bar) you would then emit "item_changed" like this: widget.emit(Qt.SIGNAL('item_changed'), widget) or: widget.emit(Qt.SIGNAL('item_changed(PyQt_PyObject)'), widget) see here for more details: http://www.riverbankcomputing.com/static/Docs/PyQt4/pyqt4ref.html#pyqt-signals-and-qt-signals # foo() if __name__ == '__main__': application = Qt.QApplication([]) widget = MyWidget() foo(widget) # Local Variables: *** # mode: python *** # End: *** I get this traceback: Traceback (most recent call last): File "bug.py", line 31, in foo(widget) File "bug.py", line 23, in foo widget.connect(widget, Qt.SIGNAL('item_changed(widget)'), bar) TypeError: C++ type 'widget' is not supported as a slot argument type but isn't widget a Python type? (although derived from a C++ type) no. widget is an instance of class MyWidget, not a type. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyuic4 vs uic.loadUI
Hi I have found that some people use pyuic4 to compile their ui files and some load them dynamically using loadUI. Does anyone have the pro's and con's of each of these methods? What is the recommended PyQT way of doing this? Regards Pard ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kdebindings 4.4.4 build failure with sip-4.11.1 continues
On Tue, 28 Sep 2010 17:48:45 +0200, "Hans-Peter Jansen" wrote: > Dear Phil, > > unfortunately, this issue is actively holding back current sip for them > and > it blocks a complete build of my PyQt project in build service, too. > > It even made it into kde's bug tracking system already: > > https://bugs.kde.org/show_bug.cgi?id=252366 > > I know, PyKDE is not your business, but before I revert and downgrade sip, > > it would be nice, if you could look briefly into it. I'll probably be able to look at it on Thursday. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kdebindings 4.4.4 build failure with sip-4.11.1 continues
Dear Phil, unfortunately, this issue is actively holding back current sip for them and it blocks a complete build of my PyQt project in build service, too. It even made it into kde's bug tracking system already: https://bugs.kde.org/show_bug.cgi?id=252366 I know, PyKDE is not your business, but before I revert and downgrade sip, it would be nice, if you could look briefly into it. Thanks, Pete On Friday 24 September 2010, 13:04:26 Hans-Peter Jansen wrote: > On Wednesday 22 September 2010, 11:25:21 Hans-Peter Jansen wrote: > > Unfurtunately, here's the next stumbling point: > > > > /usr/include/kio/tcpslavebase.h: In function 'PyObject* > > slot_KIO_TCPSlaveBase_SslResult___xor__(PyObject*, PyObject*)': > > /usr/include/kio/tcpslavebase.h:63: error: 'enum > > KIO::TCPSlaveBase::SslResultDetail' is protected > > /usr/share/sip/PyQt4/QtCore/qglobal.sip:320: error: within this context > > /usr/include/kio/tcpslavebase.h: In function 'PyObject* > > slot_KIO_TCPSlaveBase_SslResult___or__(PyObject*, PyObject*)': > > /usr/include/kio/tcpslavebase.h:63: error: 'enum > > KIO::TCPSlaveBase::SslResultDetail' is protected > > /usr/share/sip/PyQt4/QtCore/qglobal.sip:315: error: within this context > > > > Phil, this one is due to the logic operator changes. It's not obvious, > > what's going wrong, but related to the friend class QFlags > > declararation, where qglobal.sip got pulled in.. > > > > Here's the KDE class excerpt: > > > > class KIO_EXPORT TCPSlaveBase : public SlaveBase > > { > > public: > > /** > > * Constructor. > > * > > * @param autoSsl if true, will automatically invoke startSsl() > > right after *connecting. In the absence of errors the > > use of SSL will *therefore be transparent to higher > > layers. */ TCPSlaveBase(const QByteArray &protocol, > > const QByteArray &poolSocket, const QByteArray > > &appSocket, bool autoSsl = false); > > > > virtual ~TCPSlaveBase(); > > > > protected: > > enum SslResultDetail { > > ResultOk = 1, > > ResultOverridden = 2, > > ResultFailed = 4, > > ResultFailedEarly = 8 > > }; > > friend class QFlags; > > public: > > Q_DECLARE_FLAGS(SslResult, SslResultDetail) > > protected: > > [...] > > > > and the related sip file excerpt: > > > > %ModuleHeaderCode > > //ctscc > > #include > > #include > > #include > > %End > > > > namespace KIO > > { > > > > class TCPSlaveBase : KIO::SlaveBase > > { > > %TypeHeaderCode > > #include > > %End > > > > > > public: > > TCPSlaveBase (const QByteArray& protocol, const QByteArray& > > poolSocket, const QByteArray& appSocket, bool autoSsl = 0); > > > > > > protected: > > enum SslResultDetail > > { > > ResultOk, > > ResultOverridden, > > ResultFailed, > > ResultFailedEarly > > }; > > [...] > > > > Both attached. > > And here's the offending sip generated code (for the __xor__ method): > > extern "C" {static PyObject > *slot_KIO_TCPSlaveBase_SslResult___xor__(PyObject *,PyObject *);} static > PyObject *slot_KIO_TCPSlaveBase_SslResult___xor__(PyObject > *sipArg0,PyObject *sipArg1) { > PyObject *sipParseErr = NULL; > > { > KIO::TCPSlaveBase::SslResult * a0; > int a0State = 0; > KIO::TCPSlaveBase::SslResult * a1; > int a1State = 0; > > if (sipParsePair(&sipParseErr, sipArg0, sipArg1, "J1J1", > sipType_KIO_TCPSlaveBase_SslResult, &a0, &a0State, sipT > ype_KIO_TCPSlaveBase_SslResult, &a1, &a1State)) > { > KIO::TCPSlaveBase::SslResult *sipRes; > > Py_BEGIN_ALLOW_THREADS > sipRes = new KIO::TCPSlaveBase::SslResult((*a0 ^ *a1)); > Py_END_ALLOW_THREADS > > sipReleaseType(a0,sipType_KIO_TCPSlaveBase_SslResult,a0State); > sipReleaseType(a1,sipType_KIO_TCPSlaveBase_SslResult,a1State); > > return > sipConvertFromNewType(sipRes,sipType_KIO_TCPSlaveBase_SslResult,NULL); } > } > > { > KIO::TCPSlaveBase::SslResult * a0; > int a0State = 0; > int a1; > > if (sipParsePair(&sipParseErr, sipArg0, sipArg1, "J1i", > sipType_KIO_TCPSlaveBase_SslResult, &a0, &a0State, &a1)) { > KIO::TCPSlaveBase::SslResult *sipRes = 0; > > #line 320 "/usr/share/sip/PyQt4/QtCore/qglobal.sip" > sipRes = new KIO::TCPSlaveBase::SslResult(*a0 ^ > (KIO::TCPSlaveBase::SslResultDetail(a1))); #line 7221 "sipkiopart0.cpp" > > sipReleaseType(a0,sipType_KIO_TCPSlaveBase_SslResult,a0State); > > return > sipConvertFromNewType(sipRes,sipType_KIO_TCPSlaveBase_SslResult,NULL); } > } > > Py_XDECREF(sipParseErr); > > if (sipParseErr == Py_None) > return NULL; > > return > sipPySlotExtend(&sipModuleAPI_kio,xor_slot,NULL,sipArg0,sipArg1); } > > > The question is, why can't this method access the protected enum > KIO::TCPSlaveBase::SslResultDetail(a1) > > Does it have to be declare
Re: [PyQt] API 2 and Qt Designer
On Tuesday 28 September 2010 12:25:36 Phil Thompson wrote: > Your only option at the moment is to use the Python plugin built > against Python3. This then means that your custom widgets would > need to work with Python3, but that shouldn't be too difficult if > they are already ported to the v2 APIs. Ok, that's clear then, thanks. For me it'll be easy indeed, but I have to consider my poor colleagues ;-) For my company this is a first stroll into the Python world, so I have to keep things as simple as possible for them. I'll have to balance the ease of API 2 against the mix of Python 2 and 3... -- Sybren A. Stüvel syb...@stuvel.eu http://stuvel.eu/ signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tue, 28 Sep 2010 12:11:48 +0200, "Sybren A. Stüvel" wrote: > On Tuesday 28 September 2010 12:03:25 Phil Thompson wrote: >> > Is it possible to move to API 2 and still keep using Qt Designer? >> >> Yes, because the code generated by pyuic4 works with both Python2 >> and Python3. >> >> You have to make sure that you call setapi() before the very first >> PyQt import. > > I do that in my code. When I import my modules from outside Qt > Designer they load just fine. > > It seems that Qt Designer already imports PyQt before importing my > plugin modules. When I start the designer with the PYQTDESIGNERPATH > environment variable set to my designer plugin directory, I get those > errors. I didn't understand what you meant by "using Qt Designer". Your only option at the moment is to use the Python plugin built against Python3. This then means that your custom widgets would need to work with Python3, but that shouldn't be too difficult if they are already ported to the v2 APIs. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tuesday 28 September 2010 12:03:25 Phil Thompson wrote: > > Is it possible to move to API 2 and still keep using Qt Designer? > > Yes, because the code generated by pyuic4 works with both Python2 > and Python3. > > You have to make sure that you call setapi() before the very first > PyQt import. I do that in my code. When I import my modules from outside Qt Designer they load just fine. It seems that Qt Designer already imports PyQt before importing my plugin modules. When I start the designer with the PYQTDESIGNERPATH environment variable set to my designer plugin directory, I get those errors. PS: Please reply to just the list, there is no need to do reply-all, I'm on the list too. With a reply-all I get your mail twice. -- Sybren A. Stüvel syb...@stuvel.eu http://stuvel.eu/ signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tuesday 28 September 2010 11:51:06 Sybren A. Stüvel wrote: > Is it possible to move to API 2 and still keep using Qt Designer? PS: I'm using Qt Designer on Kubuntu 10.04 from the qt4-designer package version 4:4.6.3-0ubuntu1. -- Sybren A. Stüvel syb...@stuvel.eu http://stuvel.eu/ signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tue, 28 Sep 2010 11:51:06 +0200, "Sybren A. Stüvel" wrote: > Hi folks, > > I'd love to migrate my PyQt application to API 2, especially for the > QString class. I'm still using Python 2.x, but I think API 2 feels > much more Pythonic. It also will prepare my application for a future > port to Python 3. However, when I use sip.setapi('QString', 2) my code > seems to become incompatible with Qt Designer. When it tries to load > my custom widget plugin, I get this: > > ValueError: API 'QString' has already been set to version 1 > > Is it possible to move to API 2 and still keep using Qt Designer? Yes, because the code generated by pyuic4 works with both Python2 and Python3. You have to make sure that you call setapi() before the very first PyQt import. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] API 2 and Qt Designer
Hi folks, I'd love to migrate my PyQt application to API 2, especially for the QString class. I'm still using Python 2.x, but I think API 2 feels much more Pythonic. It also will prepare my application for a future port to Python 3. However, when I use sip.setapi('QString', 2) my code seems to become incompatible with Qt Designer. When it tries to load my custom widget plugin, I get this: ValueError: API 'QString' has already been set to version 1 Is it possible to move to API 2 and still keep using Qt Designer? Cheers, -- Sybren A. Stüvel syb...@stuvel.eu http://stuvel.eu/ signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt