[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] PyQt4 481 (Prebuild for Python 2.6) issue with QToolBar
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2010-10-23 12:28:02
Message-ID: c59e05a1e336e6a54fd151255958174c () localhost
[Download RAW message or body]

On Sat, 23 Oct 2010 12:41:35 +0200, Tobias Rzepka
<tobias.rzepka@googlemail.com> wrote:
> Hello,
> 
> I have a problem with the newly released PyQt4 version 4.8.1 on Python
2.6.
> I load an ui file at runtime with uic.loadUi. In case there is a 
> QToolBar I get the following error:
> 
> Traceback (most recent call last):
> 
>    File "D:\Projekte\Python\PyQt4_81_Bug\PyQt4_81_Bug.py", line 34,
>    in<module>
> 
>      widget = GUI_Implementation()
> 
>    File "D:\Projekte\Python\PyQt4_81_Bug\PyQt4_81_Bug.py", line 25, in
>    __init__
> 
>      uic.loadUi(r"PyQt4_81_Bug.ui", self)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\__init__.py", line 185,
>    in loadUi
> 
>      return DynamicUILoader().loadUi(uifile, baseinstance)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\Loader\loader.py", line
>    31, in loadUi
> 
>      return self.parse(filename, os.path.dirname(filename))
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\uiparser.py", line 830,
>    in parse
> 
>      actor(elem)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\uiparser.py", line 677,
>    in createUserInterface
> 
>      self.traverseWidgetTree(elem)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\uiparser.py", line 655,
>    in traverseWidgetTree
> 
>      handler(self, child)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\uiparser.py", line 251,
>    in createWidget
> 
>      tbArea = self.wprops.getAttribute(elem, "toolBarArea")
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\properties.py", line
342,
>    in getAttribute
> 
>      return self._getChild("attribute", elem, name, default)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\properties.py", line
334,
>    in _getChild
> 
>      return self.convert(prop)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\properties.py", line
328,
>    in convert
> 
>      return func(prop[0], **args)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\properties.py", line
82,
>    in _enum
> 
>      return self._pyEnumMember(prop.text)
> 
>    File "C:\Python26\lib\site-packages\PyQt4\uic\properties.py", line
61,
>    in _pyEnumMember
> 
>      prefix, membername = cpp_name.split("::")
> 
> ValueError: need more than 1 value to unpack
> 
> 
> I think it's a PyQt4 4.8.1 bug because with 4.7.x there were no such 
> behavior.
> To reproduce it I created a new application from scratch with the same 
> effect (see attachment).

The attached patch should fix it.

Thanks,
Phil
[Attachment #3 (text/x-diff)]

diff -r 9c7ee98c452a pyuic/uic/properties.py
--- a/pyuic/uic/properties.py	Fri Oct 22 13:31:17 2010 +0100
+++ b/pyuic/uic/properties.py	Sat Oct 23 13:24:08 2010 +0100
@@ -58,7 +58,11 @@
         self.icon_cache = IconCache(self.factory, QtGui)
 
     def _pyEnumMember(self, cpp_name):
-        prefix, membername = cpp_name.split("::")
+        try:
+            prefix, membername = cpp_name.split("::")
+        except ValueError:
+            prefix = "Qt"
+            membername = cpp_name
 
         if prefix == "Qt":
             return getattr(QtCore.Qt, membername)


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic