[PyKDE] Bug in PyQt4's pyuic for custom widgets

Andreas Pakulat apaku at gmx.de
Mon Jun 12 11:35:51 BST 2006


Hi,

PyQt4's pyuic cannot handle .ui files containing custom widget
declarations where the header file begins with an h and a directory is
prepended to it. Something like

<header>widgets/htmlbrowser.h</header>

is translated into following code:

from widgetstmlbrowser import

The attached patch corrects this, by replacing only .h at the end of the
header string.

Andreas

-- 
It's a very *__UN*lucky week in which to be took dead.
		-- Churchy La Femme
-------------- next part --------------
diff -ur PyQt-x11-gpl-4.0/pyuic/uic/uiparser.py PyQt-x11-gpl-4.0.new/pyuic/uic/uiparser.py
--- PyQt-x11-gpl-4.0/pyuic/uic/uiparser.py	2006-06-10 14:43:21.000000000 +0200
+++ PyQt-x11-gpl-4.0.new/pyuic/uic/uiparser.py	2006-06-12 12:31:31.000000000 +0200
@@ -396,9 +396,9 @@
             >>> header2module("foo/bar/baz.h")
             'foo.bar.baz'
             """
-            return header \
-                   .replace("/", ".") \
-                   .replace(".h", "")
+	    import re
+            return re.sub(r'\.h$','',header) \
+                   .replace("/", ".")
     
         for custom_widget in iter(elem):
             classname = custom_widget.findtext("class")


More information about the PyQt mailing list