On Thursday 19 October 2006 08:00, Michael 'Mickey' Lauer wrote:
> Hi,
>
> I'm using Qt4.2 + sip/PyQt snapshots from 20061015:
> I'm getting the aforementioned error when supplying a baseclass to
> uic.loadUi. It also occurs on the load_ui2.py demo program.
>
> Any idea?
>
> Thanks,
I posted a patch about a week ago to fix this problem. Attached.
Matt
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