[PyKDE] Bugs in pyuic3 in current snapshot; Bug in QPixmap.fromMimeSource

Ulrich Berning ulrich.berning at desys.de
Fri May 16 15:53:01 BST 2003


Hi all,

1. Since the time the new flag -test was added to pyuic3, the flag -x is 
no longer recognized (easy to fix).

2.  pyuic -embed xxx filenew.xpm generates invalid python code:

.
.
.
# filenew.xpm
image_0_data = \
    "\x00\x00\x02\x10\x78\x9c\x63\x60\x20\x03\xb0\x42\x00\x03" \
    "\x23\x0e\x71\x26\x46\xec\xe2\xcc\x68\x12\x30\x71\x16\x34" \
    "\x09\x98\x38\x2b\x9a\x04\x4c\x1c\x87\x7b\x30\x64\x47\x9a" \
    "\x38\x15\x00\x00\xc6\xa2\x03\xc1"

image_0_ctable = [
    \xc6c6c6,\xff2e2e2e,\xff5c5c5c,\xff878787,\xffc2c2c2,\xffffffff
]
.
.
.

The color table image_0_ctable does not contain valid constants. It 
should be:

image_0_ctable = [
    0xc6c6c6,0xff2e2e2e,0xff5c5c5c,0xff878787,0xffc2c2c2,0xffffffff
]

The attached patch fixes both bugs.

-----
Anyway, QPixmap.fromMimeSource() returns corrupted images on all my 
plattforms.

The attached images describe what I mean:

toolbar_expected.png - comes from a C++ application and is the same on 
all plattforms (Linux, AIX, Windows).
toolbar_linux.png - comes from a python application running on Linux.
toolbar_aix.png - comes from the same python application running on AIX.
toolbar_win32.png - comes from the same python application running on 
Windows 2000.

Every toolbar icon is duplicated, the first is png format, the second is 
xpm format.
-----
When I use xpm format (with a patched version of pyuic, see above), the 
images are completely corrupted, when I use png format, some images seem 
to be ok, some other images are corrupted. I guess there must be a 
memory bug somewhere deep in sip or PyQt. Perhaps it has something to do 
with the data sharing concepts in Qt. I have attached a tar file, that 
contains a sample application in python and in c++. Perhaps someone can 
reproduce this bug.
-----

Some notes about my platforms:
------
SuSE Linux 7.2
Kernel 2.4.16-4GB
gcc 2.95.3
xf86-4.0.3
Qt-3.1.2
Python-2.2.2
-----
AIX-4.3.3.0
IBM VisualAge C++ Professional for AIX, Version 6.0
Qt-3.1.2
Python-2.2.2
-----
Microsoft Windows 2000 Servicepack 2
Microsoft Visual C++ Professional Edition V6 SP5
Qt-3.1.2
Python-2.2.2
-----

Ciao,
Ulli

-------------- next part --------------
diff -uNr PyQt-x11-commercial-snapshot-20030513.orig/pyuic3/embed.cpp PyQt-x11-commercial-snapshot-20030513/pyuic3/embed.cpp
--- PyQt-x11-commercial-snapshot-20030513.orig/pyuic3/embed.cpp	Wed May 14 02:02:55 2003
+++ PyQt-x11-commercial-snapshot-20030513/pyuic3/embed.cpp	Fri May 16 14:00:33 2003
@@ -108,7 +108,7 @@
     for ( int i=0; i<n; i++ ) {
 	if ( (i%14) == 0  )
 	    out << "\n    ";
-	out << "\\x";
+	out << "0x";
 	out << hex << *v++;
 	if ( i < n-1 )
 	    out << ',';
diff -uNr PyQt-x11-commercial-snapshot-20030513.orig/pyuic3/main.cpp PyQt-x11-commercial-snapshot-20030513/pyuic3/main.cpp
--- PyQt-x11-commercial-snapshot-20030513.orig/pyuic3/main.cpp	Wed May 14 02:02:55 2003
+++ PyQt-x11-commercial-snapshot-20030513/pyuic3/main.cpp	Fri May 16 14:00:33 2003
@@ -120,6 +120,8 @@
 		    indent.setTabStop(tabstop);
 		else
 		    error = "Invalid Python indent";
+ 	    } else if ( opt == "x" ) {
+ 		execCode = TRUE;
 	    } else if ( opt == "test" ) {
 		testCode = TRUE;
 	    } else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolbar_expected.png
Type: image/png
Size: 837 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030516/c1905712/toolbar_expected.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolbar_linux.png
Type: image/png
Size: 1145 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030516/c1905712/toolbar_linux.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolbar_aix.png
Type: image/png
Size: 740 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030516/c1905712/toolbar_aix.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toolbar_win32.png
Type: image/png
Size: 821 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030516/c1905712/toolbar_win32.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_mime_source.tar.gz
Type: application/x-gunzip
Size: 8116 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030516/c1905712/test_mime_source.tar.bin


More information about the PyQt mailing list