[PyQt] Using uic on KUrl has problems with KFile::ExistingOnly

Shaheed srhaque at theiet.org
Sun Jul 10 19:53:06 BST 2011


Hi,

I'm using PyKDE4, and trying to load Designer .ui files. I have a problem with one file which has the following KUrl widget:

    <widget class="KUrlRequester" name="kcfg_executable">
     <property name="mode">
      <set>KFile::ExistingOnly|KFile::File</set>
     </property>
    </widget>

When I try to load this using the uic module, I get the following error:

Traceback (most recent call last):
  File "./kterminal_example.py", line 43, in create
    self.creator = ExecutableEditor()
  File "./kterminal_example.py", line 21, in __init__
    self.ui = uic.loadUi("Projects/exekutor/src/ExecutableEditor.ui")
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/__init__.py", line 221, in loadUi
    return DynamicUILoader().loadUi(uifile, baseinstance)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/Loader/loader.py", line 71, in loadUi
    return self.parse(filename, basedir)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 886, in parse
    actor(elem)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 729, in createUserInterface
    self.traverseWidgetTree(elem)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 707, in traverseWidgetTree
    handler(self, child)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 449, in createLayout
    self.traverseWidgetTree(elem)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 707, in traverseWidgetTree
    handler(self, child)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 486, in handleItem
    self.traverseWidgetTree(elem)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 707, in traverseWidgetTree
    handler(self, child)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 208, in createWidget
    self.stack.push(self.setupObject(widget_class, parent, elem))
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/uiparser.py", line 177, in setupObject
    self.wprops.setProperties(obj, branch)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/properties.py", line 403, in setProperties
    prop_value = self.convert(prop, widget)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/properties.py", line 368, in convert
    return func(prop[0], **args)
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/properties.py", line 113, in _set
    expr = [self._pyEnumMember(v) for v in prop.text.split('|')]
  File "/usr/lib/pymodules/python2.7/PyQt4/uic/properties.py", line 108, in _pyEnumMember
    raise AttributeError("unknown enum %s" % cpp_name)
AttributeError: unknown enum KFile::ExistingOnly

I have checked that importing KFile (from PyKDE4.kio) in the main program makes no difference, and that importing it from the interpreter 
prompt allows me to print the value of KFile.ExistingOnly. So I guess from this last line that the issue is that the uic module somehow 
needs to know how to resolve the KFile name. Any ideas on how to resolve this issue would be appreciated.

Thanks, Shaheed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110710/841ccfda/attachment.html>


More information about the PyQt mailing list