Re: [PyQt] Segmentation fault with QFileSystemModel

2010-11-11 Thread Dan Halbert

On 11/11/2010 3:22 PM, Gaƫtan Podevijn wrote:
When I launch a Python environment in a terminal, and I try to 
instanciate a QFileSystemModel, I have a segmentation fault:


 model = QFileSystemModel()

 model.setRootPath(QDir.homePath())

Segmentation fault


However, and I really don't understand, the attached file works well !

You need to create a QApplication to set up Qt before creating nearly 
all Qt objects except the absolute simplest such as QPoint, etc. The 
example you attached creates a QApplication before creating the 
QFileSystemModel.


Dan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Problem with implementation of dummy (no-op) proxy model

2010-10-28 Thread Dan Halbert
On Thursday, October 28, 2010 8:28am, Hans Meine 
me...@informatik.uni-hamburg.de said:
 I am about to give up now, but first I want to post my current code again; I
 added some assertions which show an interesting fact which I have no
 explanation for:  One assertion fails, since I am getting a QModelIndex of my
 proxy model in which internalPointer does *not* contain a QModelIndex of the
 proxied model anymore, but NULL/None.

There have been some related discussions on the mailing list you might take a 
look at, for instance: 
http://www.riverbankcomputing.com/pipermail/pyqt/2006-July/thread.html#13786. 
Google [ site:riverbankcomputing.com internalpointer ] to find some more.

It might also be interesting to rewrite your Python code in the corresponding 
C++ and see if you see similar behavior.

In my limited use of proxy models, I have not found it useful to store 
QModelIndex objects in the internalPointer(). Instead I have created some 
proxy data objects that reference the actual data model (which is 
Qt-independent). I subclassed QSortFilterProxyModel since it implemented a 
bunch of stuff I would otherwise have had to reimplement.

I would also note that your proxy model did not implement mapToSource() and 
mapFromSource() as required, though I don't think they would be called in the 
simple example you posted.

Dan




___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Qt designer causes OS crash

2010-09-24 Thread Dan Halbert
On Friday, September 24, 2010 11:35am, Gavin Poludniowski 
gavin.poludniow...@icr.ac.uk said:

 ...Now, when I try to drag a widget from one position in my Dialog
 to another, not only does QT designer crash, but it causes my whole OS to 
 crash
 (as if I'd had a powercut) and restart.

 My OS is Windows XP SP3 32-bit. The only recent changes to my PC are that IT 
 at
 work have installed MS Office 2007 and I have recently set my desktop up with 
 two
 rather than one monitor.

Quite frankly, this sounds to me like a display driver bug. If you take away 
the second monitor, does this still happen? See if you can update your video 
drivers. You might look in Windows Update in the Optional section, or find 
out the manufacturer and download new drivers.

Dan

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Image type RAW destroyed by PyQt

2010-09-16 Thread Dan Halbert

 On 9/16/2010 4:02 AM, Vincent Vande Vyvre wrote:
If an image is type RAW, (.CR2, .RAF, .3FR, .MRW etc) an image format 
.tiff is automatically created

and replace the RAW file. The original file is lost.
Could you give a short test program that reproduces the problem? Sounds 
like it only needs to read the file and maybe generate a thumbnail.  --Dan


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Pixel Manipulation Very Slow?

2010-08-20 Thread Dan Halbert
 Also see whether PIL, the Python Imaging Library 
(http://www.pythonware.com/products/pil/index.htm) will do what you 
want. It has a number of image-manipulation primitives which are coded 
in C at the low level. It also has pixel get/put, but that would 
probably not be significantly faster.


Dan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] event filters vs subclassing

2010-08-03 Thread Dan Halbert
I am implementing a simple specialized graphical editor in PyQt using a 
QGraphicsPixmapItem and related classes. I need to place points with mouse 
clicks and do a bit of dragging.

I can either subclass QGraphicsPixmapItem to handle various mouse events, or do 
installEventFilter(). In Mark Summerfield's PyQt book (p. 304), he cautions 
against using event filters, and suggests subclassing for most purposes, for 
complexity and efficiency reasons. I cannot find a pro/con discussion about 
this choice elsewhere, either in the C++ Qt book or on the web.

Is Mark cautioning against event filters in PyQt specifically (due to Python/Qt 
boundary crossing and filtering events in Python code), or is there some more 
general caution here?  In my case, the choice seems to be a wash, but I may as 
well use good style. Any advice is appreciated.

Thanks,
Dan
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt