Patch to fix the problem is attached.

Matt

Error Message - 

[EMAIL PROTECTED]:/mnt/storage/blur/cpp/lib/PyQt4/examples/pyuic$ ./load_ui2.py
Traceback (most recent call last):
  File "./load_ui2.py", line 19, in ?
    widget = DemoImpl()
  File "./load_ui2.py", line 10, in __init__
    uic.loadUi("demo.ui", self)
  File "/usr/lib/python2.4/site-packages/PyQt4/uic/__init__.py", line 91, in 
loadUi
    return loader.DynamicUILoader().loadUi(uifile, baseinstance)
  File "/usr/lib/python2.4/site-packages/PyQt4/uic/Loader/loader.py", line 25, 
in loadUi
    return self.parse(filename)
  File "/usr/lib/python2.4/site-packages/PyQt4/uic/uiparser.py", line 507, in 
parse
    actor(elem)
  File "/usr/lib/python2.4/site-packages/PyQt4/uic/uiparser.py", line 365, in 
createUserInterface
    self.toplevelWidget = self.createToplevelWidget(cname, wname)
  File "/usr/lib/python2.4/site-packages/PyQt4/uic/Loader/loader.py", line 15, 
in createToplevelWidget
    if not isinstance(self.toplevelInst, self.wdb[classname]):
TypeError: unsubscriptable object
diff -ru PyQt-win-gpl-4-snapshot-20060930/pyuic/uic/Loader/loader.py pyuic/uic/Loader/loader.py
--- PyQt-win-gpl-4-snapshot-20060930/pyuic/uic/Loader/loader.py 2006-10-11 10:06:22.000000000 -0700
+++ pyuic/uic/Loader/loader.py  2006-10-11 10:06:40.000000000 -0700
@@ -12,9 +12,9 @@

     def createToplevelWidget(self, classname, widgetname):
         if self.toplevelInst is not None:
-            if not isinstance(self.toplevelInst, self.wdb[classname]):
+            if not isinstance(self.toplevelInst, self.wdb.findQObjectType(classname)):
                 raise TypeError, ("Wrong base class of toplevel widget",
-                                  (type(self.toplevelInst), self.wdb[classname]))
+                                  (type(self.toplevelInst), classname))
             return self.toplevelInst
         else:
             return self.wdb.createQObject(classname, widgetname, ())
Only in pyuic/uic: autoconnect.py
diff -ru PyQt-win-gpl-4-snapshot-20060930/pyuic/uic/objcreator.py pyuic/uic/objcreator.py
--- PyQt-win-gpl-4-snapshot-20060930/pyuic/uic/objcreator.py    2006-10-11 10:06:58.000000000 -0700
+++ pyuic/uic/objcreator.py     2006-10-11 10:07:54.000000000 -0700
@@ -50,14 +50,17 @@


     def createQObject(self, classname, *args, **kwargs):
+        classType = self.findQObjectType(classname)
+        if classType:
+            return self._cpolicy.instantiate(classType, *args, **kwargs)
+        raise NoSuchWidgetError, classname
+
+    def findQObjectType(self, classname):
         for module in self._modules:
             w = module.search(classname)
             if w is not None:
-                return self._cpolicy.instantiate(w, *args, **kwargs)
-        else:
-            raise NoSuchWidgetError, cls
-
-        raise NotImplementedEror, "must be overridden by subclasses"
+                return w
+        return None


     def getSlot(self, object, slotname):
_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to