mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
85 lines
3 KiB
Diff
85 lines
3 KiB
Diff
diff -urN a/pyuic/uic/Compiler/qobjectcreator.py b/pyuic/uic/Compiler/qobjectcreator.py
|
|
--- a/pyuic/uic/Compiler/qobjectcreator.py 2012-06-26 07:09:46.000000000 -0600
|
|
+++ b/pyuic/uic/Compiler/qobjectcreator.py 2012-07-18 09:41:19.483732249 -0600
|
|
@@ -1,6 +1,6 @@
|
|
#############################################################################
|
|
##
|
|
-## Copyright (C) 2011 Riverbank Computing Limited.
|
|
+## Copyright (C) 2012 Riverbank Computing Limited.
|
|
## Copyright (C) 2006 Thorsten Marek.
|
|
## All right reserved.
|
|
##
|
|
@@ -100,7 +100,6 @@
|
|
assert widgetClass not in self._widgets
|
|
self._widgets[widgetClass] = (baseClass, module)
|
|
|
|
-
|
|
def _resolveBaseclass(self, baseClass):
|
|
try:
|
|
for x in range(0, 10):
|
|
@@ -114,19 +113,17 @@
|
|
except KeyError:
|
|
raise ValueError("unknown baseclass %s" % baseClass)
|
|
|
|
-
|
|
def search(self, cls):
|
|
try:
|
|
- self._usedWidgets.add(cls)
|
|
baseClass = self._resolveBaseclass(self._widgets[cls][0])
|
|
DEBUG("resolved baseclass of %s: %s" % (cls, baseClass))
|
|
-
|
|
- return type(cls, (baseClass,),
|
|
- {"module" : ""})
|
|
-
|
|
except KeyError:
|
|
return None
|
|
|
|
+ self._usedWidgets.add(cls)
|
|
+
|
|
+ return type(cls, (baseClass, ), {"module" : ""})
|
|
+
|
|
def _writeImportCode(self):
|
|
imports = {}
|
|
for widget in self._usedWidgets:
|
|
diff -urN a/pyuic/uic/objcreator.py b/pyuic/uic/objcreator.py
|
|
--- a/pyuic/uic/objcreator.py 2012-06-26 07:09:46.000000000 -0600
|
|
+++ b/pyuic/uic/objcreator.py 2012-07-18 09:39:01.227387101 -0600
|
|
@@ -102,19 +102,26 @@
|
|
self._modules.append(self._customWidgets)
|
|
|
|
def createQObject(self, classname, *args, **kwargs):
|
|
- # Handle scoped names, typically static factory methods.
|
|
- parts = classname.split('.')
|
|
- factory = self.findQObjectType(parts[0])
|
|
-
|
|
- if factory is not None:
|
|
- for part in parts[1:]:
|
|
- factory = getattr(factory, part, None)
|
|
- if factory is None:
|
|
- break
|
|
- else:
|
|
- return self._cpolicy.instantiate(factory, *args, **kwargs)
|
|
+ # Handle regular and custom widgets.
|
|
+ factory = self.findQObjectType(classname)
|
|
|
|
- raise NoSuchWidgetError(classname)
|
|
+ if factory is None:
|
|
+ # Handle scoped names, typically static factory methods.
|
|
+ parts = classname.split('.')
|
|
+
|
|
+ if len(parts) > 1:
|
|
+ factory = self.findQObjectType(parts[0])
|
|
+
|
|
+ if factory is not None:
|
|
+ for part in parts[1:]:
|
|
+ factory = getattr(factory, part, None)
|
|
+ if factory is None:
|
|
+ break
|
|
+
|
|
+ if factory is None:
|
|
+ raise NoSuchWidgetError(classname)
|
|
+
|
|
+ return self._cpolicy.instantiate(factory, *args, **kwargs)
|
|
|
|
def invoke(self, rname, method, args=()):
|
|
return self._cpolicy.invoke(rname, method, args)
|