[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] pyuic does not correctly translate QListView pixmaps
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2003-02-07 23:43:29
[Download RAW message or body]

On Friday 07 February 2003 10:33 pm, Tuvi, Selim wrote:
>  Hi, I'd like to report a problem that we are encountering in PyQt 3.5
> Commercial. If in Qt Designer we add a QListView and define a pixmap for
> one or more of the items in the QListView, pyuic does not translate this
> correctly and gives the following error when we run the resulting source:
>
> Traceback (most recent call last):
>   File "form1.py", line 200, in ?
>     w = Form1()
>   File "form1.py", line 183, in __init__
>     self.languageChange()
>   File "form1.py", line 193, in languageChange
>     item.setPixmap(0,image0)
> NameError: global name 'image0' is not defined
>
> What's happening is that image0 is defined as a local variable in __init__
> so languageChange() doesn't know about it.
>
> We got around it by adding the pixmaps in our implementation code but I
> thought I mention this for future releases.

Until I start generating PyQt snapshots again, the attached couple of patches 
should fix it.

Thanks,
Phil
["form.cpp.patch" (text/x-diff)]

--- form.cpp.orig	Fri Feb  7 23:27:54 2003
+++ form.cpp	Fri Feb  7 23:30:06 2003
@@ -435,7 +435,7 @@
     // create pixmaps for all images
     if ( !xpmImages.isEmpty() ) {
 	for ( it = xpmImages.begin(); it != xpmImages.end(); ++it ) {
-	    out << indent << (*it) << " = QPixmap(" << (*it) << "_data)" << endl;
+	    out << indent << "self." << (*it) << " = QPixmap(" << (*it) << "_data)" << endl;
 	}
 	out << endl;
     }

["uic.cpp.patch" (text/x-diff)]

--- uic.cpp.orig	Fri Feb  7 23:30:41 2003
+++ uic.cpp	Fri Feb  7 23:32:12 2003
@@ -576,7 +576,7 @@
 	if ( !texts[ i ].isEmpty() )
 	    s += trindent + item + ".setText(" + QString::number( i ) + "," + trcall( texts[ i ] ) + ")\n";
 	if ( !pixmaps[ i ].isEmpty() )
-	    s += trindent + item + ".setPixmap(" + QString::number( i ) + "," + pixmaps[ i ] + ")\n";
+	    s += trindent + item + ".setPixmap(" + QString::number( i ) + ",self." + pixmaps[ i ] + ")\n";
     }
 
     lastItem = item;

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic