Re: [PyQt] Multiprocessing and ProgressBar
On 7 October 2010 15:13, Nicola Creati wrote: > with QThread I'm able to make the code work but I need to send computation > to more than one core in my application. > Beside that, there is a huge difference between threads and processes. I'm quite curious to see whether there is a way to make the Qt signals work over Python's multiprocessing interface. -- Sybren A. Stüvel http://stuvel.eu/ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] API 2 and Qt Designer
On Tue, Sep 28, 2010 at 07:02:29PM +0200, Arnold Krille wrote: > Note that this seriously messes up any filter that filters on the > mailinglist- id... I never understood the desire of some people to use reply-all instead of reply-to-list. I never understood why list admins refuse to use the reply-to header either. -- Sybren A. Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ 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: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 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
[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
Re: [PyQt] Converting an ugly path to a shell path
On Tuesday 14 September 2010 18:40:38 amfr...@web.de wrote: > My problem is that i also have commands that are together with > paths so cmd = "ls /home/user/test dir/". > And afaik if i don't use the shell i need to seperate command and > path ? Yep, you can use the shlex module for that. But - only if you actually _know_ what the command is, and what its arguments are. For example, how would you know that the user isn't trying to run the "ls /home/usr/test" executable and pass it "dir/" as the first argument? -- 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] Converting an ugly path to a shell path
On Tuesday 14 September 2010 00:08:40 amfr...@web.de wrote: > I think quotes don't work always ? > For example when i have a dir like ""' how do i quote it ? I would take out the middle man. Don't use the shell, unless you really have to. If you just pass a list of arguments to subprocess.Popen, they will be "received" by the application just as- is. No escaping needed. import subprocess proc = subprocess.Popen([command, path]) -- 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] pyuic4 crash in 4.7.6
On Monday 13 September 2010 12:11:48 Gökçen Eraslan wrote: > That's fixed in the latest snapshot, by the way. Great, thanks! -- Sybren A. Stüvel 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] pyuic4 crash in 4.7.6
On Tuesday 07 September 2010 11:10:56 Phil Thompson wrote: > As a workaround, edit the driver.py file and remove the encoding > argument from the call to open(). Thanks for the workaround. However, it's not something I'd like to put into our development manual and have every developer go through. I'll wait for a proper fix ;-) Regards, -- 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
[PyQt] pyuic4 crash in 4.7.6
Hi list, I just upgraded from PyQt4 4.7.4 to 4.7.6, running on Python 2.6.6 on Windows XP. After the upgrade my pyuic4.bat doesn't work any more. Here is an example: $ echo > test.ui $ pyuic4.bat -d -x test.ui -o test.py Traceback (most recent call last): File "C:\Python26\lib\site-packages\PyQt4\uic\port_v2\invoke.py", line 12, in invoke exit_status = driver.invoke() File "C:\Python26\lib\site-packages\PyQt4\uic\driver.py", line 37, in invoke self._generate() File "C:\Python26\lib\site-packages\PyQt4\uic\driver.py", line 60, in _generate pyfile = open(self._opts.output, 'wt', encoding='utf8') TypeError: 'encoding' is an invalid keyword argument for this function You see a cygwin prompt ($) but be assured that I've set up everything such that the native Windows version of Python is run, and not the Cygwin version. It's really the upgrade to 4.7.6 that induced this error. Downgrading to 4.7.4 gives me an ExpatError on the above test.ui, which I expected because it's not a valid XML file. Building my real UI files works just fine after the downgrade. Regards, -- 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] connections vs. instance variables
Hi Eric, A direct call is always more lightweight, as no matter what else happens, somehow in the end a direct call to the slot has to be made. Based on the 'type' parameter to the connect call, different things happen. The emitted signal can simply directly call the slot (default behaviour when both sender and receiver live in the same thread), or the signal can be stored in an event queue, from where it will be delivered later on (default behaviour when sender and receiver live in different threads). Sybren On Friday 03 September 2010 15:51:44 Eric Frederich wrote: > I constantly find myself with options like... > a) create a connection from foo's custom signal to bar's slot > or b) when creating the foo object, give it a reference to bar, > and instead of emitting a custom signal, just call bar's slot > directly. > > What is more lightweight an instance variable or a connection? > > I'm sure this must be common. > Are there guidelines to use, rules of thumb etc? > > Thanks, > ~Eric -- 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] Listview, scrollbar, empty row
On Tuesday 24 August 2010 13:01:25 you wrote: > Thanks Sybren, Please also send your replies to the mailing list. Using the 'reply to list' button on your email client should do that. > That's an option I did not think of. > > But if I am not wrong, with CSS I cannot play with the > scrollbar/rows of a listview. Or can I? No idea, I was just merely suggesting a CSS approach. Regards, -- 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] Listview, scrollbar, empty row
Can't you solve this with some CSS? Regards, Sybren On Tuesday 24 August 2010 11:35:38 M Chauhan wrote: > Hello Experts, > > I need some empty space in my listview after the last row. > > And for that I have two options: > > - move scroll bar beyond it's maximum value, > > - Or add an empty row in listview without passing via model. > > I am really interested in knowing how to achieve any of the above > or if there's any other solution for this. > > Thanks, > Mru -- 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] generic exception handler
On Thu, Aug 19, 2010 at 12:31:36PM -0500, Steve Borho wrote: > Sorry, I was too quick to dismiss. This does get called when any > unhandled exception occurs, which is what I need. Be aware that sys.excepthook is called from the thread that causes the exception. I streamlined this by emitting a Qt signal from the exception handler, and showing a dialog box from a connected slot in the GUI thread. Cheers, -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] connect problem on windows xp
On Thu, Jul 29, 2010 at 08:59:16AM +0200, Fabio Mauri wrote: > Attached you can find the Ui_Wdw class. That wasn't my point. Please make a *minimal* bit of code that shows your problem. > In the last connect, I used a different style because for such a > reason the QObject.connect() i used in the lines above wouldn't work > while the signal.connect() does (on Ubuntu 10.04). That's strange, as signal.connect() works just fine here (Ubuntu 10.04). Please try to make a minimal example, just one bit of code that shows the problem. -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] connect problem on windows xp
On 27-7-2010 10:30, Fabio Mauri wrote: > the whole file is quite big, but I think that the following is the > interesting part (if you need something more, ask me and I'll post > it): I think we need less, not more. This code won't run anyway, since you didn't provide the Ui_Wdw class. Try to create an example that's minimal. > QObject.connect(self.refresh, SIGNAL("clicked()"), self.refreshList) ... > self.objList.itemDoubleClicked.connect(self.showItem) Is there a reason that you use one style of connecting in one part of your code, and the other a few lines further down? Sybren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Issue with pyqtSlot(QModelIndex, QModelIndex)
On Tue, Jul 27, 2010 at 12:05:34PM +0100, Phil Thompson wrote: > Should be fixed in tonight's snapshot - a patch is attached if you > can't wait. > > As this is a regression I'll make a new PyQt release in a few days - > once I've had confirmation that the fix doesn't cause any other > problems. Excellent, thanks! -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Issue with pyqtSlot(QModelIndex, QModelIndex)
On Tue, Jul 27, 2010 at 06:12:23AM +0200, Sybren A. Stüvel wrote: > smodel = self.resultsView.selectionModel() > smodel.currentChanged.connect(self.on_change) PS: This does work in concert with the @QtCore.pyqtSignal(...) decorator: QtCore.QObject.connect(smodel, QtCore.SIGNAL('currentChanged(QModelIndex,QModelIndex)'), self.on_changed) -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Issue with pyqtSlot(QModelIndex, QModelIndex)
On Tue, Jul 27, 2010 at 12:36:02PM +0800, 机械唯物主义 : linjunhalida wrote: > in my OS, works OK. pythonxy 4.6 What's pythonxy? And what is your OS? > try: > smodel.currentChanged[QtCore.QModelIndex, > QtCore.QModelIndex].connect(self.on_change) Thanks for the suggestion. Unfortunately, it doesn't work: Running on Qt 4.6.2 Traceback (most recent call last): File "qttest.py", line 28, in win = Dialog() File "qttest.py", line 19, in __init__ smodel.currentChanged[QtCore.QModelIndex, QtCore.QModelIndex].connect(self.on_change) TypeError: on_change() has no overload that is compatible with currentChanged(QModelIndex,QModelIndex) Regards, -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Issue with pyqtSlot(QModelIndex, QModelIndex)
Dear list, I've just upgraded from PyQt 4.6 (PyQt-Py2.6-gpl-4.6-1.exe) to version 4.7.4 (PyQt-Py2.6-gpl-4.7.4-1.exe), and the upgrade introduced a crash in my program. I've narrowed it down to this example: from PyQt4 import QtCore, QtGui class Dialog(QtGui.QDialog): def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.resultsModel = QtGui.QStandardItemModel() self.resultsModel.appendRow(QtGui.QStandardItem('Item 1')) self.resultsModel.appendRow(QtGui.QStandardItem('Item 2')) self.resultsModel.appendRow(QtGui.QStandardItem('Item 3')) self.layout = QtGui.QVBoxLayout(self) self.resultsView = QtGui.QTreeView(self) self.resultsView.setModel(self.resultsModel) self.layout.addWidget(self.resultsView) smodel = self.resultsView.selectionModel() smodel.currentChanged.connect(self.on_change) @QtCore.pyqtSlot(QtCore.QModelIndex, QtCore.QModelIndex) def on_change(self, current, previous): print 'Changed from %s to %s' % (previous.row(), current.row()) app = QtGui.QApplication([]) win = Dialog() win.show() app.exec_() The program crashes with this error: Traceback (most recent call last): File "qttest.py", line 26, in win = Dialog() File "qttest.py", line 19, in __init__ smodel.currentChanged.connect(self.on_change) TypeError: on_change() has no overload that is compatible with currentChanged(QModelIndex,QModelIndex) When I remove the @QtCore.pyqtSlot() decorator the code runs just fine. It's a workaround, but I would prefer a clearner solution, or at least an understanding as to the cause of the exception. The exception occurs when running on PyQt 4.7.4, Qt 4.6.2 and Python 2.6 on Windows XP. The same code runs without error on PyQt 4.7.3, Qt 4.6.3 and Python 2.6 on Ubuntu Linux. Regards, -- Sybren Stüvel http://stuvel.eu/ signature.asc Description: Digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Connect a signal to a signal
On 9-6-2010 12:43, Jugdish wrote: > Hi, what is the proper way to connect a signal to another signal using > the new-style signal/slot syntax? I've been doing it like this: > > myObj1.mySignal.connect(lambda arg1, arg2: myObj2.mySignal.emit(arg1,arg2)) > > but is there a way to do it without using a lambda function? Yep: myObj1.mySignal.connect(myObj2.mySignal) Sybren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Mutiprocessing and QThread
On 23-5-2010 19:26, Martin Alderete wrote: > What is the best way to concurrency in PyQt QThread or multiprocessing ? IMO multiprocessing is always better than multithreading. Multithreading is difficult at the best of times, as it's very difficult to predict. I've heard Guido say that it's too difficult to get right, even for him, so I don't even bother if I can help it :) Regards, Sybren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Fwd: segfault after upgrades
On Wednesday, May 12, 2010 09:56:32 pm Kerri Reno wrote: > Our system manager upgraded our development server this past weekend as > follows: > ubuntu 9.04 to 10.04 > pyqt 4.4.4-2ubuntu6 to 4.7.2 > qt 4.5.0-0ubuntu4.3 to 4.6.2 > > Since the upgrade, I've been getting 'Segmentation fault (core dumped)' > when I close any pyqt UI (with either a menu or the close box). I got the same symptoms. Upgrading pyqt to 4.7.3 seems to help a bit, but doesn't solve it entirely. -- 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] QLineEdit drop event
On 28-4-2010 14:04, Sebastian Elsner wrote: > Documentation suggests that I subclass the line edit and reimplement > the dropEvent. That sounds good to me. > Would not be a problem, but my Line edit widget already exists on the > dialog, so how to subclass without creating a completely new > instance? Or is there another way I don't see? You can register your subclass in the designer, and tell it to replace the QLineEdit instances with your subclass. In the field that would ordinarily hold the .h file that defines the subclass, enter the .py file instead. Regards, -- Sybren A. Stüvel http://stuvel.eu/ signature.asc Description: OpenPGP digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Forum
Hi Francesco, On 8-4-2010 14:04, Francesco Biccari wrote: > I have been in this mailing list for few days, however I noticed that > a mailing list is very inefficient. That depends on your point of view. Subscribing to many mailing lists, I'm of a different opinion. I can keep track of all of them from one single application (my mail client), which is much easier than having to browse to every forum. > I think that a forum is the rigth answer. > It is much more simpler to search for an already discussed problem > (see the "crash on exit" of these days). The link at the bottom of this email sends you to a page that has this at the top: - To see the collection of prior postings to the list, visit the PyQt Archives. There are also some external searchable archives at * http://dir.gmane.org/gmane.comp.python.pyqt-pykde * http://www.mail-archive.com/pyqt%40riverbankcomputing.com/ - > Who agrees with me? Nope, sorry. Regards, -- Sybren A. Stüvel http://stuvel.eu/ signature.asc Description: OpenPGP digital signature ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Disposing of a QApplication
Hi all, I'm working on a PyQt GUI application using PyQt 4.6 and Python 2.6. According to the documentation: For any GUI application using Qt, there is precisely one QApplication object This is true for our application, but not for our unit tests. They start and stop a QApplication in quick succession, so when the test stops it has to shut down and dispose of the application properly. The application instance is stored in 'self.app' of the unittest class, but just doing 'del self.app' doesn't destroy the application (probably because there are other references to it in the Qt modules). Right now I start a separate thread that waits for a bit and then sends the application the quit() signal. Then I start the application's main loop, so that it is running when it receives the quit() signal from the other thread. Of course, this is not an ideal way. I tried a single-threaded approach by first sending it the quit() signal and then run app.exec_() but that doesn't stop the application. Another approach I used was to try and replace the event loop with the following code, but that also doesn't stop the application. def aboutToQuit(): self.fail("Quitting!") self.app.aboutToQuit.connect(aboutToQuit) # Send the quit event and let the application process it. start_time = time.time() while not self.app.closingDown(): self.app.quit() self.app.processEvents() self.app.sendPostedEvents(self.app, 0) self.app.flush() time.sleep(0.01) # Wait three seconds for the app to stop. if time.time() - start_time > 3.0: self.fail("Failed to quit the application") del self.app self.fail("Done") It's done in a unittest.TestCase class, and the self.fail() calls are there so that I can quickly see what's going on. What would you recommend? -- 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] New PyQt APIs
Hi Martin, On Monday 15 February 2010 14:06:20 Martin Teichmann wrote: > The other thing I stumbled about is the > sip.setapi thing. It's a bit strange a thing, > especially because it has to be called > before other imports, making the imports > a bit cluttered. I propose to make our own > __future__ module (or package), so > that you can just write: > > from PyQt4.__future__ import QString I can do simply "from PyQt4.QtCore import QString" and then use it. Can you give an example of where this fails? -- 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] List-like objects and QVariant
On Thursday 21 Jan 2010 13:34:27 Phil Thompson wrote: > This behaviour is wrong [...] I will fix it for PyQt v4.7.1. > > As a workaround you could wrap your class as an attribute of another > (non-sequence) class when converting to QVariant and unwrap it when > converting back. Thank you for providing a fix in the future, and for giving me a workaround now. Regards, -- 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
[PyQt] List-like objects and QVariant
Hi all, This is my first post to this list. I'm a software engineer at Chess in Haarlem, The Netherlands, and I'm using PyQt to develop a testing application. We created a TestSuite class that contains a filename and an ordered dictionary of TestCase objects The TestSuite class implements the __getitem__ method to get a test case by either its ID or its index number. It also implements the __len__ method to return the number of test cases stored. We're unable to store such a TestSuite object in a QVariant object. QVariant seems to think that __len__ + __getitem__ equals "list", so the TestSuite object is converted into a list of TestCases. This means that nearly all information stored in TestSuite is lost when storing it in a QVariant. I've included a minimal example that illustrates the problem: --- import unittest from PyQt4 import QtCore class ClassUnderTest(object): '''This is a class that looks like a list, but isn't.''' def __init__(self, mylist=None): self.mylist = mylist or [] def __getitem__(self, index): return self.mylist[index] def __len__(self): return len(self.mylist) def __eq__(self, other): return self.__class__ == other.__class__ and \ self.mylist == other.mylist class QVariantTest(unittest.TestCase): def test_store_restore(self): # Create a ClassUnderTest instance. original_object = ClassUnderTest([1, 2, 3, 4]) # Save in a QVariant and retrieve it again. variant = QtCore.QVariant(original_object) pyobj = variant.toPyObject() # Verify that they are the same. self.assertEqual(pyobj, original_object) --- I hope you can help me to fix this issue. Regards, -- 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