Re: [PyQt] PySide app seems to ignore SIGTERM during shutdown when run at startup using ~/.config/autostart
On Wed, Jun 12, 2013 at 2:58 AM, Luis Pugoy lpu...@insynchq.com wrote: My PySide app seems to ignore the TERM signal [...] Could anyone help? I suggest directing your question to the PySide mailing list. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] dip: question about changing UI elements based on task
I'm developing an application that has to support various loosely coupled tasks. For example, take an IDE where you switch between code editing and UI design tasks. These two tasks would each contribute their own central window, dock windows, menu items, and tools bars to the main window. Each task would probably be a plugin, but only one task would be active (and its ui elements visible) at a time. Is it possible for dip to compose the main window using elements contributed by such tasks? Any advise that could get me started in the right direction? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] does the dip package provide version information?
Is there a way to check dip's version information after importing? Something like: import dip print(dip.__version__) Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Can dip record events to create an automation script?
Hello, I develop tools for analysis of scientific data. I'd like to develop an application where the end-user's interaction with the GUI can be recorded and written to a script that could be run to reproduce the analysis. Is this possible with dip? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] help with dip and PyQt4 widgets
http://www.riverbankcomputing.co.uk/static/Docs/dip/model_tutorial.html#models-and-init : The handling of the initial values of attributes is performed by the meta-class of the Model class. This is done before the model’s __init__() method (if there is one) is called. On Fri, Jul 8, 2011 at 12:20 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: I tried that before and still getting the same error. I thinks is something like the C++ part of the widget is not created at the time when the properties methods are called to set my initial values as this happen before __init__ is called. On Fri, Jul 8, 2011 at 12:05 PM, Demetrius Cassidy dcassid...@gmail.com wrote: You need to call QToolButton's __init__() method. class Indicator(QtGui.QToolButton, Model): def __init__(self) super(Indicator, self).__init__() On Fri, Jul 8, 2011 at 1:49 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: hi folks, I am creating a composite widget with PyQt4 and Dip, the problem I have is that when I use dip properties for setting PyQt4 properties in the constructor I am getting an error saying that the underlying C++ object has been delete, I think this is due to the way dip works because it call properties methods before the actual Qt4 widget as been created when I pass an initial value in the constructor. When I construct the object with properties initial values and the use the properties accesors to set the value, this doens't happen. So, my question is, which is the right way to construct a custom composite widget with dip? # dip imports from dip.model import Model, Instance, Str # PyQt4 imports from PyQt4 import QtCore, QtGui class Indicator(QtGui.QToolButton, Model): # the indicator identifier, it must be unique for all indicators id = Str() # the indicator text, this text will be shown # beside the icon if one is defined text = Str() # the indicator tooltip tooltip = Str() # the indicator icon icon = Instance(QtGui.QIcon) @id.getter def id(self): print 'getting value' return self.objectName() @id.setter def id(self, id): print 'setting value' self.setObjectName(id) @text.getter def text(self): return self.text() @text.setter def text(self, text): self.setText(text) @tooltip.getter def tooltip(self): return self.toolTip() @tooltip.setter def tooltip(self, tooltip): self.setToolTip(tooltip) @icon.getter def icon(self): return self.icon() @icon.setter def icon(self, icon): self.icon = icon def perform(self): raise NotImplementedError if __name__ == '__main__': app = QtGui.QApplication([]) i = Indicator(text='xxx') i.show() app.exec_() -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] help with dip and PyQt4 widgets
Have you considered trying to decouple your model and view, as described throughout the documentation? On Fri, Jul 8, 2011 at 1:04 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: yes, I know, I read that in the docs, but, how to do something similar to what I want to achieve? On Fri, Jul 8, 2011 at 12:20 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: I tried that before and still getting the same error. I thinks is something like the C++ part of the widget is not created at the time when the properties methods are called to set my initial values as this happen before __init__ is called. On Fri, Jul 8, 2011 at 12:05 PM, Demetrius Cassidy dcassid...@gmail.com wrote: You need to call QToolButton's __init__() method. class Indicator(QtGui.QToolButton, Model): def __init__(self) super(Indicator, self).__init__() On Fri, Jul 8, 2011 at 1:49 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: hi folks, I am creating a composite widget with PyQt4 and Dip, the problem I have is that when I use dip properties for setting PyQt4 properties in the constructor I am getting an error saying that the underlying C++ object has been delete, I think this is due to the way dip works because it call properties methods before the actual Qt4 widget as been created when I pass an initial value in the constructor. When I construct the object with properties initial values and the use the properties accesors to set the value, this doens't happen. So, my question is, which is the right way to construct a custom composite widget with dip? # dip imports from dip.model import Model, Instance, Str # PyQt4 imports from PyQt4 import QtCore, QtGui class Indicator(QtGui.QToolButton, Model): # the indicator identifier, it must be unique for all indicators id = Str() # the indicator text, this text will be shown # beside the icon if one is defined text = Str() # the indicator tooltip tooltip = Str() # the indicator icon icon = Instance(QtGui.QIcon) @id.getter def id(self): print 'getting value' return self.objectName() @id.setter def id(self, id): print 'setting value' self.setObjectName(id) @text.getter def text(self): return self.text() @text.setter def text(self, text): self.setText(text) @tooltip.getter def tooltip(self): return self.toolTip() @tooltip.setter def tooltip(self, tooltip): self.setToolTip(tooltip) @icon.getter def icon(self): return self.icon() @icon.setter def icon(self, icon): self.icon = icon def perform(self): raise NotImplementedError if __name__ == '__main__': app = QtGui.QApplication([]) i = Indicator(text='xxx') i.show() app.exec_() -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] help with dip and PyQt4 widgets
Have you seen the discussion at http://www.riverbankcomputing.co.uk/static/Docs/dip/ui_tutorial.html#creating-views-programmatically , or http://www.riverbankcomputing.co.uk/static/Docs/dip/ui_tutorial.html#creating-views-with-qt-designer ? On Fri, Jul 8, 2011 at 1:19 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: but the view will need to be pure pyqt, not dip? On Fri, Jul 8, 2011 at 1:13 PM, Darren Dale dsdal...@gmail.com wrote: Have you considered trying to decouple your model and view, as described throughout the documentation? On Fri, Jul 8, 2011 at 1:04 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: yes, I know, I read that in the docs, but, how to do something similar to what I want to achieve? On Fri, Jul 8, 2011 at 12:20 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: I tried that before and still getting the same error. I thinks is something like the C++ part of the widget is not created at the time when the properties methods are called to set my initial values as this happen before __init__ is called. On Fri, Jul 8, 2011 at 12:05 PM, Demetrius Cassidy dcassid...@gmail.com wrote: You need to call QToolButton's __init__() method. class Indicator(QtGui.QToolButton, Model): def __init__(self) super(Indicator, self).__init__() On Fri, Jul 8, 2011 at 1:49 PM, Lic. José M. Rodriguez Bacallao jmr...@gmail.com wrote: hi folks, I am creating a composite widget with PyQt4 and Dip, the problem I have is that when I use dip properties for setting PyQt4 properties in the constructor I am getting an error saying that the underlying C++ object has been delete, I think this is due to the way dip works because it call properties methods before the actual Qt4 widget as been created when I pass an initial value in the constructor. When I construct the object with properties initial values and the use the properties accesors to set the value, this doens't happen. So, my question is, which is the right way to construct a custom composite widget with dip? # dip imports from dip.model import Model, Instance, Str # PyQt4 imports from PyQt4 import QtCore, QtGui class Indicator(QtGui.QToolButton, Model): # the indicator identifier, it must be unique for all indicators id = Str() # the indicator text, this text will be shown # beside the icon if one is defined text = Str() # the indicator tooltip tooltip = Str() # the indicator icon icon = Instance(QtGui.QIcon) @id.getter def id(self): print 'getting value' return self.objectName() @id.setter def id(self, id): print 'setting value' self.setObjectName(id) @text.getter def text(self): return self.text() @text.setter def text(self, text): self.setText(text) @tooltip.getter def tooltip(self): return self.toolTip() @tooltip.setter def tooltip(self, tooltip): self.setToolTip(tooltip) @icon.getter def icon(self): return self.icon() @icon.setter def icon(self, icon): self.icon = icon def perform(self): raise NotImplementedError if __name__ == '__main__': app = QtGui.QApplication([]) i = Indicator(text='xxx') i.show() app.exec_() -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - ___ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Lic. José M. Rodriguez Bacallao Centro de Biofisica Medica - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de
Re: [PyQt] Are QThreads compatible with python's threading.RLock?
On Sat, Jul 26, 2008 at 3:48 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Fri, 25 Jul 2008 17:41:22 -0400, Darren Dale dsdal...@gmail.com wrote: I use a library that provides rudimentary thread safety of its objects and file I/O using threading.RLock from the python standard library. Could anyone tell me if PyQt4's QThreads are compatible with these recursive locks? Other than the fact that they will both be implemented using the same OS primitives, Python's and Qt's threading know nothing about each other. I had a reason to reeducate myself on this issue again today, since I write interfaces with PyQt4 but also rely upon third-party task managers and multiprocessing pools that are implemented with Python Threads and Locks. I believe the answer to my original question is: Yes, Python's Threads will respect PyQt4's locks (QMutex, QReadWriteLock) and PyQt4's QThread will respect Python's threading.RLock. Perhaps this conclusion is obvious to everyone but me. The script that convinced me is appended. It requires argparse (part of the stdlib in python-2.7), do python test_locks.py -h for help. Any of the following shows that one of the threads waits while the other holds the lock: python test_locks.py python test_locks.py -t python test_locks.py -l python test_locks.py -t -l Whereas, if locking is disabled entirely, threading execution is no longer synchronized (as expected): python test_locks.py -d I have tested with python-2.7 and PyQT4-4.8.3 linux and wuindows. I also tested (on linux) a modified version of the script to use a combination of Thread and QThread, which also works as one would hope. If there are additional considerations I have overlooked, I would be very interested to know. Darren --- import argparse import sys from threading import RLock, Thread import time from PyQt4.QtCore import QCoreApplication, QMutex, QThread, QReadWriteLock class DummyLock(object): def acquire(self): pass def release(self): pass def __enter__(self): return self def __exit__(self, *args): pass class QLock(QMutex): def acquire(self): self.lock() def release(self): self.unlock() def __enter__(self): self.acquire() return self def __exit__(self, *args): self.release() class MyQThread(QThread): def __init__(self, id, lock): QThread.__init__(self) self.id = id self.lock = lock def run(self): for i in range(5): with self.lock: for i in range(5): print self.id time.sleep(0.1) time.sleep(0.01) class MyThread(Thread): def __init__(self, id, lock): Thread.__init__(self) self.id = id self.lock = lock def run(self): for i in range(5): with self.lock: for i in range(5): print self.id time.sleep(0.1) time.sleep(0.01) parser = argparse.ArgumentParser( description='test combinations of threads and locks' ) parser.add_argument( '-t', '--thread', action='store_const', const=MyQThread, default=MyThread, help='use QThread instead of threading.Thread' ) parser.add_argument( '-l', '--lock', action='store_const', const=QLock, default=RLock, help='use QMutex instead of threading.RLock' ) parser.add_argument( '-d', '--disable-lock', action='store_true', dest='disable_lock', help=don't use a lock of any kind ) args = parser.parse_args() if args.disable_lock: lock = DummyLock() else: lock = args.lock() thread1 = args.thread('Sid', lock) thread1.start() thread2 = args.thread('Nancy', lock) thread2.start() if args.thread is MyQThread: thread1.wait() thread2.wait() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] thoughts about dip interfaces and python abstract base classes
Hi Phil, On Mon, Mar 14, 2011 at 5:11 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Sun, 13 Mar 2011 15:01:53 -0400, Darren Dale dsdal...@gmail.com wrote: I've been learning about python's abstract base classes at http://www.python.org/dev/peps/pep-3119/ and http://docs.python.org/py3k/library/abc.html . The PEP mentions that there is considerable overlap between ABCs and interfaces, and I'm rereading the dip documentation on interfaces now. If I understand correctly, dip's implements decorator is similar (perhaps based on) python's abstract base class register class method. Is it ever the case that dip classes actually subclass a dip interface, as python classes would subclass one or more abstract base class? No (as in it's technically possible but you shouldn't do it). dip interfaces can be sub-classed to created more specific interfaces, but the only link to an implementation of the interface should be via the @implements or @adapt class decorators. Thanks for the clarification. I found this portion from the dip documentation slightly confusing: In many ways using the implements() decorator is similar to sub-classing the interface ... then there is some discussion of the strengths and weaknesses of subclassing vs using implements, so it wasn't clear to me that subclassing was actually discouraged. (Although, in context, there are no examples where an concrete implementation actually subclasses an interface). [...] It comes down to a personal philosophical choice - I much prefer interfaces to ABCs. The problem with ABCs is that they encourage putting the interface definition in the same place as a default implementation. From an architectural point of view I strongly believe that they should be kept separate. I was a bit disappointed when I read a couple years back that PEPs 245 and 246 were being rejected in favor of ABCs. I think I understand the patterns a little better now, and it seems the intent of ABCs is nearly identical to that of Interfaces. For example, PEP 3119 lists ABCs for containers and iterators which actually define the interfaces for Hashable, Iterable, Sized, Container, etc. The main differences (apart from syntax) seem to be that subclasses of an ABC can access a default implementation via the use of super(), while implementations of an Interface cannot. The ABC PEP mentions: This could be useful as an end-point for a super-call in framework using cooperative multiple-inheritance, but I see your point about how this could lead to misuse of the Interface pattern. Otherwise, there is such considerable overlap (when an ABC is truly abstract) that Interface could actually be considered an extension of ABCs that supports adaptation. Interfaces have their own problems of course - mainly the need to repeat the interface definition in an implementation. With Traits, for example, an implementation must contain a copy of the interface's attributes and methods - which is error prone. dip is better because you don't have to repeat the definition of the interface's attributes - they are injected automatically into the implementation - but you still (for the moment anyway) to have to repeat the interface's methods. I guess it would be necessary to repeat the methods either way, because they are abstract, right? At any rate, I found it interesting that, in python, ABCs (containing only abstract methods) and Interfaces are so similar that it would be possible to embrace the Interface philosophy and pattern by extending abstract base classes. It leaves me with a gut feeling that there could potentially be some long-term benefits to dip by basing Interface on this new fundamental aspect of the python standard library. Thanks for the feedback. Its always a pleasure. Cheers, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] thoughts about dip interfaces and python abstract base classes
I've been learning about python's abstract base classes at http://www.python.org/dev/peps/pep-3119/ and http://docs.python.org/py3k/library/abc.html . The PEP mentions that there is considerable overlap between ABCs and interfaces, and I'm rereading the dip documentation on interfaces now. If I understand correctly, dip's implements decorator is similar (perhaps based on) python's abstract base class register class method. Is it ever the case that dip classes actually subclass a dip interface, as python classes would subclass one or more abstract base class? Also, this morning I suggested on python-ideas a small tweak to python's builtin property which would allow an abstract properties to be declared using the decorator syntax. I thought it might be of interest to dip: import abc class Property(property): def __init__(self, *args, **kwargs): super(Property, self).__init__(*args, **kwargs) if (getattr(self.fget, '__isabstractmethod__', False) or getattr(self.fset, '__isabstractmethod__', False) or getattr(self.fdel, '__isabstractmethod__', False)): self.__isabstractmethod__ = True class C(metaclass=abc.ABCMeta): @Property @abc.abstractmethod def x(self): return 1 @x.setter @abc.abstractmethod def x(self, val): pass try: # Can't instantiate C, C.x getter and setter are abstract c=C() except TypeError as e: print(e) class D(C): @C.x.getter def x(self): return 2 try: # Can't instantiate D, the D.x setter is still abstract d=D() except TypeError as e: print(e) class E(D): @D.x.setter def x(self, val): pass # E is now instantiable print(E()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] thoughts about dip interfaces and python abstract base classes
On Sun, Mar 13, 2011 at 3:01 PM, Darren Dale dsdal...@gmail.com wrote: I've been learning about python's abstract base classes at http://www.python.org/dev/peps/pep-3119/ and http://docs.python.org/py3k/library/abc.html . The PEP mentions that there is considerable overlap between ABCs and interfaces, and I'm rereading the dip documentation on interfaces now. If I understand correctly, dip's implements decorator is similar (perhaps based on) python's abstract base class register class method. Is it ever the case that dip classes actually subclass a dip interface, as python classes would subclass one or more abstract base class? It also occurs to me that, if Interface were/is based on abstract base classes with properties and methods decorated with @abstractmethod, dip classes that actually subclass such an Interface would benefit from python's built-in checks that prevent instantiation of an object that has not overridden all the necessary methods declared in the interface: from dip.model import Interface, Str class IDownload(Interface): # The URL to download from. url = Str() @url.default @abstractmethod def url(self): pass @abstractmethod def download(self): Download the file. class Download(Model, IDownload) @IDownload.url.default def url(self): return '' def download(self): Download the file using urllib. Then if we have a class that needs to be adapted to IDownload: class FileDownloader: def __init__(self, target_file): # Save the URL for later. self.target_file = target_file def get_file(self): # Download the file self.target_file The adapt decorator could register the adapter class with the appropriate Interfaces that it identifies in FileDownloaderIDownloadAdapter's superclasses: from dip.model import adapt, Adapter, DelegatedTo @adapt(FileDownloader) class FileDownloaderIDownloadAdapter(Adapter, IDownload): This adapts FileDowloader to IDownload. url = DelegatedTo('adaptee.target_file') def download(self): Implement IDownload.download(). return self.adaptee.get_file() This way, Interfaces are more closely unified with python's abstract base classes, one can be certain that a class deriving from an interface has fully implemented it, while still benefiting from dip's adaptation. Cheers, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqt-plot
On Sun, Feb 27, 2011 at 5:43 AM, nimi pillai nimi.snowhi...@gmail.com wrote: Hi all, I am totally new to python programming and especially pyqt.. I tried to use plot in a small GUI application which should produce a new figure window when we click the push button. It works well in Windows. In Ubuntu the plot window appears only once ;ie first click. But the 'print' statements are appearing.Also the Gui window becomes active only if we close the figure window. from pylab import * import matplotlib.pyplot as plt import sys from PyQt4 import QtCore, QtGui from push import Ui_Form class Form(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_Form() self.ui.setupUi(self) QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL(clicked()), self.toplot) def toplot(self): x=[1,2,3] y=[1,2,3] figure(1) plot(x,y) show() print x print y if __name__ == __main__: app = QtGui.QApplication(sys.argv) a = Form() a.show() sys.exit(app.exec_()) Thanks in advance. The pyplot/pylab APIs are intended for scripting and interactive use, like in ipython. They are not meant for integration with a gui application running its own event loop. See http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html for an example of how to use matplotlib in a PyQt4 applitcation. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Next PyQt and SIP Releases
On Thu, Oct 14, 2010 at 8:05 AM, Darren Dale dsdal...@gmail.com wrote: On Wed, Oct 13, 2010 at 3:13 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 13 Oct 2010 11:50:21 -0400, Darren Dale dsdal...@gmail.com wrote: On Tue, Oct 12, 2010 at 8:12 AM, Phil Thompson p...@riverbankcomputing.com wrote: The current PyQt and SIP snapshots can be considered release candidates. Now is a good time to check them against your favorite applications. I just installed qt-4.7 on snow leopard, using macports (using a custom portfile with very minor changes, see http://trac.macports.org/ticket/26646). I installed the most recent sip and pyqt4 snapshots for python-2.6 and python-2.7, and then the dip snapshot. When I run the dip testsuite with either python version, it stalls and shows a dialog with a spinbox containing 10 and cancel and ok buttons. I have to give focus to this dialog box, at which point it closes, and then many more widgets are opened and closed in rapid succession. I don't recall the widgets rendering before now. Changes to the automate module are the cause of that. Here is the resulting test report: ..F...F == FAIL: test_list (tests.dip_ui.test_mapping.TestMapping) Test list attributes of a mapping. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_mapping.py, line 81, in test_list self.assertEqual(model['attr'], ['first', '2nd']) AssertionError: Lists differ: ['first', 'second'] != ['first', '2nd'] First differing element 1: second 2nd - ['first', 'second'] ? + ['first', '2nd'] ? ^ == FAIL: test_List (tests.dip_ui.test_model.TestModel) Test List attributes of a model. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_model.py, line 215, in test_List self.assertEqual(model.attr, ['first', '2nd']) AssertionError: ['first', 'second'] != ['first', '2nd'] -- Ran 247 tests in 111.221s FAILED (failures=2) It looks like the dialog issue showed up in the fifth test before the first failure. Is there a way to print a more verbose report, so in the future I can do a better job identifying which tests contain unreported issues? What you've included in the above is fine. I usually remember to run the tests before pushing to the website so, if there is still a failure, it would appear to be platform specific. I just tested the latest snapshots with python2.6 on Kubuntu Maverick. It is still possible to run the test suite without unittest2 installed for py26, it yields a long list of attribute errors rather than raising an import error during initialization. After installing unittest2, the test suite ran without errors or failures. Also, the test suite ran to completion without requiring any of the dialogs receive focus. So it appears you were right, the issues I reported look to be specific to OS X. I tried looking into this a little further, testing on OS X and windows 7, with python-3.1, Qt-4.7.1, and PyQt-4.8.2 on Windows or PyQt-4.8.1 on Mac. I discovered that the doc/examples/automate/automate_views.py example raises an error: Traceback (most recent call last): File /Users/darren/.local/lib/python3.1/site-packages/dip/automate/robot.py, line 63, in _play_commands command() File /Users/darren/.local/lib/python3.1/site-packages/dip/automate/robot_command.py, line 91, in __call__ raise AutomationError(self.ui, self.command, unsupported command) dip.automate.exceptions.AutomationError: dip.dialog:name 'enter' command: unsupported command On OS X I have to click on it to give it focus, at which point it produces the above error. I put some debug statements in robot_command.py: # Get the simulator methods from the items. print(items) for itm in items: print(1, itm, self.command) print(dir(itm)) simulate = getattr(itm, 'simulate_' + self.command, None) print(2, simulate) if simulate is not None: print(3) # Execute the command. simulate(self.delay, *self.command_args) print(4) The result of which is: [dip.ui.toolkits.qt.qlineedit_editor.QLineEditEditorIAutomatedEditorAdapter object at 0x104758350] 1
Re: [PyQt] Next PyQt and SIP Releases
On Wed, Jan 12, 2011 at 5:05 PM, Darren Dale dsdal...@gmail.com wrote: I can reproduce the test failures I reported previously in this thread on both OS X and Windows 7. I need to amend that. The failures on mac occur at different places in the same test suites. On OS X: == FAIL: test_list (tests.dip_ui.test_mapping.TestMapping) Test list attributes of a mapping. -- Traceback (most recent call last): File /Users/darren/Projects/dip/test/tests/dip_ui/test_mapping.py, line 78, in test_list self.assertEqual(model['attr'], ['first', '2nd']) AssertionError: Lists differ: ['first', 'second'] != ['first', '2nd'] == FAIL: test_List (tests.dip_ui.test_model.TestModel) Test List attributes of a model. -- Traceback (most recent call last): File /Users/darren/Projects/dip/test/tests/dip_ui/test_model.py, line 206, in test_List self.assertEqual(model.attr, ['first', '2nd']) AssertionError: ['first', 'second'] != ['first', '2nd'] -- and on windows the problems occur in test_mapping.py on line 33 in test_bool, and in test_model.py on line 58 in test_Bool (AssertionError: False is not True). Sorry for the oversight. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: PyQt v4.8.1 Released
On Mon, Nov 8, 2010 at 8:11 AM, John Posner jjpos...@optimum.net wrote: On 10/30/2010 7:47 AM, Phil Thompson wrote: PyQt v4.8.1 has been released and is available from the usual place. Over the past year, downloads from http://www.riverbankcomputing.co.uk/software/pyqt/download have been impossible for me. More precisely, the download speed starts at about 0.6KB/sec, and degrades from there. After a minute or so, I put the download out of its misery. Does anyone else experience this behavior? I just downloaded the 4.8.1 tar.gz: 10 MB in about 4 seconds. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Next PyQt and SIP Releases
On Wed, Oct 13, 2010 at 3:13 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 13 Oct 2010 11:50:21 -0400, Darren Dale dsdal...@gmail.com wrote: On Tue, Oct 12, 2010 at 8:12 AM, Phil Thompson p...@riverbankcomputing.com wrote: The current PyQt and SIP snapshots can be considered release candidates. Now is a good time to check them against your favorite applications. I just installed qt-4.7 on snow leopard, using macports (using a custom portfile with very minor changes, see http://trac.macports.org/ticket/26646). I installed the most recent sip and pyqt4 snapshots for python-2.6 and python-2.7, and then the dip snapshot. When I run the dip testsuite with either python version, it stalls and shows a dialog with a spinbox containing 10 and cancel and ok buttons. I have to give focus to this dialog box, at which point it closes, and then many more widgets are opened and closed in rapid succession. I don't recall the widgets rendering before now. Changes to the automate module are the cause of that. Here is the resulting test report: ..F...F == FAIL: test_list (tests.dip_ui.test_mapping.TestMapping) Test list attributes of a mapping. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_mapping.py, line 81, in test_list self.assertEqual(model['attr'], ['first', '2nd']) AssertionError: Lists differ: ['first', 'second'] != ['first', '2nd'] First differing element 1: second 2nd - ['first', 'second'] ? + ['first', '2nd'] ? ^ == FAIL: test_List (tests.dip_ui.test_model.TestModel) Test List attributes of a model. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_model.py, line 215, in test_List self.assertEqual(model.attr, ['first', '2nd']) AssertionError: ['first', 'second'] != ['first', '2nd'] -- Ran 247 tests in 111.221s FAILED (failures=2) It looks like the dialog issue showed up in the fifth test before the first failure. Is there a way to print a more verbose report, so in the future I can do a better job identifying which tests contain unreported issues? What you've included in the above is fine. I usually remember to run the tests before pushing to the website so, if there is still a failure, it would appear to be platform specific. I just tested the latest snapshots with python2.6 on Kubuntu Maverick. It is still possible to run the test suite without unittest2 installed for py26, it yields a long list of attribute errors rather than raising an import error during initialization. After installing unittest2, the test suite ran without errors or failures. Also, the test suite ran to completion without requiring any of the dialogs receive focus. So it appears you were right, the issues I reported look to be specific to OS X. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Next PyQt and SIP Releases
On Tue, Oct 12, 2010 at 8:12 AM, Phil Thompson p...@riverbankcomputing.com wrote: The current PyQt and SIP snapshots can be considered release candidates. Now is a good time to check them against your favorite applications. I just installed qt-4.7 on snow leopard, using macports (using a custom portfile with very minor changes, see http://trac.macports.org/ticket/26646). I installed the most recent sip and pyqt4 snapshots for python-2.6 and python-2.7, and then the dip snapshot. When I run the dip testsuite with either python version, it stalls and shows a dialog with a spinbox containing 10 and cancel and ok buttons. I have to give focus to this dialog box, at which point it closes, and then many more widgets are opened and closed in rapid succession. I don't recall the widgets rendering before now. Here is the resulting test report: ..F...F == FAIL: test_list (tests.dip_ui.test_mapping.TestMapping) Test list attributes of a mapping. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_mapping.py, line 81, in test_list self.assertEqual(model['attr'], ['first', '2nd']) AssertionError: Lists differ: ['first', 'second'] != ['first', '2nd'] First differing element 1: second 2nd - ['first', 'second'] ? + ['first', '2nd'] ?^ == FAIL: test_List (tests.dip_ui.test_model.TestModel) Test List attributes of a model. -- Traceback (most recent call last): File /Users/darren/Downloads/dip-py2-gpl-0.3-snapshot-4deec720d5c2/test/tests/dip_ui/test_model.py, line 215, in test_List self.assertEqual(model.attr, ['first', '2nd']) AssertionError: ['first', 'second'] != ['first', '2nd'] -- Ran 247 tests in 111.221s FAILED (failures=2) It looks like the dialog issue showed up in the fifth test before the first failure. Is there a way to print a more verbose report, so in the future I can do a better job identifying which tests contain unreported issues? Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt support for Qt 4.7
On Mon, Oct 4, 2010 at 8:35 AM, Jonathan Harper j...@white-walls.net wrote: I’ve been waiting for Qt 4.7 for some time now, as QFileSystemModel has a directoryLoaded signal that I need to use. I’m wondering if there is a roadmap for estimated release date for PyQt support for Qt 4.7. I’ve scoured riverbankcomputing.com, the wiki, and the web for any information and can’t find any. Am I overlooking anything, or can someone provide me with that information? Have you looked into the PyQt4-4.8 snapshots? They are posted along with the official releases. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] potential bug in PyQt4 3c67710d0c58 snapshot
I've installed last night's sip snapshot. When I try to make last night's PyQt snapshot, I get the following error: /usr/bin/g++-4.2 -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/Users/darren/Downloads/PyQt-mac-gpl-snapshot-4.8-3c67710d0c58/qpy/QtGui -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/opt/local/libexec/qt4-mac-devel/mkspecs/default -I/opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers -I/opt/local/libexec/qt4-mac-devel/lib/QtCore.framework/Headers -I/opt/local/libexec/qt4-mac-devel/include -F/Users/darren/Downloads/PyQt-mac-gpl-snapshot-4.8-3c67710d0c58/qpy/QtGui -F/opt/local/libexec/qt4-mac-devel/lib -o sipQtGuiQTextOptionTab.o sipQtGuiQTextOptionTab.cpp sipQtGuiQTextOptionTab.cpp: In function ‘void* init_QTextOption_Tab(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’: sipQtGuiQTextOptionTab.cpp:206: error: no matching function for call to ‘QTextOption::Tab::Tab(qreal, QTextOption::TabType, QChar)’ /opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers/qtextoption.h:70: note: candidates are: QTextOption::Tab::Tab() /opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers/qtextoption.h:69: note: QTextOption::Tab::Tab(const QTextOption::Tab) make[1]: *** [sipQtGuiQTextOptionTab.o] Error 1 make: *** [all] Error 2 This is on a 64-bit SnowLeopard machine. Previous snapshots had built ok. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] potential bug in PyQt4 3c67710d0c58 snapshot
On Fri, Oct 1, 2010 at 9:16 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Fri, 1 Oct 2010 09:02:46 -0400, Darren Dale dsdal...@gmail.com wrote: I've installed last night's sip snapshot. When I try to make last night's PyQt snapshot, I get the following error: /usr/bin/g++-4.2 -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/Users/darren/Downloads/PyQt-mac-gpl-snapshot-4.8-3c67710d0c58/qpy/QtGui -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/opt/local/libexec/qt4-mac-devel/mkspecs/default -I/opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers -I/opt/local/libexec/qt4-mac-devel/lib/QtCore.framework/Headers -I/opt/local/libexec/qt4-mac-devel/include -F/Users/darren/Downloads/PyQt-mac-gpl-snapshot-4.8-3c67710d0c58/qpy/QtGui -F/opt/local/libexec/qt4-mac-devel/lib -o sipQtGuiQTextOptionTab.o sipQtGuiQTextOptionTab.cpp sipQtGuiQTextOptionTab.cpp: In function ‘void* init_QTextOption_Tab(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’: sipQtGuiQTextOptionTab.cpp:206: error: no matching function for call to ‘QTextOption::Tab::Tab(qreal, QTextOption::TabType, QChar)’ /opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers/qtextoption.h:70: note: candidates are: QTextOption::Tab::Tab() /opt/local/libexec/qt4-mac-devel/lib/QtGui.framework/Headers/qtextoption.h:69: note: QTextOption::Tab::Tab(const QTextOption::Tab) make[1]: *** [sipQtGuiQTextOptionTab.o] Error 1 make: *** [all] Error 2 This is on a 64-bit SnowLeopard machine. Previous snapshots had built ok. That method was added in Qt v4.7. It looks like (somehow) configure.py has detected Qt v4.7 but it is building against an earlier version. Ah, right. sorry for the noise. I hadn't noticed that MacPorts had not upgraded their qt4-mac-devel ports from the 4.7 beta release. That must be the problem. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] trouble installing pyqt4 from source on fedora 13
I just upgraded the OS on a computer at work to fedora 13, and I am attempting to install sip and pyqt4 from source (since the versions provided by the package manager are surprisingly out of date.) When I run python configure.py, I get the following: --- Determining the layout of your Qt installation... Error: Qt has been built as static libraries so either the -g or -k argument should be used. --- I don't think this is accurate. I have installed the qt-devel package (4.6.3-8fc13.x86_64), and my /usr/lib64 contains the libQt*.so files for all the .so files I expected to see. Here are the contents of qtdirs.out: --- /usr/lib64/qt4 /usr/include /usr/lib64 /usr/lib64/qt4/bin /usr/lib64/qt4 /usr/lib64/qt4/plugins 263683 1048575 Open Source PyQt_NoPrintRangeBug --- Could anyone suggest what I've overlooked? According to http://rpm.pbone.net/index.php3/stat/4/idpl/14306102/dir/fedora_13/com/qt-4.6.3-8.fc13.x86_64.rpm.html , the packages I have installed should have provided the shared libraries, but I must be missing something. Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] trouble installing pyqt4 from source on fedora 13
On Thu, Sep 30, 2010 at 10:33 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Thu, 30 Sep 2010 10:16:27 -0400, Darren Dale dsdal...@gmail.com wrote: I just upgraded the OS on a computer at work to fedora 13, and I am attempting to install sip and pyqt4 from source (since the versions provided by the package manager are surprisingly out of date.) When I run python configure.py, I get the following: --- Determining the layout of your Qt installation... Error: Qt has been built as static libraries so either the -g or -k argument should be used. --- I don't think this is accurate. I have installed the qt-devel package (4.6.3-8fc13.x86_64), and my /usr/lib64 contains the libQt*.so files for all the .so files I expected to see. Here are the contents of qtdirs.out: --- /usr/lib64/qt4 /usr/include /usr/lib64 /usr/lib64/qt4/bin /usr/lib64/qt4 /usr/lib64/qt4/plugins 263683 1048575 Open Source PyQt_NoPrintRangeBug --- Could anyone suggest what I've overlooked? According to http://rpm.pbone.net/index.php3/stat/4/idpl/14306102/dir/fedora_13/com/qt-4.6.3-8.fc13.x86_64.rpm.html , the packages I have installed should have provided the shared libraries, but I must be missing something. configure.py is checking to see if QT_SHARED is defined (the blank line in the output implies it is not). The .pro it creates for qtdirs contains a workaround for certain broken distros to make sure it is set properly. Maybe the workaround no longer works. I found some bug reports/discussion that might be relevant: http://bugreports.qt.nokia.com/browse/QTBUG-2098 http://bugreports.qt.nokia.com/browse/QTBUG-9110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel from https://svn.zib.de/lenne3d/tools/cmake/2.4.5/Modules/FindQt4.cmake : # warning currently only qconfig.pri on Windows potentially contains static # so QT_SHARED might not get defined properly on Mac/X11 (which seems harmless right now) # Trolltech said they'd consider exporting it for all platforms in future releases. I tried also to find how the fedora devs managed to patch and build pyqt in the fedora environment, but I can't find anything. Aren't they compelled by the terms of the GPL to make such patches available? Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] trouble installing pyqt4 from source on fedora 13
On Thu, Sep 30, 2010 at 12:09 PM, Baz Walter baz...@ftml.net wrote: On 30/09/10 16:24, Darren Dale wrote: I tried also to find how the fedora devs managed to patch and build pyqt in the fedora environment, but I can't find anything. Aren't they compelled by the terms of the GPL to make such patches available? any patches should be in fedora's src.rpm for pyqt, along with the .spec file for building the binary package. nb: you can extract the files from an rpm with rpm2cpio (or a gui archiver like file-roller). Thank you for that. I was able to build after applying this change: out QLibraryInfo::licensee() '\\n'; -#if defined(QT_SHARED) || defined(QT_DLL) +//#if defined(QT_SHARED) || defined(QT_DLL) out shared\\n; -#else -out \\n; -#endif +//#else +//out \\n; +//#endif Phil, it looks like QT_SHARED is somewhat fragile, or rather, it doesn't seem that the qt devs intended to support it for this particular use case. Is its use necessary in PyQt's configure.py? Based on the change required to build on Fedora, it doesn't seem so, but probably I'm overlooking its intended purpose. Darren ___ 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 Mon, Sep 27, 2010 at 2:45 PM, Gerard Vermeulen gav...@gmail.com 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) That should be super(MyWidget, self).__init__(parent). Darren ___ 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 Mon, Sep 27, 2010 at 3:02 PM, Vicente Sole s...@esrf.fr wrote: Hi Gerard, Quoting Gerard Vermeulen gav...@gmail.com: 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) Just for my information, what is the difference between: super(Qt.QWidget, self).__init__(parent) and: Qt.QWidget.__init__(self, parent) The example should have read: super(MyWidget, self).__init__(parent), not super(Qt.QWidget, self).__init__(parent). In this example, there is no difference between the two syntaxes, but in cases involving multiple inheritance, super() returns a proxy that delegates calls to the appropriate superclass, as determined by the method resolution order. More here: http://docs.python.org/library/functions.html#super Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip model types, properties, and syntax
class ExampleModel(Model): name = Str() @name.getter def name(self): return self._name I have an additional suggestion to follow up on this syntax. If a model type's __call__ method were changed to call its getter method, rather than return the default value, I think it would be possible to do: class Test(Model): foo = Str() @Str() def bar(self): return self._bar That seems like a natural extension of the syntax to me, very similar to using python's property built-in as a decorator. As things currently stand, I thought we should already be able to do: class Test(Model): foo = Str() @Str().getter def bar(self): return self._bar but for reasons I don't understand, that raises a SyntaxError. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip Snapshot Support for Python v2.6 and v2.7
On Mon, Jul 26, 2010 at 9:34 AM, Darren Dale dsdal...@gmail.com wrote: On Mon, Jul 26, 2010 at 4:00 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Sun, 25 Jul 2010 17:30:28 -0400, Darren Dale dsdal...@gmail.com wrote: On Sat, Jul 24, 2010 at 2:26 PM, Phil Thompson p...@riverbankcomputing.com wrote: The current dip snapshots now support Python v2.6 and v2.7 as well as Python v3. The API should be identical for all versions of Python. I had some trouble enabling MQ (hg qpush -a returned no patches in series), so I installed the snapshot for py26. Make sure you use qclone rather than clone. Oh, sorry. You were right, I overlooked qclone. Could I ask for clarification on how py26/py27 users should track the development branch? What I have been doing is: hg qclone http://www.riverbankcomputing.com/hg/dip hg qpush -a # the next day, attempt to sync: hg qpop -a hg pull hg update hg qpush -a # at this point, I often get error messages, like: applying dip.model.syntax applying dip.model.super applying dip.model.comprehensions applying dip.model.sipapi applying dip.model.misc applying dip.model.tests applying dip.ui.syntax unable to find 'dip/ui/robot.py' for patching 4 out of 4 hunks FAILED -- saving rejects to file dip/ui/robot.py.rej patching file dip/ui/toolkits/qt/qlistwidget_editor.py Hunk #1 FAILED at 342 1 out of 1 hunks FAILED -- saving rejects to file dip/ui/toolkits/qt/qlistwidget_editor.py.rej patching file dip/ui/toolkits/qt/qtablewidget_editor.py Hunk #1 FAILED at 414 1 out of 1 hunks FAILED -- saving rejects to file dip/ui/toolkits/qt/qtablewidget_editor.py.rej patch failed, unable to continue (try -v) patch failed, rejects left in working dir errors during apply, please fix and refresh dip.ui.syntax I don't know how to recover from these errors, so I end up deleting my clone and making a new one. Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about dip.ui MenuBar
I have a question about the menubar example at http://www.riverbankcomputing.co.uk/static/Docs/dip/ui_tutorial.html#menus . The example includes the following: - # We need a toolkit to create the widgets. toolkit = QtToolkit() # Create the main window. main_window = QMainWindow() # Create the action. exit_action = QAction(Exit, None, triggered=app.quit) # Define the action hierarchy. action_collection = ActionCollection(title=File, members=[exit_action]) # Create the factory that will create instances of the action hierarchy. menu_bar = MenuBar(action_collection) # Create an instance of the action hierarchy using QMenuBar and QMenu. qmenubar = menu_bar(toolkit) Based on its function, it looks like MenuBar could be called MenuBarFactoryFactory. Is this layer of abstraction important? Would it be possible to instead do: qmenubar = MenuBar(action_collection, toolkit=toolkit) , and also to have the toolkit kwarg default to dip.ui.QtToolkit()? Having ui factories default to QtToolkit would simplify the code for the presumably most common use case. Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: dip v0.2 Released
On Thu, Sep 9, 2010 at 4:43 AM, Phil Thompson p...@riverbankcomputing.com wrote: dip v0.2 has been released and can be downloaded from the usual place. Most changes are in response to feedback gratefully received rather than new areas of functionality. Exciting changes! May I make a suggestion for the docs at http://www.riverbankcomputing.com/static/Docs/dip/model_tutorial.html ? I think overriding setters and getters warrants a few comments, and the section on observing attributes might be reorganized a bit. I attached a patch. Cheers, Darren model-tutorial.diff Description: Binary data ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip model types, properties, and syntax
On Wed, Aug 25, 2010 at 3:00 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 25 Aug 2010 14:27:55 -0400, Darren Dale dsdal...@gmail.com wrote: On Wed, Aug 25, 2010 at 1:17 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Sat, 14 Aug 2010 08:45:13 +0100, Phil Thompson p...@riverbankcomputing.com wrote: On Mon, 9 Aug 2010 09:45:12 -0400, Darren Dale dsdal...@gmail.com wrote: I have a question about using dip model attributes as properties. The documentation at http://www.riverbankcomputing.com/static/Docs/dip/model_tutorial.html#attributes-are-properties gives an example: class ExampleModel(Model): name = Str def _get_name(self): return self._name def _set_name(self, value): self._name = value # method taken from previous section in documentation: def _default_name(self): import name_database return name_database.most_common_name() Would it be possible for dip's model types to support the property decorator syntax introduced in Python-2.6? If so, the above example could then be implemented as: class ExampleModel(Model): name = Str @name.getter def name(self): return self._name @name.setter def name(self, value): self._name = value @name.default def name(self): import name_database return name_database.most_common_name() The virtue, aside from reusing an already familiar pattern in the standard library, is that the ExampleModel namespace has fewer exposed private methods, which is desirable for models intended to be used and inspected in an interactive python environment like IPython. Hmm - interesting. It's more verbose but it is nicer. It could also support observers and allow declarative observers across classes. It may also be faster. Unfortunately I can't think of a way to implement it. The problem arises because name = Str is allowed as a shortcut for name = Str() and there doesn't seem to be a way to implement (for example) getter() so that it can cope with the different cases. Hmm. What if BaseType or ValueType did something like: @classmethod def property(cls, val): if type(val) == types.FunctionType: return property_factory(cls, getter=val) else: res = property_factory(cls, default=val) return res.getter That may let you do: class Test(model): @Str.property def name(self): return self._name or class Test(model): #provide the default: @Str.property('foo') def name(self): return self._name Is that a crazy idea? I don't like it because it doesn't follow the standard pattern you first mentioned. If we have to come up with a new pattern then I think the current one is better. Yes, I see your point. Is there any chance you would consider dropping support for the name = Str syntax? This is just my opinion, but this syntax has always seemed awkward, not very pythonic. You must have wanted an instance of this class, we'll take care of that for you is kind of magical, it's fairly unusual behavior for python. People familiar with python but new to this pattern will look at name = Str and think that attribute is a class, not an instance of the class, how are the two cases different? Since an instance is what we are eventually going to end up with anyway, and Str has to be called with parentheses when we want to specify a static default value, maybe it would be clearer if only the standard Str() were supported. Plus, it would provide an opportunity to explore the decorator syntax, which may have additional benefits. Respectfully, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip model types, properties, and syntax
On Sat, Aug 14, 2010 at 3:45 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Mon, 9 Aug 2010 09:45:12 -0400, Darren Dale dsdal...@gmail.com wrote: I have a question about using dip model attributes as properties. The documentation at http://www.riverbankcomputing.com/static/Docs/dip/model_tutorial.html#attributes-are-properties gives an example: class ExampleModel(Model): name = Str def _get_name(self): return self._name def _set_name(self, value): self._name = value # method taken from previous section in documentation: def _default_name(self): import name_database return name_database.most_common_name() Would it be possible for dip's model types to support the property decorator syntax introduced in Python-2.6? If so, the above example could then be implemented as: class ExampleModel(Model): name = Str @name.getter def name(self): return self._name @name.setter def name(self, value): self._name = value @name.default def name(self): import name_database return name_database.most_common_name() The virtue, aside from reusing an already familiar pattern in the standard library, is that the ExampleModel namespace has fewer exposed private methods, which is desirable for models intended to be used and inspected in an interactive python environment like IPython. Hmm - interesting. It's more verbose but it is nicer. It could also support observers and allow declarative observers across classes. It may also be faster. Defining new getters and setters for inherited properties would also be more verbose: class ExampleModel2(ExampleModel) # either: #...@examplemodel.name.getter # or: @super(ExampleModel2, ExampleModel2).name.getter def name(self): return self._name but then again, I might argue that it is more clear from an api standpoint. Cheers, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip model types, properties, and syntax
On Sat, Aug 14, 2010 at 8:25 AM, Darren Dale dsdal...@gmail.com wrote: On Sat, Aug 14, 2010 at 3:45 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Mon, 9 Aug 2010 09:45:12 -0400, Darren Dale dsdal...@gmail.com wrote: I have a question about using dip model attributes as properties. The documentation at http://www.riverbankcomputing.com/static/Docs/dip/model_tutorial.html#attributes-are-properties gives an example: class ExampleModel(Model): name = Str def _get_name(self): return self._name def _set_name(self, value): self._name = value # method taken from previous section in documentation: def _default_name(self): import name_database return name_database.most_common_name() Would it be possible for dip's model types to support the property decorator syntax introduced in Python-2.6? If so, the above example could then be implemented as: class ExampleModel(Model): name = Str @name.getter def name(self): return self._name @name.setter def name(self, value): self._name = value @name.default def name(self): import name_database return name_database.most_common_name() The virtue, aside from reusing an already familiar pattern in the standard library, is that the ExampleModel namespace has fewer exposed private methods, which is desirable for models intended to be used and inspected in an interactive python environment like IPython. Hmm - interesting. It's more verbose but it is nicer. It could also support observers and allow declarative observers across classes. It may also be faster. Defining new getters and setters for inherited properties would also be more verbose: class ExampleModel2(ExampleModel) # either: �...@examplemodel.name.getter # or: �...@super(ExampleModel2, ExampleModel2).name.getter def name(self): return self._name but then again, I might argue that it is more clear from an api standpoint. I should have tested more carefully. @super(ExampleModel2, ExampleModel2) will not work inside the class definition unless it appears in a method, where it will only be called after an ExampleModel2 class has already been defined. So overriding property getters, setters, and friends might look like: class ExampleModel2(ExampleModel): @ExampleModel.name.getter def name(self): return self._name # that redefines the property and binds it in the # current namespace. So now we should use the # name property from the current namespace: @name.setter def name(self, val): self._name = val Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ImportError: no module name PyQt4 (Windows 7, 64 bit)
On Mon, Aug 9, 2010 at 6:41 AM, John McCabe j...@assen.demon.co.uk wrote: Hi I've just installed PyQt4 with SIP on my PC and I'm getting the error ImportError: no module name PyQt4 when I try to run the qtdemo.pyw file in the examples folder (see below). My first thought was that my PYTHONPATH needed something adding to it, but I'm fairly new to python and wasn't sure what to put in. I tried adding the C:\Python24\Lib\site-packages folder, and the C:\Python24\Lib\site-packages\PyQt4 one, but that didn't help. Any other suggestions would be gratefully received. Thanks John C:\PyQt\PyQt-win-gpl-4.7.4\examples\demos\qtdemopython qtdemo.pyw Traceback (most recent call last): File qtdemo.pyw, line 49, in ? from PyQt4 import QtCore, QtGui ImportError: No module named PyQt4 I wasn't aware that there was a 64-bit installer for PyQt4 on windows. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] dip model types, properties, and syntax
I have a question about using dip model attributes as properties. The documentation at http://www.riverbankcomputing.com/static/Docs/dip/model_tutorial.html#attributes-are-properties gives an example: class ExampleModel(Model): name = Str def _get_name(self): return self._name def _set_name(self, value): self._name = value # method taken from previous section in documentation: def _default_name(self): import name_database return name_database.most_common_name() Would it be possible for dip's model types to support the property decorator syntax introduced in Python-2.6? If so, the above example could then be implemented as: class ExampleModel(Model): name = Str @name.getter def name(self): return self._name @name.setter def name(self, value): self._name = value @name.default def name(self): import name_database return name_database.most_common_name() The virtue, aside from reusing an already familiar pattern in the standard library, is that the ExampleModel namespace has fewer exposed private methods, which is desirable for models intended to be used and inspected in an interactive python environment like IPython. Thank you, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about dip models and dip io
On Thu, Aug 5, 2010 at 10:59 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Thu, 5 Aug 2010 10:13:27 -0400, Darren Dale dsdal...@gmail.com wrote: [...] Is there any documentation available on dynamically creating a new model type? You do it just like you would for any other Python type by calling its meta-type... from dip.model import MetaModel, Model, Int my_dynamic_type = MetaModel('MyDynamicType', (Model, ), dict(my_int_attr=Int)) my_instance = my_dynamic_type(my_int_attr=10) # This will raise an exception... my_instance.my_int_attr = 'bad' You will have to use the current dip snapshot as I hadn't exposed MetaModel as part of the dip.model in v0.1. Great, thank you! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] dip unit tests
I just noticed a problem when running the dip test suite with python-2.6 and unittest: File /Users/darren/Projects/dip/test/tests/dip_ui/test_mapping.py, line 26, in TestMapping @unittest.expectedFailure AttributeError: 'module' object has no attribute 'expectedFailure' If I install unittest2, I can run the test suite. Regards, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about dip models and dip io
At the lab where I work, we generate ascii data files that contain an hierarchy of data. The hierarchy and the contents of the table can vary. I am trying to understand if it is possible to use dip to provide an interface to such data. I was thinking that each node in the hierarchy might be accessed via a dip Model, but I need to construct the Model based on the contents of the data file. I wondered how well this might integrate with dip's design, so I made a slight change to one of the tests in the dip test suite to experiment with dynamically specifying the attributes of a model: diff -r ae63e1237a24 test/tests/dip_io/test_xml.py --- a/test/tests/dip_io/test_xml.py Mon Jul 26 09:20:08 2010 -0400 +++ b/test/tests/dip_io/test_xml.py Wed Aug 04 17:27:49 2010 -0400 @@ -142,7 +142,9 @@ Test an Instance attribute. class Klass(Model): -attr = Instance(SubModel) +#attr = Instance(SubModel) +def __init__(self, attr=None): +self.attr = attr storage = storage_factory() m_write = Klass(attr=SubModel()) However, after making this change, this test fails: ERROR: test_Instance (tests.dip_io.test_xml.TestModel) Test an Instance attribute. -- Traceback (most recent call last): File /Users/darren/Projects/dip/test/tests/dip_io/test_xml.py, line 156, in test_Instance self.assertEquals(m_read.attr.value, m_write.attr.value) AttributeError: 'NoneType' object has no attribute 'value' We work on a lot of different kinds of projects, and the experiments are constantly changing. As a result, we are unfortunately very closely tied to the details of the storage format. Still, it would be nice to have an interface that can read one format, and write another. Is this possible to do this with dip, given my unusual circumstances? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about dip plugins
The dip documentation at http://www.riverbankcomputing.com/static/Docs/dip/plugins_tutorial.html mentions: ... When a plugin requests a service the plugin manager will choose which service is actually used. The plugin does not care about the particular service, its only concern is that it has an object that implements the interface. ... I am starting work on a project that will simulate spectra based on physical reference data. There are several databases to choose from, so in a sense the task is similar to the recipe chooser example in the plugins tutorial. I would like to be able to compare the results of one recipe with the next. Is it possible for the client to request a particular service or plugin, rather than simply accept whatever the plugin manager decides to provide? Also, from the same tutorial: @implements(IPlugin) class RecipeChooserPlugin(Plugin): Why is it necessary to decorate subclasses of Plugin with @implements(IPlugin)? Are there cases when subclasses of Plugin would not implement the IPlugin interface? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip Snapshot Support for Python v2.6 and v2.7
On Mon, Jul 26, 2010 at 4:00 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Sun, 25 Jul 2010 17:30:28 -0400, Darren Dale dsdal...@gmail.com wrote: On Sat, Jul 24, 2010 at 2:26 PM, Phil Thompson p...@riverbankcomputing.com wrote: The current dip snapshots now support Python v2.6 and v2.7 as well as Python v3. The API should be identical for all versions of Python. I had some trouble enabling MQ (hg qpush -a returned no patches in series), so I installed the snapshot for py26. Make sure you use qclone rather than clone. Oh, sorry. You were right, I overlooked qclone. I ran dip-builder, and when I tried to make a distutils distribution, I got the following: File /home/darren/.local/lib/python2.6/site-packages/dip/ui/toolkits/qt/qlistwidget_editor.py, line 234 rows = list({index.row() for index in indexes}) ^ SyntaxError: invalid syntax I don't think set comprehensions are available in python2. Should be fixed now. It is. Thanks. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] dip Snapshot Support for Python v2.6 and v2.7
On Sat, Jul 24, 2010 at 2:26 PM, Phil Thompson p...@riverbankcomputing.com wrote: The current dip snapshots now support Python v2.6 and v2.7 as well as Python v3. The API should be identical for all versions of Python. I had some trouble enabling MQ (hg qpush -a returned no patches in series), so I installed the snapshot for py26. I ran dip-builder, and when I tried to make a distutils distribution, I got the following: File /home/darren/.local/lib/python2.6/site-packages/dip/ui/toolkits/qt/qlistwidget_editor.py, line 234 rows = list({index.row() for index in indexes}) ^ SyntaxError: invalid syntax I don't think set comprehensions are available in python2. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about dip observe handler
On Tue, Jul 20, 2010 at 8:50 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Mon, 19 Jul 2010 11:13:14 -0400, Darren Dale dsdal...@gmail.com wrote: On Mon, Jul 19, 2010 at 9:33 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Sun, 18 Jul 2010 18:11:15 -0400, Darren Dale dsdal...@gmail.com wrote: I am reading the dip documentation at http://www.riverbankcomputing.co.uk/static/Docs/dip/complete_example.html , and have a question about the following: dip will invoke an observe() handler when the value of an attribute is set, even if the new value is the same as the old one. We therefore use the _propagate_changes attribute to prevent possible recursion problems Why is it necessary to invoke the observe handler when the value of an attribute does not change? There are quite a few infinite-recursion workarounds in the example. If the possibility of infinite recursion is so high, perhaps by default the handler should not be invoked if the attribute value does not change, unless observe() was called with a kwarg to invoke the handler regardless? Good question. The short answer is that it was easiest for me, but (obviously) what matters is what's easier for developers using it. Perhaps the example would be easier to understand (and to develop from scratch) with such a change. The issue is to define what is meant by changed, particularly when the attribute is a class instance? Rebinding the attribute is obviously a change, but what about a change to an attribute of the instance? The last example is another slightly different use case. The way enthought supports it is documented at http://code.enthought.com/projects/traits/docs/html/traits_user_manual/notification.html#example-of-a-dynamic-notification-handler ...and what parts of this notation do you find you actually use in practice? I'm sorry, I can't provide an answer. I have been planning to port a project to ETS for over a year, but have been holding off because I am also interested in moving to python3 at the same time. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] ANN: dip v0.1 Released - An Application Development Framework for PyQt and Python v3
Are there some files missing from the plugins example? When I run main.py from the plugins example, I get: Traceback (most recent call last): File main.py, line 3, in module from recipes.plugins import RecipeChooserPlugin File /home/darren/Projects/dip/doc/examples/plugins/recipes/__init__.py, line 4, in module from .i_recipe_chooser import IRecipeChooser File /home/darren/Projects/dip/doc/examples/plugins/recipes/i_recipe_chooser.py, line 3, in module from stock import IStockLevels ImportError: No module named stock I think there may be two issues: the stock module/package is not included in the sources/hg repo, and an absolute import is being used rather than a relative import: $ grep -r StockLevels . ./recipes/plugins/recipe_chooser_plugin.py:from stock import IStockLevels ./recipes/plugins/recipe_chooser_plugin.py:stock_levels = self.service(IStockLevels) ./recipes/i_recipe_chooser.py:from stock import IStockLevels ./recipes/i_recipe_chooser.py:stock_levels = Instance(IStockLevels) Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about dip observe handler
On Mon, Jul 19, 2010 at 9:33 AM, Phil Thompson p...@riverbankcomputing.com wrote: On Sun, 18 Jul 2010 18:11:15 -0400, Darren Dale dsdal...@gmail.com wrote: I am reading the dip documentation at http://www.riverbankcomputing.co.uk/static/Docs/dip/complete_example.html , and have a question about the following: dip will invoke an observe() handler when the value of an attribute is set, even if the new value is the same as the old one. We therefore use the _propagate_changes attribute to prevent possible recursion problems Why is it necessary to invoke the observe handler when the value of an attribute does not change? There are quite a few infinite-recursion workarounds in the example. If the possibility of infinite recursion is so high, perhaps by default the handler should not be invoked if the attribute value does not change, unless observe() was called with a kwarg to invoke the handler regardless? Good question. The short answer is that it was easiest for me, but (obviously) what matters is what's easier for developers using it. Perhaps the example would be easier to understand (and to develop from scratch) with such a change. The issue is to define what is meant by changed, particularly when the attribute is a class instance? Rebinding the attribute is obviously a change, but what about a change to an attribute of the instance? The last example is another slightly different use case. The way enthought supports it is documented at http://code.enthought.com/projects/traits/docs/html/traits_user_manual/notification.html#example-of-a-dynamic-notification-handler . Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about dip observe handler
I am reading the dip documentation at http://www.riverbankcomputing.co.uk/static/Docs/dip/complete_example.html , and have a question about the following: dip will invoke an observe() handler when the value of an attribute is set, even if the new value is the same as the old one. We therefore use the _propagate_changes attribute to prevent possible recursion problems Why is it necessary to invoke the observe handler when the value of an attribute does not change? There are quite a few infinite-recursion workarounds in the example. If the possibility of infinite recursion is so high, perhaps by default the handler should not be invoked if the attribute value does not change, unless observe() was called with a kwarg to invoke the handler regardless? Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about size hints
On Sun, May 2, 2010 at 1:51 AM, Yao Ko ko...@raptr.com wrote: On Sat, May 1, 2010 at 5:47 AM, Darren Dale dsdal...@gmail.com wrote: Please excuse me for bumping. Does anyone have a suggestion? On Sun, Apr 18, 2010 at 12:42 PM, Darren Dale dsdal...@gmail.com wrote: I have a question about size hints that can be illustrated with the simple example below. If I create my Test widget so it returns a size hint of (200,100), it is rendered with a size of 200, 100. If I create Test so it is 100x70, it is rendered to be 200x100. If I create test to be 1000x700, it is rendered to be 853x533 (my screen resolution is 1280x800). If I set the size policy to be fixed, then the central widget size policy is respected, but I can't resize the window. How can I make m respect the size hint of the central widget, but still maintain the ability to resize the window? Thank you, Darren import sys from PyQt4 import QtCore, QtGui class Test(QtGui.QWidget): def __init__(self, width, height): QtGui.QWidget.__init__(self) #self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) print 'Central widget should have width=%d, height=%d' %(width, height) self._width = width self._height = height def sizeHint(self): return QtCore.QSize(self._width, self._height) app = QtGui.QApplication([]) m = QtGui.QMainWindow() c = Test(1000, 700) m.setCentralWidget(c) m.show() s = c.size() print 'but central widget has width=%d, height=%d'% (s.width(), s.height()) sys.exit(app.exec_()) Have you tried to set the size policy to: ... class Test(QtGui.QWidget): ... self.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) ... The Test widget will have the minimum size specified by the sizeHint, and yet the MainWindow can still grow. Thank you for the suggestion. I actually had tried that, but it is unfortunately not an acceptable solution because I need to allow the user to make the size smaller than the original specification. The exact use case is defining a plot canvas in matplotlib. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about size hints
I have a question about size hints that can be illustrated with the simple example below. If I create my Test widget so it returns a size hint of (200,100), it is rendered with a size of 200, 100. If I create Test so it is 100x70, it is rendered to be 200x100. If I create test to be 1000x700, it is rendered to be 853x533 (my screen resolution is 1280x800). If I set the size policy to be fixed, then the central widget size policy is respected, but I can't resize the window. How can I make m respect the size hint of the central widget, but still maintain the ability to resize the window? Thank you, Darren import sys from PyQt4 import QtCore, QtGui class Test(QtGui.QWidget): def __init__(self, width, height): QtGui.QWidget.__init__(self) #self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) print 'Central widget should have width=%d, height=%d' %(width, height) self._width = width self._height = height def sizeHint(self): return QtCore.QSize(self._width, self._height) app = QtGui.QApplication([]) m = QtGui.QMainWindow() c = Test(1000, 700) m.setCentralWidget(c) m.show() s = c.size() print 'but central widget has width=%d, height=%d'% (s.width(), s.height()) sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Problem in installing PyQt on Mac OS X 10.6.2
On Mon, Apr 5, 2010 at 11:09 AM, Jebagnana Das jebagnana...@gmail.com wrote: Hi all, I found an archived discussion regarding the same problem. Click here to see the discussion. But the solution proposed here is bit confusing. I hope this issue must have been fixed by now(It was posted on Nov 2009). Anybody have the new solution of installing pyqt 0n mac os x 10.6.2?? Try here: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg19680.html ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] 64 bits and Snow Leopard make me crazy
On Thu, Feb 25, 2010 at 8:33 AM, Massimo Di Stefano massimodisa...@yahoo.it wrote: Hi You need the 64bit version of Qt (cocoa) This assumes a 64-bit python-3 installation. How was python installed? My understanding is that the universal Mac binaries provided at python.org do not include support for x86_64. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Need help installing PyQt on Snow Leopard
On Fri, Dec 18, 2009 at 10:33 PM, Bruce Anderson bruce...@rogers.com wrote: Thanks, Darren - That's a good start, and I can try to follow that. My first challenge is getting back to the 64 bit python. (By the way, is there a way to tell, once I have it, whether it is 32 bit or 64 bit?) I guess import sys; print sys.maxint should tell you. It will return 9223372036854775807 for 64 bit and 2147483647 for 32 bit. Macport sounds like a WONDERFUL idea! I agree its a good idea, but is it a good solution in practice? There may be downsides to using macports, for example if you have to install something from source that has depends on other packages which you installed with macports, will you know how to proceed? When I first started using mac about month ago I asked on this mailing list about good practices and at one point the conversation turned into a discussion on the merits of Fink and macports. Someone suggested I try to do things The Mac Way for a while before embracing Fink or Macports. I think that was good advice, I learned and tried to make people aware of what I perceived to be important pitfalls and workarounds. I also learned that what I missed most, having come from gentoo linux, was the package manager that helps me keep all of the open-source software I use up to date. I noticed your comments were prefaced with if you are not using macports... I have just installed it, but want to do some sanity checks before I start trashing my system. I did a SEARCH and found Python26 - but there is no reference to it being 32 or 64 bit - how do I know it is the 'right' (64 bit) one? check sys.maxint. If I understand your notes below, I should macport qt4-mac-devel because the qt4-mac is actually 4.5.3 and the one I really want is 4.6.0? I think py26-pyqt4 depends on the qt4-mac port, which I could not get to build (probably because I have plenty of cores on my machine, and it does a parallel build which can sometimes lead to missing symbols errors in my experience with gentoo.) So you can't just port install qt4-mac-devel py26-pyqt4, you have to copy the qt4-mac-devel directory from the macports repository and save it in your local repository as qt4-mac (don't forget to change the name in the Portfile). See the macports documentation for details on how to deal with local repositories. I notice that there is also a py26-sip that macport found - I assume that is the right one to install after python. Yes, but I think port install py26-pyqt4 will pull that in for you. I also found a macport for py26-pyqt4. Will macport'ing this complete the installation? (i.e. replace the instructions you gave below?) It should. Sorry to ask so many dumb questions, but the environment is still a bit alien to me. It's ok, but lets try not to spam the list with discussion about OS X and macports if it is not directly related to PyQt. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Need help installing PyQt on Snow Leopard
Hi Bruce, On Fri, Dec 18, 2009 at 4:43 PM, Bruce Anderson bruce...@rogers.com wrote: I tired the standard instructions from Mark Summerfield's book. Failed - 64 bit vs 32 bit. I successfully installed a new version of Python (2.6.4), the XCode from the install disk, Qt (Carbon, I think - 32 bit?), and SIP. Only PyQt failed. If you installed python-2.6.4 from a binary distributed by python.org, then that is probably the source of the problem. Their mac binaries do not support 64 bits at the time of this writing. I suggest either using the python that ships with snow leopard or using macports, depending on your preference. Then I found Darren Dale's note from Dec 2nd and tried the .dmg that he referenced. (Cocoa? - 64 bit) That failed too. I've confirmed that PyQt has not been successfully installed, but at this point, I don't know what kind of a mess I've left my machine in. Do I have to worry about having two versions of Qt on my machine? NOTE: I've been in the PC world for decades, but have only been in the MAC world since Thursday - so I don't really know my way around yet. I have two very explicit questions: 1) Can anyone post clear instructions (step by step, including where to put things) on how to get PyQt working for the first time on Snow Leopard (10.6.1 is what I have). I don't have time to spell out each step. Here is what I can offer if you are not using macports or fink: * for now, use the python installed by snow leopard, not the binaries distributed at python.org * 64-bit Qt binary: http://download.qt.nokia.com/qt/source/qt-mac-cocoa-opensource-4.6.0.dmg SIP: python configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk PyQt: export QTDIR=/Developer/Applications/Qt python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch=x86_64 I've also added the following to my ~/.profile, which distutils respects when compiling extensions (this is probably not terribly relevant to PyQt4): export ARCHFLAGS=-arch x86_64 I don't have experience with Fink, but as of a few days ago I cleaned out my system and am now using macports. I am not advocating this approach, since I don't have enough experience with macports to provide an informed opinion. But for the record, I made a local port repository and copied the portfile for qt4-mac-devel (which provides qt-4.6.0 with support for cocoa) and saved it as qt4-mac (the qt4-mac port provided by macports should provide qt-4.5.3 but I ran into a compilation problem with that version: http://trac.macports.org/ticket/22926). PyQt4 appears to be working with this installation method. 2) Do I have to worry about any messes left behind by the failed install attempts? Does the new install just clean it up? If YES, how do I go about finding the things I have to clean up? I think the Qt installs probably overwrote each other. But you might want to delete the old Qt installation (move the folders to the trash) and reinstall if you continue to have problems. I dont think this should be necessary. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Install script for Python applications
On Sat, Dec 12, 2009 at 9:52 AM, Lukas Hetzenecker l...@gmx.at wrote: Hello, thank you for your quick answer. But I don't quite understand distutils. Did you read the documentation at http://docs.python.org/distutils/index.html ? At the beginning i have some fundamental questions: - Should whole applications also be installed in /usr/lib/python2.6/site-packages ? That is generally where distutils will put it, unless the user who runs setup.py tells distutils to install it somewhere else by setting some install flags. - Should the wrapper script only execute the main python file in /usr/lib/python2.6/site-packages/name/name.py or should I copy this file to /usr/[local]/bin? If name/name.py is a module, you should write a wrapper script that calls it, and declare the script to distutils. Then the script will be installed to the proper location, and the proper location can be overridden by the user if necessary by passing install flags. - Where should I place the language files (app_de.qm and qt_de.qm) ? I'm not familiar with language files. If they are only needed at buildtime, and not runtime, there is no need to install them at all. Otherwise, you may need to experiment. - What is the standard path for data files? /usr/share/application ? I guess depends where the python executable is installed, and also details of the installation. Usually it is /usr/share, but it might be /usr/local/share, or ~/.local/share, or ~/Library/share. The user can pass --user or --prefix flags to the install command to specify where it should be installed. I think many packages just install the data files along with the package itself (for example in site-packages) And now to distutils... I have this folder structure: series60-remote-0.4 pc devices __init__.py series60.py window __init__.py about.py chat.py history.py ... series60-remote.py lib __init__.py status_numbers.py mobile mobile.py series60-remote.sis Is it possible to say distutils that it should copy these files to the following locations: /usr/lib/python2.6/site-packages series60-remote lib __init__.py status_numbers.py devices __init__.py series60.py window __init__.py about.py chat.py history.py ... series60-remote.py yes /usr/share/series60-remote series60-remote.sis I think so, but I've been installing the data files as part of the package. /usr/bin series60-remote yes Please note that the root folder isn't pc, but series60-remote when it is installed. I don't think this is a problem. You probably just need to specify the package_dir to distutils how your tree is organized. I have the main python file pc/series60-remote.py. is it possible to tell distutils that it should look in this file and find all modules that it needs and copy these to /usr/lib/python2.6/site-packages? If I understand your question: no distutils does not attempt to determine what packages to include in your distribution by inspecting some main file. You declare what packages or modules to include. I suggest reading the distutils documentation at http://docs.python.org/distutils/index.html before asking for additional help. Darren ___ 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] PyQt Licensing Issue
On Tue, Dec 8, 2009 at 8:14 AM, Giovanni Bajo ra...@develer.com wrote: On Tue, 08 Dec 2009 12:25:15 +, Phil Thompson p...@riverbankcomputing.com wrote: On Tue, 8 Dec 2009 17:46:20 +0530 (IST), Prashant Saxena animator...@yahoo.com wrote: Hi, I am planning to release the beta version(Testing) of an application written using python+PyQt. I won't be including the source code with the installation. Do I have to purchase the PyQt commercial license now itself or I can purchase before releasing the commercial version. It'll surely take 2-3 months before I reach to final version and releasing the commercial version is purely based on the users opinion and success. You need commercial licenses before you distribute your application to your users for the first time - not when you release the final version. As for Qt, the commercial license explicitly forbids relicensing of existing GPL/LGPL code (even if you own the copyright). So basically Nokia requires that you buy a commercial license at the beginning of development, not at release time. Right, see http://qt.nokia.com/products/licensing : You must purchase a Qt Commercial Developer License from us or from one of our authorized resellers before you start developing commercial software. The Qt Commercial Developer License does not allow the incorporation of code developed with the Qt GNU LGPL v. 2.1 or GNU GPL v. 3.0 license versions into a commercial product. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] suggestion for installing 64-bit Qt-4.6.0 on Snow Leopard
For anyone interested in installing 64-bit qt-4.6.0 on Snow Leopard, it looks like the download at http://qt.nokia.com/downloads is 32-bit. After a bit of digging, I found an alternative installer at http://download.qt.nokia.com/qt/source/qt-mac-cocoa-opensource-4.6.0.dmg which installs a 64-bit library that appears to be compatible with PyQt4 and the 64-bit system python. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Unable to install on Mac Snow Leopard
On Wed, Nov 25, 2009 at 2:58 AM, Antonio Valentino antonio.valent...@tiscali.it wrote: Hi Darren, Il giorno Mon, 23 Nov 2009 21:42:37 -0500 Darren Dale dsdal...@gmail.com ha scritto: On Mon, Nov 23, 2009 at 8:25 PM, Kareem Yusuf koyu...@gmail.com wrote: When I try to install PyQt, and run Make I get the following error ... In file included from /Library/Frameworks/QtCore.framework/Headers/qmetatype.h:45, from /Library/Frameworks/QtCore.framework/Headers/QMetaType:1, from sipAPIQtCore.h:40, from sipQtCorecmodule.cpp:34: /Library/Frameworks/QtCore.framework/Headers/qglobal.h:288:2: error: #error You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration. make[1]: *** [sipQtCorecmodule.o] Error 1 make: *** [all] Error 2 I had read some of the threads that suggested that some fixes had been placed into the latest dev snapshot, which I am using. However still getting the same problem. Please advise. I just installed everything this morning on snow leopard without any problems. I installed the Qt release candidate binary, and then the most recent stable releases of sip and pyqt from sources. in the last few days there was more than one thread discussing PyQt installation on Snow Leopard but I'm still unable to get it running. In my case the error happens at import time (I can't provide details since I'm not on my macbook right now). Please can you provide more details on installation procedure you used? Which version of Qt 4.6 RC did you used? Cocoa? 32 or 64 bits? In this case did you still use the -arch=i386 flag? Release candidate 1, 64 bits cocoa. I did not use -arch=i386, as I am using the system python which is 64 bit. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Unable to install on Mac Snow Leopard
On Wed, Nov 25, 2009 at 11:36 AM, Antonio Valentino antonio.valent...@tiscali.it wrote: Il giorno Wed, 25 Nov 2009 07:31:44 -0500 Darren Dale dsdal...@gmail.com ha scritto: On Wed, Nov 25, 2009 at 2:58 AM, Antonio Valentino antonio.valent...@tiscali.it wrote: Hi Darren, Il giorno Mon, 23 Nov 2009 21:42:37 -0500 Darren Dale dsdal...@gmail.com ha scritto: I just installed everything this morning on snow leopard without any problems. I installed the Qt release candidate binary, and then the most recent stable releases of sip and pyqt from sources. in the last few days there was more than one thread discussing PyQt installation on Snow Leopard but I'm still unable to get it running. In my case the error happens at import time (I can't provide details since I'm not on my macbook right now). Please can you provide more details on installation procedure you used? Which version of Qt 4.6 RC did you used? Cocoa? 32 or 64 bits? In this case did you still use the -arch=i386 flag? Release candidate 1, 64 bits cocoa. I did not use -arch=i386, as I am using the system python which is 64 bit. Thank you very much Darren. I will try it tonight. Just a last question: did you had problems with the installation bug mentioned in http://doc.qt.nokia.com/4.6-snapshot/known-issues.html ? No, I don't remember running into that problem. My mac is a brand new machine, and installing Qt and PyQt were practically the first things I did with it, so I might have forgotten. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Unable to install on Mac Snow Leopard
On Mon, Nov 23, 2009 at 8:25 PM, Kareem Yusuf koyu...@gmail.com wrote: When I try to install PyQt, and run Make I get the following error ... In file included from /Library/Frameworks/QtCore.framework/Headers/qmetatype.h:45, from /Library/Frameworks/QtCore.framework/Headers/QMetaType:1, from sipAPIQtCore.h:40, from sipQtCorecmodule.cpp:34: /Library/Frameworks/QtCore.framework/Headers/qglobal.h:288:2: error: #error You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration. make[1]: *** [sipQtCorecmodule.o] Error 1 make: *** [all] Error 2 I had read some of the threads that suggested that some fixes had been placed into the latest dev snapshot, which I am using. However still getting the same problem. Please advise. I just installed everything this morning on snow leopard without any problems. I installed the Qt release candidate binary, and then the most recent stable releases of sip and pyqt from sources. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] newbie questions...
On Thu, Aug 14, 2008 at 3:59 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Tue, 12 Aug 2008 20:31:37 +0100, Chris Withers ch...@simplistix.co.uk wrote: Phil Thompson wrote: That seems weird to put it politely. I would have thought they both had the same interfaces? It's not a technical limitation. It is to prevent people developing a commercial product with the GPL version and then switching to the commercial version at the last minute. The PyQt commercial license has the same restriction. In reality we would be open to discussion (usually involving backdating the purchase of the commercial licenses). Heh, I'd *love* to see this one come to court ;-) Seriously, I'm all for licensing that sees companies rewarded for their hard work, but I'd be seriously interested in how this would be argued in court... Thankfully all the stuff I'm developing is open source, so I don't have that problem :-) Anyway, some questions: - where do I get the Qt Designer from? It's part of Qt. Is this Qt for Java or Qt for C++? Which one do I install? Certainly Qt for C++, probably both. - how come PyQt4 isn't on PyPI? (Nowadays I'm used to just specifying packages as egg requirements in a buildout.cfg (http://buildout.zope.org/) but I guess I can't do that with PyQt4?) PyPI is a PIA to use when you are not using eggs. Okay, let me rephrase: how come PyQt4 isn't available as an egg? (for the record, I hate eggs, but the python community has adopted them, so I'm just attempting to put up and shut up. zc.buildout does offer some analgesic for the agony) It's never seemed important. I distribute a GPL package that depends on PyQt4 and PyMca, and the latter depends on PyQwt. PyQwt has had a hard time keeping abreast of recent changes in sip/PyQt4. This causes problems for my users when, for example, ubuntu upgrades their version of sip/PyQt4 and breaks pyqwt in their own package manager. It might be useful if packages like sip/PyQt and PyQwt used the standard python distribution utilities. For example, if distutils were used to create source distributions and installers that were then posted at PyPI, it would be possible to use pip/easy_install to install the whole stack with a single command. The utilities in Distribute/setuptools/PEP-390 could be used to specify version requirements. I could specify that my package depends on =pyqwt-5.2.0, pyqwt-5.2.0 would specify its own dependencies, and so on. My understanding is that multiversion support with eggs would help prevent version incompatibilities, but I don't have practical experience. I'm also not sure that distutils is up to the job of building PyQt. Yes, that could undermine the whole approach. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about installation best practices on OS X
On Tue, Oct 20, 2009 at 10:02 AM, Darren Dale dsdal...@gmail.com wrote: On Mon, Oct 19, 2009 at 9:50 PM, William Kyngesburye wokl...@kyngchaos.com wrote: Hmm, Macports. It's great for those who want a familiar packagae-manager setup or just don't want to get their fingers dirty compiling source. I'm quite comfortable compiling from source. The value I find in a package manager is 1) keeping up with software upgrades and 2) making it easier for people who use my own software to get up and running, many of whom think it is unreasonable to download and install 10 prerequisites to do so. It adds itself to your PATH and can cause trouble for non-Macports builds (getting wrong versions of tools in the system, like GNU vs. BSD versions, wrong libs linked). I don't mean to start a debate over it, just pointing out that you might want to look at trying to do things the Mac way first, like installers where available. Python does have up-to-date installers for a more Mac-standard Python framework install. I appreciate the comment, and decided to not use a package manager for the time being and try to get comfortable with the Mac way. Following up on my original post, I installed python-2.6.3 using the installer at python.org, which installed into /Library/Frameworks/ and automatically prepended /Library/Frameworks/Python.framework/Versions/2.6/bin to my path in ~/.profile. With this configuration, when I install PyQt4, pyuic4 etc end up on the path. There was no need for passing additional arguments to configure.py. I found some other issues related to using the system python (/Library/Python/2.6/site-packages appearing late in PYTHONPATH, so system-provided packages like numpy-1.2.1 are favored over manually installed packages like numpy-1.3), so it looks like it is a good idea to not use the system python. I don't want to turn this into a forum to air general mac issues, but I have to qualify that last remark. The mac installers distributed by python.org do not appear to support a 64 bit environment. So I am back to using the system python. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about installation best practices on OS X
Excellent, thank you for the pointer. May I request a feature? Could this be mentioned somewhere in the mac README? Or would it be possible to add some logic to the mac installation scripts to find where distutils installs packages by default? Darren On Sun, Oct 18, 2009 at 11:04 PM, William Kyngesburye wokl...@kyngchaos.com wrote: By default (as you've noticed), SIP and PyQt install their binary executables in the framework. This is fine for the python.org Python, but installing in the system frameworks is not quite proper. What I do for SIP and PyQt and the system python is specify a custom bin (and site-packages and other files) location in configuration: SIP: python configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch=i386 -s MacOSX10.6.sdk PyQt: export QTDIR=/Developer/Applications/Qt python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch=i386 On Oct 18, 2009, at 8:29 PM, Darren Dale wrote: I just recently started working with OS X, and was wondering if someone could point me to some discussion about best practices for installing Qt and PyQt. For example, today I installed the Qt-4.6 beta dmg, but was surprised that symlinks to tools like designer were not created on the path. Likewise, I installed the most recent sip and PyQt4 snapshots, and after installing I was surprised that I could not find utilities like pyuic4 on the path. I'm using the python that shipped with snow leopard (2.6.1), and packages using distutils, like numpy, scipy, matplotlib, Distribute and nose, all installed to /Library/Python/2.6/site-packages, which I guess is where I want them, as opposed to /System/Library/Frameworks/... but I think sip and PyQt4 installed into Frameworks. Is this intentional? Any advice from seasoned os x veterans? Thanks, Darren ___ PyQt mailing list p...@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt - William Kyngesburye kyngchaos*at*kyngchaos*dot*com http://www.kyngchaos.com/ All generalizations are dangerous, even this one. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] question about installation best practices on OS X
On Mon, Oct 19, 2009 at 6:55 PM, Robert Bobbson rbobb...@yahoo.com wrote: One thing you are going to find out is that Apple isn't the quickest on the draw with updating things like Python. It's only recently that they made a move to anything near the 2.6 line, so I have long since given up on using the stock python if I'm interested in being up to date version-wise. With some reservation, I'll recommend using something like macports to manage these things as they are maintained up to date, and it takes care of dependencies and other fun things like library paths, etc. MacPorts sets things up in /opt. The reason for the reservation is that at the time I built PyQt and all the supporting packages, none of them appeared to have a binary version available for Snow Leopard (this was ~2 weeks ago now). So, that meant the source had to be downloaded and built from scratch. That took about 12 hours on a 2 year old MacBook Pro. That didn't include the hour or two of tweaking the source packages to get around some errors and warnings that were slowing down the process even further. It brought back warm fuzzy feelings for the Gentoo box that I just retired a little while ago. As those source only options are replaced with binary packages, you should see install performance comparable to Debian/Ubuntu/RedHat and their package management tools, with all the corresponding benefits of having a framework keep track of versions and dependencies. Even if you don't use macports for pyqt, you might consider it for managing a whole slew of other apps, just like you would on a linux box or a windows+cygwin box. Thanks for the suggestion. I have been using Gentoo for about 5 years and Ubuntu for 2, and am trying macports now. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about installation best practices on OS X
I just recently started working with OS X, and was wondering if someone could point me to some discussion about best practices for installing Qt and PyQt. For example, today I installed the Qt-4.6 beta dmg, but was surprised that symlinks to tools like designer were not created on the path. Likewise, I installed the most recent sip and PyQt4 snapshots, and after installing I was surprised that I could not find utilities like pyuic4 on the path. I'm using the python that shipped with snow leopard (2.6.1), and packages using distutils, like numpy, scipy, matplotlib, Distribute and nose, all installed to /Library/Python/2.6/site-packages, which I guess is where I want them, as opposed to /System/Library/Frameworks/... but I think sip and PyQt4 installed into Frameworks. Is this intentional? Any advice from seasoned os x veterans? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4
On Tue, Jul 21, 2009 at 12:06 PM, Lukas Hetzeneckerl...@gmx.at wrote: Sorry for annoying you, but I attatched a new example to this message: I've rewritten the PyQt4-example from the website to draw the Figure in a tab widget. The same happens ;) In your original post, you said: the widget in the Tab is incorrectly sized. If I embed the FigureCanvas in a QTabWidget the widget is to big, but if I put it in a QWidget it is shown correctly. Could you be more specific? What does incorrectly sized mean? What do you mean by the widget is too big, as opposed to shown correctly? Is this really a PyQt issue, or is it specific to matplotlib? If the latter we should continue the discussion on the mpl mailing list instead of cross-posting. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
On Tue, Jul 7, 2009 at 2:50 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hi Darren, Darren Dale dsdal...@gmail.com writes: Nice demonstration of the problem Ole. I notice that if, after resizing, I pause briefly before releasing the mouse button, the scroll bar is more likely to resize properly. The problem is much more apparent if I release the mouse button immediately after resizing or while still dragging the window edge. Unfortunately the user will not be aware of that :-( Do you count it as a bug in matplotlib, in PyQt, or in Qt? I don't know, that's why I posted here asking for help. So far we have only described what is the problem. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
Hi Ole, On Tue, Jul 7, 2009 at 11:33 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hi again, Darren Dale dsdal...@gmail.com writes: Nice demonstration of the problem Ole. I notice that if, after resizing, I pause briefly before releasing the mouse button, the scroll bar is more likely to resize properly. The problem is much more apparent if I release the mouse button immediately after resizing or while still dragging the window edge. I already created a Qt bug report for that (issue number #255433, not public for some reason). They asked me to compile a C++ only variant of the bug. However, I could not reproduce the problem in C++: the events occure here always in-order independent of the processing times in the (simulated) inner widget resize time. I could also not reproduce the bug in PyQt4 without matplotlib by replacing the FigureCanvasQTAgg with a QFrame and adding some random sleep to the resize function. But, with some stacktracing, I found the reason: in matplotlib.FigureCanvasQTAgg, the following piece of code is called on a resizeEvent: def draw( self ): # ... some internal code # Added following line to improve realtime pan/zoom on windows: QtGui.qApp.processEvents() This makes the problem clear: - if we resize the window quickly, several resizeEvents are created and are in the event queue of Qt - the first one gets processed by the QVBoxLayout which starts the processing in its first (matplotlib) widget. - the matplotlib widget does what it should and at some point calls matplotlib.FigureCanvasQTAgg.draw(self). - this starts the processing of the next event in the queue which is the next (2nd) resize event. BUT: we are still in the processing of the first event!!! - the 2nd event goes to the QVBoxLayout, from there to the matlotlib widget (eventually starting some recursive behaviour here) - if the 2nd event is finished, QVBoxLayout sends it to its other widget (the scrollbar). The scrollbar is resized according to the *2nd event*. - if the processing of the 2nd event was finished and no more events are in the queue, the matplotlib.FigureCanvasQTAgg.draw() finishes - at the end, this will finish the processing of the first resize event in the matplotlib widget and start the *first resize event* for the scrollbar This is exactly the behaviour that I described in my first posting. It is caused by the QtGui.qApp.processEvents() call in the draw() function. So, I think this is clearly a bug in matplotlib: QtGui.qApp.processEvents() should not be called while processing another event. Darren, I dont know your position with respect to matplotlib: are you a developer and thus aware of the bug or shall I post this again on the matplotlib mailing list? I am a developer, but I think it would be good to post your summary there at the matplotlib mailing list so we can continue this discussion there. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: question about resizing behavior
On Fri, Jul 3, 2009 at 3:37 AM, Ole Streicher ole-usenet-s...@gmx.netwrote: Hello Darren, Darren Dale dsdal...@gmail.com writes: Somebody reported some strange resizing behavior at the matplotlib mailing list. The somebody was me :-) Here some additional information: If you printout the resize (overwritten) events of the scrollbar and the matplotlib widgets (see code below), you will see that sometimes the events are not processed in-order: ScrollBar start 640 ScrollBar end 640 Diagram start 640 Diagram end 640 occurs when I just started, which is correct. But when one changes the horizontal size, the following happens (printouts which obviously belong to the same resize event are marked with the same number of stars): * Diagram start 633 **Diagram start 608 [...] **Diagram end 608 ** ScrollBar start 608 ** ScrollBar end 608 * Diagram end 633 * ScrollBar start 633 * ScrollBar end 633 What you see is that - the matplotlib FigureCanvasQTAgg gets its first resize event - during its processing inside FigureCanvasQTAgg a second event occurred - this second event is processed *faster* by FigureCanvasQTAgg than the first event - thus, the second event occurs *first* on the scrollbar - the first resize event only occurs after the second on the scrollbar - this leads to a wrong size of the scrollbar - this may occur even nested (removed [...] in the printout above) This may be a bug in FigureCanvasQTAgg (it is not synchonized in the processing of resize events, allowing events to bypass), or in Qt/QVBoxLayout (same argument there). I am not deep enough inside Qt to know the API details here. Best regards Ole -8-- import sys from PyQt4 import QtGui, QtCore from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from matplotlib.figure import Figure class MyDiagram(FigureCanvasQTAgg): def __init__(self, fig): FigureCanvasQTAgg.__init__(self, fig) def resizeEvent(self, event): print ' Diagram start', event.size().width() FigureCanvasQTAgg.resizeEvent(self, event) print ' Diagram end', event.size().width() class MyScrollBar(QtGui.QScrollBar): def __init__(self, parent): QtGui.QScrollBar.__init__(self, QtCore.Qt.Horizontal, parent) def resizeEvent(self, event): print 'ScrollBar start', event.size().width() QtGui.QScrollBar.resizeEvent(self, event) print 'ScrollBar end', event.size().width() class DiagramWidget(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.scrollbar = MyScrollBar(self) fig = Figure() axes = fig.add_subplot(111) axes.plot(xrange(100)) self.diagram = MyDiagram(fig) self.diagram.setParent(self) layout = QtGui.QVBoxLayout(self) self.setLayout(layout) layout.addWidget(self.diagram) layout.addWidget(self.scrollbar) a = QtGui.QApplication(sys.argv) w = DiagramWidget() w.show() a.exec_() -8-- Nice demonstration of the problem Ole. I notice that if, after resizing, I pause briefly before releasing the mouse button, the scroll bar is more likely to resize properly. The problem is much more apparent if I release the mouse button immediately after resizing or while still dragging the window edge. I also tried adding a call to qApp.processEvents() in FigureCanvasQT.resizeEvent, and that seemed to make the problem less frequent, but the problem still exists. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about resizing behavior
Hello, Somebody reported some strange resizing behavior at the matplotlib mailing list. matplotlib has a PyQt4 plot rendering widget, and the script below creates a window containing such a widget and also a scrollbar. If you resize the window's width, the scrollbar often seems to be resized according to the plot widget's previous size. So if I make the window narrower, the scrollbar extends beyond the window, if I make the window wider, the scrollbar does not expand to the edge of the window: == # requires matplotlib be installed import sys from PyQt4 import QtGui, QtCore from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from matplotlib.figure import Figure class DiagramWidget(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self) fig = Figure() axes = fig.add_subplot(111) axes.plot(xrange(100)) self.diagram = FigureCanvasQTAgg(fig) self.diagram.setParent(self) layout = QtGui.QVBoxLayout(self) self.setLayout(layout) layout.addWidget(self.diagram) layout.addWidget(self.scrollbar) a = QtGui.QApplication(sys.argv) w = DiagramWidget() w.show() a.exec_() == I think the relevant code from matplotlibs plot widget is here: == def resizeEvent( self, event ): if DEBUG: print 'resize (%d x %d)' % (event.size().width(), event.size().height()) QtGui.QWidget.resizeEvent( self, event ) w = event.size().width() h = event.size().height() if DEBUG: print FigureCanvasQtAgg.resizeEvent(, w, ,, h, ) dpival = self.figure.dpi winch = w/dpival hinch = h/dpival self.figure.set_size_inches( winch, hinch ) self.draw() def resize( self, w, h ): # Pass through to Qt to resize the widget. QtGui.QWidget.resize( self, w, h ) # Resize the figure by converting pixels to inches. pixelPerInch = self.figure.dpi wInch = w / pixelPerInch hInch = h / pixelPerInch self.figure.set_size_inches( wInch, hInch ) # Redraw everything. self.draw() def sizeHint( self ): w, h = self.get_width_height() return QtCore.QSize( w, h ) == I have tried commenting out the resize and sizeHint methods, I've tried calling self.update and QtGui.QWidget.resizeEvent(self, event) at the end of the resizeEvent implementation in matplotlib's backend_qt4, but it doesn't seem to have an effect. Could anyone offer an idea of what is going on? Can I do something to improve the resize behavior in matplotlib so it doesnt confuse PyQt/Qt, or is this possibly an artifact/bug in PyQt/Qt? Thank you, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
Hi Armando, On Wed, Jun 3, 2009 at 9:34 AM, V. Armando Solé s...@esrf.fr wrote: Hello, I think I have fallen into a Qt bug but perhaps I am wrong. According to the (latest) Qt documentation, QAbstractItemModel.createIndex takes a uint32 as the model index internalId, while the internalId() method of QModelIndex returns a uint64. I guess my problems are coming from that inconsistency. The problem is illustrated below. On a windows machine and on a 64-bit linux machine everything is fine. On a 32-bit linux machine the given internalId (= id(a) ) and the returned internalId are not the same. In fact, one of them is negative. Both, the linux-32 machine and the windows XP machine are running sip 4.7.9, PyQt 4.4.4 and qt 4.4.3 Am I missing some obvious solution to the problem? Best regards, Armando import PyQt4.Qt as qt class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[ Hello World] index = self.createIndex(row, column, id(a)) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) Relatedly, I think there is a small problem with the PyQt4 documentation for the overloaded QAbstractItemModel.createIndex method. It looks like Qt's documentation for passing a pointer is being presented in PyQt4's method for passing an identifier, and PyQt's pointer method documentation is empty. When I first read PyQt's documentation for this method, there was nothing to indicate that the id passed to createIndex should end up as the index's internalId(), so I wrote a workaround. But now that I read Qt-4.5's documenation for this method, it seems clear that these identifiers should be equal. By the way, is your windows machine 32 or 64 bit? Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 10:23 AM, V. Armando Solé s...@esrf.fr wrote: Darren Dale wrote: Hi Armando, Relatedly, I think there is a small problem with the PyQt4 documentation for the overloaded QAbstractItemModel.createIndex method. It looks like Qt's documentation for passing a pointer is being presented in PyQt4's method for passing an identifier, and PyQt's pointer method documentation is empty. When I first read PyQt's documentation for this method, there was nothing to indicate that the id passed to createIndex should end up as the index's internalId(), so I wrote a workaround. But now that I read Qt-4.5's documenation for this method, it seems clear that these identifiers should be equal. By the way, is your windows machine 32 or 64 bit? 32-bit. Anyways there is something weird. I have tried masking id and internalId with the operation 0x in order to generate the same values. Nevertheless, the self._idMap dictionnary keeps growing. I always end up with an infinite tree in linux-32 and not in linux-64. By the way, does the posted code behaves properly on your system? Sometimes fails even at 64 bit. When I run this version of your script, the two identifiers are never the same: import PyQt4.Qt as qt import random class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[random.random()] index = self.createIndex(row, column, id(a)) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 10:37 AM, Darren Dale dsdal...@gmail.com wrote: On Wed, Jun 3, 2009 at 10:23 AM, V. Armando Solé s...@esrf.fr wrote: Darren Dale wrote: Hi Armando, Relatedly, I think there is a small problem with the PyQt4 documentation for the overloaded QAbstractItemModel.createIndex method. It looks like Qt's documentation for passing a pointer is being presented in PyQt4's method for passing an identifier, and PyQt's pointer method documentation is empty. When I first read PyQt's documentation for this method, there was nothing to indicate that the id passed to createIndex should end up as the index's internalId(), so I wrote a workaround. But now that I read Qt-4.5's documenation for this method, it seems clear that these identifiers should be equal. By the way, is your windows machine 32 or 64 bit? 32-bit. Anyways there is something weird. I have tried masking id and internalId with the operation 0x in order to generate the same values. Nevertheless, the self._idMap dictionnary keeps growing. I always end up with an infinite tree in linux-32 and not in linux-64. By the way, does the posted code behaves properly on your system? Sometimes fails even at 64 bit. When I run this version of your script, the two identifiers are never the same: import PyQt4.Qt as qt import random class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[random.random()] index = self.createIndex(row, column, id(a)) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) I should have noted, I'm testing on 64-bit linux. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 12:08 PM, Phil Thompson p...@riverbankcomputing.comwrote: On Wed, 03 Jun 2009 17:37:29 +0200, V. Armando Solé s...@esrf.fr wrote: Hello, The problem can be solved as shown below. It seems the linux 32 bit implementation gets confused in createIndex(row, column, a) when a is not an integer but a long. With small values of a (10, 100, 1000), the indexId() method returns the supplied value. The solution is to call createIndex(row, column, a) with a being a python object and not its id. The indexId() method can be masked with a 32 bit mask if it returns a negative value. I have only found that misbehavior under linux 32bit. Windows XP and linux 64-bit behave properly. Thanks for your time, Armando import PyQt4.Qt as qt import random import sys mask = 0x class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[random.random()] index = self.createIndex(row, column, a) print Next two values should be the same returned = index.internalId() if returned 0: returned = returned mask print indexInternalId = , returned print id(a) = , id(a) print Forcing to be the same with a 32 bit mask print indexInternalId = , index.internalId() mask print id(a) = , id(a) mask return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) Could you see if the problem goes away if you change qabstractitemmodel.sip so that... QModelIndex createIndex(int arow, int acolumn, int aid) const; ...is replaced by... QModelIndex createIndex(int arow, int acolumn, quint32 aid) const; I applied this change to the 20090601 snapshot. Executive summary: when I check different data types, I can still find places where the two id's do not agree. I find disagreement with the mask applied and without: When I run the script I posted, I get output like: Next two values should be the same indexInternalId = 1849945336 id(a) = 139691366280440 If I apply Armando's mask, I get: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 If I remove the mask and instead do a=[numpy.uint32(random.random())], I get ouput like: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 Still without the mask, if I do a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 And finally, with Armando's mask and with a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 110072896 id(a) = 139754050917440 Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 2:20 PM, Darren Dale dsdal...@gmail.com wrote: On Wed, Jun 3, 2009 at 12:08 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 03 Jun 2009 17:37:29 +0200, V. Armando Solé s...@esrf.fr wrote: Hello, The problem can be solved as shown below. It seems the linux 32 bit implementation gets confused in createIndex(row, column, a) when a is not an integer but a long. With small values of a (10, 100, 1000), the indexId() method returns the supplied value. The solution is to call createIndex(row, column, a) with a being a python object and not its id. The indexId() method can be masked with a 32 bit mask if it returns a negative value. I have only found that misbehavior under linux 32bit. Windows XP and linux 64-bit behave properly. Thanks for your time, Armando import PyQt4.Qt as qt import random import sys mask = 0x class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[random.random()] index = self.createIndex(row, column, a) print Next two values should be the same returned = index.internalId() if returned 0: returned = returned mask print indexInternalId = , returned print id(a) = , id(a) print Forcing to be the same with a 32 bit mask print indexInternalId = , index.internalId() mask print id(a) = , id(a) mask return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) Could you see if the problem goes away if you change qabstractitemmodel.sip so that... QModelIndex createIndex(int arow, int acolumn, int aid) const; ...is replaced by... QModelIndex createIndex(int arow, int acolumn, quint32 aid) const; I applied this change to the 20090601 snapshot. Executive summary: when I check different data types, I can still find places where the two id's do not agree. I find disagreement with the mask applied and without: When I run the script I posted, I get output like: Next two values should be the same indexInternalId = 1849945336 id(a) = 139691366280440 If I apply Armando's mask, I get: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 If I remove the mask and instead do a=[numpy.uint32(random.random())], I get ouput like: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 Still without the mask, if I do a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 And finally, with Armando's mask and with a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 110072896 id(a) = 139754050917440 There was a bug report, it has been marked won't fix: http://www.qtsoftware.com/developer/task-tracker/index_html?method=entryid=204226 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 2:40 PM, Darren Dale dsdal...@gmail.com wrote: On Wed, Jun 3, 2009 at 2:20 PM, Darren Dale dsdal...@gmail.com wrote: On Wed, Jun 3, 2009 at 12:08 PM, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 03 Jun 2009 17:37:29 +0200, V. Armando Solé s...@esrf.fr wrote: Hello, The problem can be solved as shown below. It seems the linux 32 bit implementation gets confused in createIndex(row, column, a) when a is not an integer but a long. With small values of a (10, 100, 1000), the indexId() method returns the supplied value. The solution is to call createIndex(row, column, a) with a being a python object and not its id. The indexId() method can be masked with a 32 bit mask if it returns a negative value. I have only found that misbehavior under linux 32bit. Windows XP and linux 64-bit behave properly. Thanks for your time, Armando import PyQt4.Qt as qt import random import sys mask = 0x class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=[random.random()] index = self.createIndex(row, column, a) print Next two values should be the same returned = index.internalId() if returned 0: returned = returned mask print indexInternalId = , returned print id(a) = , id(a) print Forcing to be the same with a 32 bit mask print indexInternalId = , index.internalId() mask print id(a) = , id(a) mask return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) Could you see if the problem goes away if you change qabstractitemmodel.sip so that... QModelIndex createIndex(int arow, int acolumn, int aid) const; ...is replaced by... QModelIndex createIndex(int arow, int acolumn, quint32 aid) const; I applied this change to the 20090601 snapshot. Executive summary: when I check different data types, I can still find places where the two id's do not agree. I find disagreement with the mask applied and without: When I run the script I posted, I get output like: Next two values should be the same indexInternalId = 1849945336 id(a) = 139691366280440 If I apply Armando's mask, I get: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 If I remove the mask and instead do a=[numpy.uint32(random.random())], I get ouput like: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 Still without the mask, if I do a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 12719168 id(a) = 12719168 And finally, with Armando's mask and with a=[numpy.int64(random.random())]: Next two values should be the same indexInternalId = 110072896 id(a) = 139754050917440 There was a bug report, it has been marked won't fix: http://www.qtsoftware.com/developer/task-tracker/index_html?method=entryid=204226 One last point, however: I think Armando's suggestion of passing the object, and not the object's id(), coupled with Phil's patch, is the right solution: import PyQt4.Qt as qt import random import sys import numpy class Model(qt.QAbstractItemModel): def index(self, row, column, parent): a=(random.random(),) index = self.createIndex(row, column, a) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) a=(numpy.uint32(random.random()),) index = self.createIndex(row, column, a) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) a=(numpy.uint64(random.random()),) index = self.createIndex(row, column, a) print Next two values should be the same print indexInternalId = , index.internalId() print id(a) = , id(a) return index if __name__ == __main__: app = qt.QApplication([]) w = Model() w.index(0,0,None) With Phil's patch, running this script on 64-bit linux yields: Next two values should be the same indexInternalId = 8744016 id(a) = 8744016 Next two values should be the same indexInternalId = 8744080 id(a) = 8744080 Next two values should be the same indexInternalId = 8744016 id(a) = 8744016 Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Qt or PyQt problem?
On Wed, Jun 3, 2009 at 4:57 PM, Vicente Sole s...@esrf.fr wrote: Quoting Darren Dale: On Wed, Jun 3, 2009 at 2:40 PM, Darren Dale dsdal...@gmail.com wrote: One last point, however: I think Armando's suggestion of passing the object, and not the object's id(), coupled with Phil's patch, is the right solution: At my side, passing the object was already fine on 64-bit without Phil's patch. It is under 32-bit that the check has to be made. Yes, I got confused and part of my post was noise. Phil's patch does not address passing an object to createIndex. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyuic4 segfaults with 20090601 snapshots
I am using the 20090601 sip and pyqt4 snapshots on a 64-bit kubuntu karmic alpha system. I see segfaults with pyuic4, for example with the attached file using: pyuic4 -o ui_skipmode.py ui_skipmode.ui I don't see the problem using the same snapshots on a 64-bit gentoo system, which also uses gcc-4.4. I know karmic is in early stages of development, but it has been quite stable for me, and qtdemo.py seems to run without trouble. pyrcc4 does not appear to be segfaulting on either system. Can anyone else reproduce the segfault with the snapshots and the attached file? Thanks Darren ui_skipmode.ui Description: Binary data ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyuic4 segfaults with 20090601 snapshots
On Tue, Jun 2, 2009 at 7:22 PM, Demetrius Cassidy dcassid...@mass.rr.comwrote: I think theres something wrong with the 20090601 build. Build fails on Vista64, and another guy has a problem with the x11 snapshot with the same compiler error. Have you tried earlier builds at all? I didn't have problems building the June 1 pyqt snapshot once I installed sip 20090601. I can't claim that the problem I see is specific to this particular snapshot, I think this is the first time I have needed to run pyuic4 in a while. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] trouble building PyQt4-x11 20090529 snapshot
Hello, This morning I downloaded the 20090529 PyQt4 snapshot, and am having trouble building it on a 64-bit gentoo linux system. I didn't see any SIP snapshots available at the riverbank website, so I am using the 20090525 sip snapshot: g++ -c -pipe -fno-strict-aliasing -O2 -march=k8 -mtune=k8 -pipe -fPIC -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/python2.6 -I../../QtCore -I. -I. -o qpycore_pyqtboundsignal.o qpycore_pyqtboundsignal.cpp qpycore_pyqtboundsignal.cpp:94: error: 'SIP_MLNAME_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:96: error: 'SIP_MLDOC_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:97: error: 'SIP_MLNAME_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:98: error: 'SIP_MLDOC_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:99: error: 'SIP_MLNAME_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:100: error: 'SIP_MLDOC_CAST' was not declared in this scope qpycore_pyqtboundsignal.cpp:116: error: 'SIP_TPNAME_CAST' was not declared in this scope make[2]: *** [qpycore_pyqtboundsignal.o] Error 1 make[2]: Leaving directory `/home/share/packages/PyQt-x11-gpl-4.5-snapshot-20090529/qpy/QtCore' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/share/packages/PyQt-x11-gpl-4.5-snapshot-20090529/qpy' make: *** [all] Error 2 Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] possible threading/locking bug in PyQt4 snapshots
Hello, I have attached a short script that I think demonstrates a bug in the PyQt4 snapshots. I expect the following output on the command line: 0 1 [...] 9998 complete The script runs as expected with PyQt4-4.4.4 on 64bit Kubuntu Jaunty (although I have to invoke ctrl-z to exit the script. I don't know how to improve that part, but that is not the subject of this post.) With the most recent (20090507) snapshots installed on 64bit Gentoo, the script does not run to completion. The script usually hangs up before anything is printed at the command line, although occasionally the thread gets part way through the loop before it hangs up. Darren from __future__ import with_statement import copy import sys from PyQt4 import QtGui, QtCore class MyData(object): def _get_value(self): with self._lock: return copy.copy(self._value) def _set_value(self, value): with self._lock: self._value = copy.copy(value) value = property(_get_value, _set_value) def __init__(self): self._lock = QRLock() self._value = [] def append(self, value): with self._lock: self._value.append(value) class QRLock(QtCore.QMutex): def __init__(self): QtCore.QMutex.__init__(self, QtCore.QMutex.Recursive) def __enter__(self): self.lock() return self def __exit__(self, type, value, traceback): self.unlock() class MyThread(QtCore.QThread): @property def stopped(self): with self._lock: return self._stopped def __init__(self, data): QtCore.QThread.__init__(self) self._lock = QRLock() self._data = data self._stopped = False def run(self): for i in xrange(1): if self.stopped: break self._data.append(i) self.emit(QtCore.SIGNAL('newData'), i) self.emit(QtCore.SIGNAL('processComplete'), i) def stop(self): with self._lock: self._stopped = True class ProcessData(QtCore.QObject): def __init__(self): QtCore.QObject.__init__(self) self._myData = MyData() self._thread = MyThread(self._myData) self.connect(self._thread, QtCore.SIGNAL('newData'), self.report) self.connect(self._thread, QtCore.SIGNAL('processComplete'), self.cleanup) self._thread.start() def cleanup(self): self._thread = None print 'complete' def report(self, i): print self._myData.value[i] app = QtCore.QCoreApplication(sys.argv) test = ProcessData() sys.exit(app.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyQt Licensing
On Wed, May 6, 2009 at 10:45 AM, Henrik Pauli henrik.pa...@gmail.comwrote: On Wednesday 06 May 2009 13:28:15 Attila Csipa wrote: On Wednesday 06 May 2009 12:30:02 Henrik Pauli wrote: Hmm... I think strictly said, the licensing of the final product and the development model do not have anything to do with each other. Afterall, it’s not LGPL per se that made Qt’s development model more open, that’s just a separate, just well timed decision. With Qt this is not the case, it has a very firm stance about development model and it's relation to the final product license. Legally, you cannot start development with a non-commercial Qt license (either community/GPL or LGPL) and then switch over to commercial on product release. I believe this is why Phil made the licensing change he mentioned - so at least with a commercial license of PyQt you can use the LGPL version of Qt and still make a commercial product. IANAL, correct me if I'm wrong. I was talking about Qt itself getting developed (by Trolltech / Qt Software) rather than development *with* Qt. At least I think that was mostly Mr. Corsaire's concern (cf. Phil getting hit by a bus). Actually, same concern can be expressed towards Detlev too, Eric4, while open source, the only interface to its development we have is here in the mailing lists; if something happens to Detlev, there's no public repository so it's not possible to continue where he left it, but one would have to go back to whatever the last release was. The repository for Eric4 *is* publicly available: http://eric-ide.python-projects.org/eric4-code.html ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Regression in SIP sip-4.8-snapshot-20090409 wrt MappedTypes
On Mon, Apr 20, 2009 at 2:54 PM, Phil Thompson p...@riverbankcomputing.comwrote: On Mon, 20 Apr 2009 08:22:54 +0200, Simon Edwards si...@simonzone.com wrote: Phil Thompson wrote: On Sun, 19 Apr 2009 21:39:29 +0200, Simon Edwards si...@simonzone.com wrote: Phil Thompson wrote: sipForceConvertTo_*() (and related functions) are internal and should not be used by handwritten code. If it isn't documented then you can't use it. Thanks that helps a lot. Another question. 4.8 gives errors on PyKDE related it trying to use a copy constructor or operator=() on some classes which don't have one or have one which is private. It looks like SIP wants to use the copy constructor to copy a returned value from a method and then fails. Has anything changed? Have you got any tips about what I should be trying. If a copy ctor is private then SIP should be told about it - see qobject.sip. The copy ctor is included and private like many others. This might be a namespace related issue. Here is what I've got. It worked in SIP 4.8. class KEditListBox : QGroupBox { public: class CustomEditor { public: CustomEditor (); CustomEditor (QWidget* repWidget, KLineEdit* edit); CustomEditor (KComboBox* combo); private: CustomEditor (const KEditListBox::CustomEditor); }; // ... }; class KUrlRequester : KHBox { // ... public: explicit KUrlRequester (QWidget* parent /TransferThis/ = 0); explicit KUrlRequester (const KUrl url, QWidget* parent /TransferThis/ = 0); KUrlRequester (QWidget* editWidget, QWidget* parent /TransferThis/); const KEditListBox::CustomEditor customEditor (); // ^ This here fails. } /home/sbe/devel/kdesvninstall/include/keditlistbox.h: In function ‘PyObject* meth_KUrlRequester_customEditor(PyObject*, PyObject*)’: /home/sbe/devel/kdesvninstall/include/keditlistbox.h:77: error: ‘KEditListBox::CustomEditor::CustomEditor(const KEditListBox::CustomEditor)’ is private sipkiopart5.cpp:22797: error: within this context Try tonight's SIP snapshot. It's a problem with the new implicit copying of const reference results. This morning I checkout out pykde revision 959021 and tried to build it against kde-4.2.2 and the most recent SIP/PyQt4 snapshots. qhostinfo.h can not be found during make, but the file is present on my system in both /usr/include/qt4/QtNetwork/ and /usr/include/qt4/Qt/. Is it possible to build pykde with the riverbank snapshots and kde-4.2.2? Could anyone please advise? Thanks, Darren $ make make[1]: Entering directory `/usr/local/src/pykde4/kdecore' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/usr/local/src/pykde4/kdecore' make[1]: Entering directory `/usr/local/src/pykde4/solid' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/usr/local/src/pykde4/solid' make[1]: Entering directory `/usr/local/src/pykde4/kdeui' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/usr/local/src/pykde4/kdeui' make[1]: Entering directory `/usr/local/src/pykde4/kio' g++ -c -Wno-deprecated-declarations -pipe -fPIC -O2 -march=k8 -mtune=k8 -pipe -Wall -W -D_REENTRANT -DNDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I. -I/usr/local/src/pykde4/extra/kde422 -I/usr/include -I/usr/include/qt4 -I/usr/include/QtCore -I/usr/include/qt4/QtCore -I/usr/include/QtGui -I/usr/include/qt4/QtGui -I/usr/include/QtXml -I/usr/include/qt4/QtXml -I/usr/include/QtSvg -I/usr/include/qt4/QtSvg -I/usr/include/solid -I/usr/include/qt4/solid -I/usr/include/kio -I/usr/include/qt4/kio -I/usr/include/kfile -I/usr/include/qt4/kfile -I/usr/include/kssl -I/usr/include/qt4/kssl -I/usr/include/python2.6 -I/usr/share/qt4/mkspecs/default -I/usr/X11R6/include -o sipkiopart0.o sipkiopart0.cpp In file included from sipkiopart0.cpp:7: sipAPIkio.h:6417:1: warning: sipType_QList_27000600QPair_0100QString_0100QString redefined sipAPIkio.h:5668:1: warning: this is the location of the previous definition sipAPIkio.h:6683:1: warning: sipType_QList_27000600QPair_0100QString_0100QString redefined sipAPIkio.h:6417:1: warning: this is the location of the previous definition sipAPIkio.h:6689:1: warning: sipType_QList_27000600QPair_0100QByteArray_0100QByteArray redefined sipAPIkio.h:6415:1: warning: this is the location of the previous definition sipAPIkio.h:10427:1: warning: sipType_QList_27000600QPair_0100QString_0100QString redefined sipAPIkio.h:6683:1: warning: this is the location of the previous definition /usr/share/sip/PyQt4/QtNetwork/qhostinfo.sip:42:23: error: qhostinfo.h: No such file or directory make[1]: *** [sipkiopart0.o] Error 1 make[1]: Leaving directory `/usr/local/src/pykde4/kio' make: *** [all] Error 2 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Searching for a very small scprit using CLIPBOARD
Have you tried constructing a QApplication first? On Sat, Apr 25, 2009 at 8:24 PM, projetmbc projet...@club-internet.frwrote: I've already try that but I have the following message : QWidget: Must construct a QApplication before a QPaintDevice Christophe. Demetrius Cassidy a écrit : from PyQt4.QtGui import QApplication clipboard = QApplication.clipboard() clipboard.setText('mytext') see http://doc.trolltech.com/4.5/qapplication.html ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )
On Mon, Apr 13, 2009 at 3:43 PM, Darren Dale dsdal...@gmail.com wrote: On Mon, Apr 13, 2009 at 3:11 PM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 10:27:56, Darren Dale wrote: On Mon, Apr 13, 2009 at 9:58 AM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 14:11:46, Arnold Krille wrote: It is a pointer for internal purposes, that is internal for the model so it can map indexes to the internal data structures. (And yes, that is needed for anything except simple list or table models.:) nitpickThats not true actually, you can create the most complex model imaginable without using the internalPointer, simply by using the internalId and the related createIndex overload. That also automatically solves any problems created by python's refcounting+garbage collection (if you forget to store a reference to an object for the model in your model) Could you please sugggest an example of this approach, if you know of one? Thats easy, provide some way of hashing the objects in your tree, then use the hashnumber for the internal id. Often using id(yourobject) works quite well as internal id. Then all you need is a dict using the id as key and the real object as value, so you can easily look your object up. Or maybe your internal data layout already orders the objects in some way, then the searching through that tree might be efficiently possible and you don't need the dict at all. I don't have a pyqt source tree here, but I think the tree model example uses internalId for storing and identifier for each object. Ok, I think I get it, thank you. When I get time, I'll improve the example I posted in the other thread and share it with the list. I'm sorry, I think I need to ask for a little more clarification. After failing to convert my own code to use InternalId() instead of internalPointer, I decided it would be more instructive to convert the simpletreemodel example distributed with PyQt4 to use internalId. I am attaching that example, which fails with the repeated errors below. Could anyone have a look and suggest how it should be improved? It requires other files that ship with the original PyQt4 simpletreemodel example. Thanks, Darren Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 139, in rowCount parentItem = self.idMap[parent.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 89, in data item = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 89, in data item = self.idMap[index.internalId()] KeyError: 754744568L #!/usr/bin/env python *** ** ** Copyright (C) 2005-2005 Trolltech AS. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sa...@trolltech.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** *** import sys from PyQt4 import QtCore, QtGui import simpletreemodel_rc class TreeItem: def __init__(self, data, parent=None): self.parentItem = parent self.itemData = data self.childItems = [] def appendChild(self, item): self.childItems.append(item) def child(self, row): return self.childItems[row] def childCount(self): return len(self.childItems) def columnCount(self): return len(self.itemData) def data(self, column): return self.itemData[column] def parent(self): return self.parentItem def row(self): if self.parentItem: return self.parentItem.childItems.index(self) return 0 class TreeModel(QtCore.QAbstractItemModel): def __init__(self, data
Re: [PyQt] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )
On Thu, Apr 23, 2009 at 12:28 PM, Darren Dale dsdal...@gmail.com wrote: On Mon, Apr 13, 2009 at 3:43 PM, Darren Dale dsdal...@gmail.com wrote: On Mon, Apr 13, 2009 at 3:11 PM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 10:27:56, Darren Dale wrote: On Mon, Apr 13, 2009 at 9:58 AM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 14:11:46, Arnold Krille wrote: It is a pointer for internal purposes, that is internal for the model so it can map indexes to the internal data structures. (And yes, that is needed for anything except simple list or table models.:) nitpickThats not true actually, you can create the most complex model imaginable without using the internalPointer, simply by using the internalId and the related createIndex overload. That also automatically solves any problems created by python's refcounting+garbage collection (if you forget to store a reference to an object for the model in your model) Could you please sugggest an example of this approach, if you know of one? Thats easy, provide some way of hashing the objects in your tree, then use the hashnumber for the internal id. Often using id(yourobject) works quite well as internal id. Then all you need is a dict using the id as key and the real object as value, so you can easily look your object up. Or maybe your internal data layout already orders the objects in some way, then the searching through that tree might be efficiently possible and you don't need the dict at all. I don't have a pyqt source tree here, but I think the tree model example uses internalId for storing and identifier for each object. Ok, I think I get it, thank you. When I get time, I'll improve the example I posted in the other thread and share it with the list. I'm sorry, I think I need to ask for a little more clarification. After failing to convert my own code to use InternalId() instead of internalPointer, I decided it would be more instructive to convert the simpletreemodel example distributed with PyQt4 to use internalId. I am attaching that example, which fails with the repeated errors below. Could anyone have a look and suggest how it should be improved? It requires other files that ship with the original PyQt4 simpletreemodel example. Thanks, Darren Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 124, in parent childItem = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 139, in rowCount parentItem = self.idMap[parent.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 89, in data item = self.idMap[index.internalId()] KeyError: 754744568L Traceback (most recent call last): File simpletreemodel.py, line 89, in data item = self.idMap[index.internalId()] KeyError: 754744568L I was confused about how QModelIndex works, I thought passing a hash to createIndex meant that the hash was the index's internalId, but that is not the case. So I was using the hash as my idMap key, when I should have been using internalId. Here is a working script. #!/usr/bin/env python *** ** ** Copyright (C) 2005-2005 Trolltech AS. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sa...@trolltech.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** *** import sys from PyQt4 import QtCore, QtGui import simpletreemodel_rc class TreeItem: def __init__(self, data, parent=None): self.parentItem = parent self.itemData = data self.childItems = [] def appendChild(self, item): self.childItems.append(item) def child(self, row): return self.childItems[row] def childCount(self): return len(self.childItems
Re: [PyQt] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )
Hi Andreas, On Mon, Apr 13, 2009 at 9:58 AM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 14:11:46, Arnold Krille wrote: It is a pointer for internal purposes, that is internal for the model so it can map indexes to the internal data structures. (And yes, that is needed for anything except simple list or table models.:) nitpickThats not true actually, you can create the most complex model imaginable without using the internalPointer, simply by using the internalId and the related createIndex overload. That also automatically solves any problems created by python's refcounting+garbage collection (if you forget to store a reference to an object for the model in your model) Could you please sugggest an example of this approach, if you know of one? I started a thread on March 10 on this mailing list (seeking advice on why this script segfaults) where I put together an unsatisfying work around to avoid segfaults that were probably caused by my use of internalPointer. Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] segfault when using a proxy and SIGNAL( clicked(QModelIndex) )
On Mon, Apr 13, 2009 at 3:11 PM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 10:27:56, Darren Dale wrote: On Mon, Apr 13, 2009 at 9:58 AM, Andreas Pakulat ap...@gmx.de wrote: On 13.04.09 14:11:46, Arnold Krille wrote: It is a pointer for internal purposes, that is internal for the model so it can map indexes to the internal data structures. (And yes, that is needed for anything except simple list or table models.:) nitpickThats not true actually, you can create the most complex model imaginable without using the internalPointer, simply by using the internalId and the related createIndex overload. That also automatically solves any problems created by python's refcounting+garbage collection (if you forget to store a reference to an object for the model in your model) Could you please sugggest an example of this approach, if you know of one? Thats easy, provide some way of hashing the objects in your tree, then use the hashnumber for the internal id. Often using id(yourobject) works quite well as internal id. Then all you need is a dict using the id as key and the real object as value, so you can easily look your object up. Or maybe your internal data layout already orders the objects in some way, then the searching through that tree might be efficiently possible and you don't need the dict at all. I don't have a pyqt source tree here, but I think the tree model example uses internalId for storing and identifier for each object. Ok, I think I get it, thank you. When I get time, I'll improve the example I posted in the other thread and share it with the list. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] question about cyclic references with QThread
I have a simple question about QThread. The attached simple example illustrates a case where I have a widget that creates and holds a reference to a thread, setting itself as the parent. I need the parent to hold a reference to the thread, so I can interrupt its execution for example. I want to delete the thread when it finishes executing. What the script demonstrates is that when the widget catches the thread's finished signal and deletes its reference to the thread, the thread continues to persist until the widget itself goes out of scope. Is this due to a cyclic reference? Can anyone suggest what I have done wrong, how I can improve it? Thank you, Darren import gc import sys from PyQt4 import QtCore, QtGui class MyThread(QtCore.QThread): def __init__(self, parent): QtCore.QThread.__init__(self, parent) def run(self): for i in xrange(1000): print i print I did my part! def __del__(self): print But the thread persisted until the widget went out of scope! class MyWidget(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.thread = MyThread(self) self.thread.start() self.connect( self.thread, QtCore.SIGNAL(finished()), self.processComplete ) def processComplete(self): print 'got finished signal, attempting to delete thread...' self.thread = None gc.collect() if __name__ == __main__: myApp = QtGui.QApplication(sys.argv) w = MyWidget() w.show() sys.exit(myApp.exec_()) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: question about cyclic references with QThread
On Fri, Mar 27, 2009 at 10:14 AM, Darren Dale dsdal...@gmail.com wrote: I have a simple question about QThread. The attached simple example illustrates a case where I have a widget that creates and holds a reference to a thread, setting itself as the parent. I need the parent to hold a reference to the thread, so I can interrupt its execution for example. I want to delete the thread when it finishes executing. What the script demonstrates is that when the widget catches the thread's finished signal and deletes its reference to the thread, the thread continues to persist until the widget itself goes out of scope. Is this due to a cyclic reference? Can anyone suggest what I have done wrong, how I can improve it? I see my mistake. the thread's parent be None instead of the widget. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] trouble running PyQt-4.5 configure.py with python3
This morning I tried to install last nights snapshots on Kubuntu Jaunty for python-3.0.1. python configure.py would get up to the point were this is printed: Type '2' to view the GPL v2 license. Type '3' to view the GPL v3 license. Type 'yes' to accept the terms of the license. Type 'no' to decline the terms of the license. but it would not prompt me to accept the license. The script was getting stuck in the while loop that asks if we accept the terms of the license. I edited configure.py: # Handle Python v2. try: input = raw_input except NameError: pass while 1: try: resp = input(Do you accept the terms of the license? ) except KeyboardInterrupt: raise SystemExit #except: #resp = and ran the script again, which yielded: An internal error occured. Please report all the output from the program, including the following traceback, to supp...@riverbankcomputing.com. Traceback (most recent call last): File configure.py, line 1900, in module main() File configure.py, line 1848, in main check_license() File configure.py, line 1478, in check_license resp = input(Do you accept the terms of the license? ) UnboundLocalError: local variable 'input' referenced before assignment If I comment this out instead: #try: #input = raw_input #except NameError: #pass Then I configure.py will run without errors with python-3. Maybe this is a bug in python, or just Jaunty's python, but perhaps a workaround could be considered for configure.py. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] possible regression in PyQt/sip snapshots
I have been keeping up to date with the snapshots, and after installing them I try to launch Eric4 and I get a segfault. I think this simple example, adapted from eric4's Debugger/BreakPointModel.py, might illustrate the problem: from PyQt4 import QtCore alignment = QtCore.QVariant(QtCore.Qt.Alignment(QtCore.Qt.AlignLeft)) When I run that script, I get: Traceback (most recent call last): File test_alignment.py, line 3, in module alignment = QtCore.QVariant(QtCore.Qt.Alignment(QtCore.Qt.AlignLeft)) TypeError: unable to convert a Python 'Alignment' object to a C++ 'Qt::Alignment' instance Can anyone please confirm? Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: seeking advice on why this script segfaults
On Wed, Mar 11, 2009 at 11:56 AM, Darren Dale dsdal...@gmail.com wrote: On Tue, Mar 10, 2009 at 8:03 PM, Darren Dale dsdal...@gmail.com wrote: On Tue, Mar 10, 2009 at 5:28 PM, Darren Dale dsdal...@gmail.com wrote: Hello, I am trying to create a simple model and view for a simple nested dictionary like d: c1 = {'id':1, 'description':'child 1'} c2 = {'id':2, 'description':'child 2'} d = {'id':0, 'description':'whatever', 'children':[c1, c2]} I have a self-contained, relatively simple script attached. When I run it and try to open the top-level entry by clicking on the +, I get errors like: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: parent Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'exceptions.AttributeError' object has no attribute 'parent' Bus error sometimes I get a different error: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Segmentation fault Could anyone please help me understand what is happening? I dont understand why index.internalPointer() is returning an ItemDataRole object or an exceptions.AttributeError object. Im running Qt-4.5.0, sip-4.7.9 and PyQt-4.4.4. I just checked this script on a 64-bit kubuntu intrepid system with qt-4.4.3 and PyQt4-4.4.4, sip-4.7.9 and python-2.5.2 and I get segfaults here too. I guess that rules out some issue specific to qt-4.5. I've been looking into this some more, and I managed to isolate the problem. The attached script runs ok when CACHE_CHILDREN = True, but it will yield bus errors or segfaults when CACHE_CHILDREN is False. Unfortunately, I am modeling an object that can be changed elsewhere in the application, so it is imperitive that I am able to recalculate the child list. I have done the exact same thing using Enthought's Traits package with the Traits Qt4 backend, and never saw segfaults, so I know it must be possible. Please, can anyone suggest why this causes a crash? If anybody has some example of a working QAbstractItemModel/QTreeView for dynamic data, would you please consider posting it (if its short) or sending it to me off list? I've been working on this problem for days now and I'm not getting anywhere. Thank you, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Re: seeking advice on why this script segfaults
On Thu, Mar 12, 2009 at 2:57 PM, Arnold Krille arn...@arnoldarts.de wrote: On Thursday 12 March 2009 17:31:40 Darren Dale wrote: If anybody has some example of a working QAbstractItemModel/QTreeView for dynamic data, would you please consider posting it (if its short) or sending it to me off list? I've been working on this problem for days now and I'm not getting anywhere. I don't know what you mean with dynamic data, On Thu, Mar 12, 2009 at 2:57 PM, Arnold Krille arn...@arnoldarts.de wrote: On Thursday 12 March 2009 17:31:40 Darren Dale wrote: If anybody has some example of a working QAbstractItemModel/QTreeView for dynamic data, would you please consider posting it (if its short) or sending it to me off list? I've been working on this problem for days now and I'm not getting anywhere. I don't know what you mean with dynamic data, but I have trees that fill themselves at runtime upon user interaction. And have children of different kinds... I am modeling data in a file that is organized in an hierarchy very similar to directories and files in a file system, and the structure of that hierarchy is changed not through the tree view, but elsewhere in the application. I managed to put together a workaround, based on the hasChildren/canFetchMore/fetchMore infrastructure to lazily populate the list of nodes when expanding, and connecting the TreeView collapsed signal to a method that clears the list of nodes so the list can be refreshed when it is re-expanded. It still feels like I've overlooked something or I'm not using the provided tools effectively, but its sufficient for me to get by for now and I'm under a deadline. Would it be possible to add some kind of check to raise an error and prevent PyQt from segfaulting with the original script? Darren from PyQt4 import QtCore, QtGui from functools import wraps import time class TreeItem(object): def __init__(self, data, parent=None): self._parent = parent self._data = data self._children = [] @property def children(self): return self._children @property def columns(self): return [self.data['id'], self.data['description']] @property def data(self): return self._data @property def hasChildren(self): return False @property def parent(self): return self._parent @property def row(self): if self.parent: return self.parent.children.index(self) return 0 def clearChildren(self): self._children = [] def __len__(self): return len(self.children) class RootItem(TreeItem): def __init__(self): self._parent = None self._children = [] @property def children(self): return self._children @property def columns(self): return ['ID', 'Description'] @property def hasChildren(self): return True def appendChild(self, child): self._children.append(child) class DictItem(TreeItem): def __init__(self, data, parent=None): super(DictItem, self).__init__(data, parent) @property def children(self): if not self._children: self._children = [TreeItem(child, self) for child in self.data['children']] return self._children @property def hasChildren(self): return True class FileModel(QtCore.QAbstractItemModel): def __init__(self, parent=None): super(FileModel, self).__init__(parent) self._rootItem = RootItem() @property def rootItem(self): return self._rootItem def canFetchMore(self, index): parentItem = index.internalPointer() if parentItem is not None: return len(parentItem) == 0 else: return False def columnCount(self, parent): if parent.isValid(): return len(parent.internalPointer().columns) else: return len(self.rootItem.columns) def data(self, index, role): if not index.isValid() or role != QtCore.Qt.DisplayRole: return QtCore.QVariant() item = index.internalPointer() return QtCore.QVariant(item.columns[index.column()]) def fetchMore(self, index): parentItem = index.internalPointer() if parentItem is not None: self.beginInsertRows(index, 0, len(parentItem)) parentItem.children self.endInsertRows() def hasChildren(self, index): parentItem = index.internalPointer() if parentItem is not None: return parentItem.hasChildren else: return True def headerData(self, section, orientation, role): if orientation == QtCore.Qt.Horizontal and \ role == QtCore.Qt.DisplayRole: return QtCore.QVariant(self.rootItem.columns[section]) return QtCore.QVariant() def index(self
[PyQt] Re: seeking advice on why this script segfaults
On Tue, Mar 10, 2009 at 8:03 PM, Darren Dale dsdal...@gmail.com wrote: On Tue, Mar 10, 2009 at 5:28 PM, Darren Dale dsdal...@gmail.com wrote: Hello, I am trying to create a simple model and view for a simple nested dictionary like d: c1 = {'id':1, 'description':'child 1'} c2 = {'id':2, 'description':'child 2'} d = {'id':0, 'description':'whatever', 'children':[c1, c2]} I have a self-contained, relatively simple script attached. When I run it and try to open the top-level entry by clicking on the +, I get errors like: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: parent Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'exceptions.AttributeError' object has no attribute 'parent' Bus error sometimes I get a different error: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Segmentation fault Could anyone please help me understand what is happening? I dont understand why index.internalPointer() is returning an ItemDataRole object or an exceptions.AttributeError object. Im running Qt-4.5.0, sip-4.7.9 and PyQt-4.4.4. I just checked this script on a 64-bit kubuntu intrepid system with qt-4.4.3 and PyQt4-4.4.4, sip-4.7.9 and python-2.5.2 and I get segfaults here too. I guess that rules out some issue specific to qt-4.5. I've been looking into this some more, and I managed to isolate the problem. The attached script runs ok when CACHE_CHILDREN = True, but it will yield bus errors or segfaults when CACHE_CHILDREN is False. Unfortunately, I am modeling an object that can be changed elsewhere in the application, so it is imperitive that I am able to recalculate the child list. I have done the exact same thing using Enthought's Traits package with the Traits Qt4 backend, and never saw segfaults, so I know it must be possible. Please, can anyone suggest why this causes a crash? Thank you, Darren from PyQt4 import QtCore, QtGui CACHE_CHILDREN = True class TreeItem(object): def __init__(self, data, parent=None): self._parent = parent self._data = data @property def children(self): return [] @property def columns(self): return [self.data['id'], self.data['description']] @property def data(self): return self._data @property def parent(self): return self._parent @property def row(self): if self.parent: return self.parent.children.index(self) return 0 @property def rows(self): return len(self.children) class RootItem(TreeItem): def __init__(self): self._parent = None self._children = [] @property def children(self): return self._children @property def columns(self): return ['ID', 'Description'] def appendChild(self, child): self._children.append(child) class DictItem(TreeItem): def __init__(self, data, parent=None): super(DictItem, self).__init__(data, parent) @property def children(self): if CACHE_CHILDREN: try: return self._children except AttributeError: self._children = [TreeItem(child, self) for child in self.data['children']] return self._children else: return [TreeItem(child, self) for child in self.data['children']] class FileModel(QtCore.QAbstractItemModel): def __init__(self, parent=None): super(FileModel, self).__init__(parent) self._rootItem = RootItem() @property def rootItem(self): return self._rootItem def columnCount(self, parent): if parent.isValid(): return len(parent.internalPointer().columns) else: return len(self.rootItem.columns) def data(self, index, role): if not index.isValid() or role != QtCore.Qt.DisplayRole: return QtCore.QVariant() item = index.internalPointer() return QtCore.QVariant(item.columns[index.column()]) def headerData(self, section, orientation, role): if orientation == QtCore.Qt.Horizontal and \ role == QtCore.Qt.DisplayRole: return QtCore.QVariant(self.rootItem.columns[section]) return QtCore.QVariant() def index(self, row, column, parent): if not self.hasIndex(row, column, parent): return QtCore.QModelIndex() if parent.isValid
[PyQt] seeking advice on why this script segfaults
Hello, I am trying to create a simple model and view for a simple nested dictionary like d: c1 = {'id':1, 'description':'child 1'} c2 = {'id':2, 'description':'child 2'} d = {'id':0, 'description':'whatever', 'children':[c1, c2]} I have a self-contained, relatively simple script attached. When I run it and try to open the top-level entry by clicking on the +, I get errors like: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: parent Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'exceptions.AttributeError' object has no attribute 'parent' Bus error sometimes I get a different error: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Segmentation fault Could anyone please help me understand what is happening? I dont understand why index.internalPointer() is returning an ItemDataRole object or an exceptions.AttributeError object. Im running Qt-4.5.0, sip-4.7.9 and PyQt-4.4.4. Thank you, Darren from PyQt4 import QtCore, QtGui class TreeItem: def __init__(self, data, parent=None): self._parent = parent self._data = data @property def children(self): return [] @property def columns(self): return [self.data['id'], self.data['description']] @property def parent(self): return self._parent @property def data(self): return self._data @property def row(self): if self.parent: return self.parent.children.index(self) return 0 def __len__(self): return len(self.columns) class RootItem(TreeItem): def __init__(self): self._parent = None self._children = [] @property def children(self): return self._children @property def columns(self): return ['ID', 'Description'] def appendChild(self, child): self._children.append(child) class DictItem(TreeItem): @property def children(self): return [TreeItem(child, self) for child in self.data['children']] class FileModel(QtCore.QAbstractItemModel): def __init__(self, parent=None): super(FileModel, self).__init__(parent) self._rootItem = RootItem() @property def rootItem(self): return self._rootItem def columnCount(self, parent): if parent.isValid(): return len(parent.internalPointer().columns) else: return len(self.rootItem.columns) def data(self, index, role): if not index.isValid() or role != QtCore.Qt.DisplayRole: return QtCore.QVariant() item = index.internalPointer() return QtCore.QVariant(item.columns[index.column()]) def headerData(self, section, orientation, role): if orientation == QtCore.Qt.Horizontal and \ role == QtCore.Qt.DisplayRole: return QtCore.QVariant(self.rootItem.columns[section]) return QtCore.QVariant() def index(self, row, column, parent): if not self.hasIndex(row, column, parent): return QtCore.QModelIndex() if parent.isValid(): parentItem = parent.internalPointer() else: parentItem = self.rootItem child = parentItem.children[row] return self.createIndex(row, column, child) def parent(self, index): if not index.isValid(): return QtCore.QModelIndex() parent = index.internalPointer().parent if parent == self.rootItem or parent is None: return QtCore.QModelIndex() return self.createIndex(parent.row, 0, parent) def rowCount(self, parent): if parent.isValid(): parentItem = parent.internalPointer() else: parentItem = self.rootItem return len(parentItem.children) def appendDict(self, d): assert 'id' in d assert 'description' in d self.rootItem.appendChild(DictItem(d)) class FileView(QtGui.QTreeView): def __init__(self, model=None, parent=None): super(FileView, self).__init__(parent) self.setModel(model) if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) model = FileModel() form = FileView(model) c1 = {'id':1, 'description':'child 1'} c2 = {'id':2, 'description':'child 2'} d = {'id':0, 'description':'whatever', 'children':[c1, c2]} model.appendDict(d) form.show() sys.exit(app.exec_()) ___ PyQt mailing
[PyQt] Re: seeking advice on why this script segfaults
On Tue, Mar 10, 2009 at 5:28 PM, Darren Dale dsdal...@gmail.com wrote: Hello, I am trying to create a simple model and view for a simple nested dictionary like d: c1 = {'id':1, 'description':'child 1'} c2 = {'id':2, 'description':'child 2'} d = {'id':0, 'description':'whatever', 'children':[c1, c2]} I have a self-contained, relatively simple script attached. When I run it and try to open the top-level entry by clicking on the +, I get errors like: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: parent Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'exceptions.AttributeError' object has no attribute 'parent' Bus error sometimes I get a different error: Traceback (most recent call last): File tree_test.py, line 111, in parent parent = index.internalPointer().parent AttributeError: 'ItemDataRole' object has no attribute 'parent' Segmentation fault Could anyone please help me understand what is happening? I dont understand why index.internalPointer() is returning an ItemDataRole object or an exceptions.AttributeError object. Im running Qt-4.5.0, sip-4.7.9 and PyQt-4.4.4. I just checked this script on a 64-bit kubuntu intrepid system with qt-4.4.3 and PyQt4-4.4.4, sip-4.7.9 and python-2.5.2 and I get segfaults here too. I guess that rules out some issue specific to qt-4.5. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Documentation Style (Was: PyQt4 feature request)
On Sat, Mar 7, 2009 at 12:50 PM, Phil Thompson p...@riverbankcomputing.comwrote: On Sat, 7 Mar 2009 18:06:12 +0100, Detlev Offenbach det...@die-offenbachs.de wrote: Hi, please include the PyQt4 documentation as a compressed Qt Help files (*.qch) as well. eric4 will support Qt Help collections starting with the first 4.4 snapshot. An opportune moment to ask for opinions... When I (eventually) get round to improving the PyQt docs (particularly making the API reference more Pythonic) it will be designed to support (in theory) multiple output styles. In the Roadmap I specifically mention the traditional Qt style and Sphinx (ie. that used for the Python v2.6 documentation). Which of these two styles do people prefer? I prefer Sphinx. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: Re: [PyQt] MatplotLib and PyQt
On Sun, Feb 8, 2009 at 11:48 AM, projet...@club-internet.fr wrote: Hello, I'm looking for examples of little PyQt applications embending MatplotLib. Here is a good example: http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_q t4.htmlhttp://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_q%0At4.html . The matplotlib mailing list is probably a better place to follow up if you have additional questions specific to matplotlib. Darren Indeed I've already asked this question in the Matplotliib mailing list and I have not received good answers. That's an interesting comment. The last time you asked about this at matplotlib-user, a number of people offered you examples and it seemed you had found what you were looking for: Thanks a lot. That's a real good example. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] MatplotLib and PyQt
On Sat, Feb 7, 2009 at 6:58 PM, projet...@club-internet.fr wrote: Hello, I'm looking for examples of little PyQt applications embending MatplotLib. Here is a good example: http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html. The matplotlib mailing list is probably a better place to follow up if you have additional questions specific to matplotlib. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Licensing for PyQt?
On Fri, Jan 16, 2009 at 9:03 AM, Phil Thompson p...@riverbankcomputing.comwrote: On Fri, 16 Jan 2009 13:37:47 + (UTC), David F dael...@gmail.com wrote: After the announcement that Qt 4.5 will be released as LGPL, has it been decided if PyQt will do the same? I have seen some speculation but no actual announcement. I certainly wish it would -- given the quality of PyQt and the (in my experience) excellent community and support, it would be sure to become the de facto standard Python GUI toolkit. I heard of the license change at the same time as everybody else, so I hope you'll allow me some time to think through the implications. Yes, lets please let that be the last word on the subject until Phil feels compelled to bring the subject up again. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Are QThreads compatible with python's threading.RLock?
On Saturday 26 July 2008 03:48:53 you wrote: On Fri, 25 Jul 2008 17:41:22 -0400, Darren Dale [EMAIL PROTECTED] wrote: I use a library that provides rudimentary thread safety of its objects and file I/O using threading.RLock from the python standard library. Could anyone tell me if PyQt4's QThreads are compatible with these recursive locks? Other than the fact that they will both be implemented using the same OS primitives, Python's and Qt's threading know nothing about each other. Thanks Phil. The author of this other library I use added a mechanism to accommodate alternative threading libraries: users can provide their own lock object, provided it is reentrant and respect python's context manager protocol. So I think I can can do this: class MyRLock(QtCore.QMutex): def __init__(self): super(MyRLock, self).__init__(QtCore.QMutex.Recursive) def __enter__(self): return self.lock() def __exit__(self, type, value, traceback): self.unlock() def acquire(self): return self.lock() def release(self): self.unlock() h5.config.RLock = MyRLock One last question, concerning context managers: I think the current PyQt4 way is: def foo(self): with QMutexLocker(self.mutex): [...] but if QMutex and friends had __enter__ and __exit__ methods, like MyRLock, we could do: def foo(self): with self.mutex: [...] Is there a reason (performance?) for using Qt's QMutexLocker to provide the context manager, rather than the QMutex itself? Thanks, Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug - PyQt 4.4.2 and Matplotlib 0.91.2
On Friday 30 May 2008 5:22:44 pm Pierre Raybaut wrote: Hi, I found out a performance bug when embedding a Matplotlib 0.91.2 canvas in a PyQt 4.4.2 object: the pan/zoom feature is very slow (with PyQt 4.3.3, and the exact same scripts, pan/zoom is real-time). I am posting this in Matplotlib mailing-list too, but I thought that maybe some of you could have an idea about this? I don't think it is appropriate to post here unless it can be demonstrated that there is a performance issue specifically related to PyQt and not Matplotlib or Qt. We continue this discussion on the matplotlib mailing list. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt