/[gentoo-x86]/dev-python/PyQt4/files/PyQt4-4.9.4-pyuic-custom-widgets.patch
Gentoo

Contents of /dev-python/PyQt4/files/PyQt4-4.9.4-pyuic-custom-widgets.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Sat May 4 11:12:04 2013 UTC (6 years, 11 months ago) by hwoarang
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-diff
FILE REMOVED
old

(Portage version: 2.1.11.62/cvs/Linux x86_64, signed Manifest commit with key C2BA7F3C!)

1
2
3 # HG changeset patch
4 # User Phil Thompson <phil@riverbankcomputing.com>
5 # Date 2012-07-13 13:39:28 +0100
6 # Node ID 29b668ada14c1428a3bbfe8f0324c6626bd5ac9a
7 # Parent fd0f3da9d79ca9858d10a20c15fb85456cb832d7
8 Fixed a regression in pyuic's handling of custom widgets.
9
10 diff --git a/pyuic/uic/Compiler/qobjectcreator.py b/pyuic/uic/Compiler/qobjectcreator.py
11 --- a/pyuic/uic/Compiler/qobjectcreator.py
12 +++ b/pyuic/uic/Compiler/qobjectcreator.py
13 @@ -1,6 +1,6 @@
14 #############################################################################
15 ##
16 -## Copyright (C) 2011 Riverbank Computing Limited.
17 +## Copyright (C) 2012 Riverbank Computing Limited.
18 ## Copyright (C) 2006 Thorsten Marek.
19 ## All right reserved.
20 ##
21 @@ -100,7 +100,6 @@
22 assert widgetClass not in self._widgets
23 self._widgets[widgetClass] = (baseClass, module)
24
25 -
26 def _resolveBaseclass(self, baseClass):
27 try:
28 for x in range(0, 10):
29 @@ -114,19 +113,17 @@
30 except KeyError:
31 raise ValueError("unknown baseclass %s" % baseClass)
32
33 -
34 def search(self, cls):
35 try:
36 - self._usedWidgets.add(cls)
37 baseClass = self._resolveBaseclass(self._widgets[cls][0])
38 DEBUG("resolved baseclass of %s: %s" % (cls, baseClass))
39 -
40 - return type(cls, (baseClass,),
41 - {"module" : ""})
42 -
43 except KeyError:
44 return None
45
46 + self._usedWidgets.add(cls)
47 +
48 + return type(cls, (baseClass, ), {"module" : ""})
49 +
50 def _writeImportCode(self):
51 imports = {}
52 for widget in self._usedWidgets:
53 diff --git a/pyuic/uic/objcreator.py b/pyuic/uic/objcreator.py
54 --- a/pyuic/uic/objcreator.py
55 +++ b/pyuic/uic/objcreator.py
56 @@ -102,19 +102,26 @@
57 self._modules.append(self._customWidgets)
58
59 def createQObject(self, classname, *args, **kwargs):
60 - # Handle scoped names, typically static factory methods.
61 - parts = classname.split('.')
62 - factory = self.findQObjectType(parts[0])
63 + # Handle regular and custom widgets.
64 + factory = self.findQObjectType(classname)
65
66 - if factory is not None:
67 - for part in parts[1:]:
68 - factory = getattr(factory, part, None)
69 - if factory is None:
70 - break
71 - else:
72 - return self._cpolicy.instantiate(factory, *args, **kwargs)
73 + if factory is None:
74 + # Handle scoped names, typically static factory methods.
75 + parts = classname.split('.')
76
77 - raise NoSuchWidgetError(classname)
78 + if len(parts) > 1:
79 + factory = self.findQObjectType(parts[0])
80 +
81 + if factory is not None:
82 + for part in parts[1:]:
83 + factory = getattr(factory, part, None)
84 + if factory is None:
85 + break
86 +
87 + if factory is None:
88 + raise NoSuchWidgetError(classname)
89 +
90 + return self._cpolicy.instantiate(factory, *args, **kwargs)
91
92 def invoke(self, rname, method, args=()):
93 return self._cpolicy.invoke(rname, method, args)

  ViewVC Help
Powered by ViewVC 1.1.20