PKGBUILDs/extra/pyqt/fix-pyuic4.patch

86 lines
3 KiB
Diff
Raw Normal View History

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
2012-07-18 14:22:41 +00:00
@@ -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
2012-07-18 14:22:41 +00:00
self._widgets[widgetClass] = (baseClass, module)
2012-07-18 14:22:41 +00:00
-
def _resolveBaseclass(self, baseClass):
try:
for x in range(0, 10):
@@ -114,19 +113,17 @@
except KeyError:
raise ValueError("unknown baseclass %s" % baseClass)
2012-07-18 14:22:41 +00:00
-
def search(self, cls):
try:
- self._usedWidgets.add(cls)
baseClass = self._resolveBaseclass(self._widgets[cls][0])
DEBUG("resolved baseclass of %s: %s" % (cls, baseClass))
-
2012-07-18 14:22:41 +00:00
- return type(cls, (baseClass,),
- {"module" : ""})
-
2012-07-18 14:22:41 +00:00
except KeyError:
return None
2012-07-18 14:22:41 +00:00
+ 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
2012-07-18 14:22:41 +00:00
@@ -102,19 +102,26 @@
self._modules.append(self._customWidgets)
2012-07-18 14:22:41 +00:00
def createQObject(self, classname, *args, **kwargs):
- # Handle scoped names, typically static factory methods.
- parts = classname.split('.')
- factory = self.findQObjectType(parts[0])
-
2012-07-18 14:22:41 +00:00
- 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)
2012-07-18 14:22:41 +00:00
+ if factory is None:
+ # Handle scoped names, typically static factory methods.
+ parts = classname.split('.')
+
2012-07-18 14:22:41 +00:00
+ 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)
2012-07-18 14:22:41 +00:00
def invoke(self, rname, method, args=()):
return self._cpolicy.invoke(rname, method, args)