[Qgis-developer] Problem with using QGIS custom widgets in plugin

enricofer enricofer at gmail.com
Mon Nov 16 02:05:25 PST 2015


I got a similar issue using QgsFieldExpressionWidget.
After compiling ui with pyuic4 I found that the import statement at the end
of the compiled .py was wrong. So I manually changed it to:
from qgis.gui import QgsFieldExpressionWidget

Regards

Enrico Ferreguti

2015-11-16 10:30 GMT+01:00 Alexander Bruy [via OSGeo.org] <
ml-node+s1560n5236556h5 at n6.nabble.com>:

> Hi all,
>
> I use QGIS custom widgets in my plugin, namely QgsMaplayerComboBox.
> When I run QGIS under Linux all works fine, but under Windows I got Python
> error on startup related to missed enum entries:
>
>    File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\__init__.py",
> line 210, in loadUiType
>     winfo = compiler.UICompiler().compileUi(uifile, code_string,
> from_imports, resource_suffix)
>   File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\Compiler\compiler.py",
>
> line 139, in compileUi
>     w = self.parse(input_stream, resource_suffix)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 992, in parse
>     actor(elem)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 818, in createUserInterface
>     self.traverseWidgetTree(elem)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 796, in traverseWidgetTree
>     handler(self, child)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 507, in createLayout
>     self.traverseWidgetTree(elem)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 796, in traverseWidgetTree
>     handler(self, child)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 550, in handleItem
>     self.traverseWidgetTree(elem)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 796, in traverseWidgetTree
>     handler(self, child)
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 258, in createWidget
>     self.stack.push(self.setupObject(widget_class, parent, elem))
>   File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\uiparser.py",
> line 220, in setupObject
>     self.wprops.setProperties(obj, branch)
>   File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\properties.py",
> line 418, in setProperties
>     prop_value = self.convert(prop, widget)
>   File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\properties.py",
> line 383, in convert
>     return func(prop[0], **args)
>   File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\properties.py",
> line 116, in _set
>     expr = [self._pyEnumMember(v) for v in prop.text.split('|')]
>   File
> "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\properties.py",
> line 111, in _pyEnumMember
>     raise AttributeError("unknown enum %s" % cpp_name)
> AttributeError: unknown enum QgsMapLayerProxyModel::RasterLayer
>
> I use QGIS LTR installed via OSGeo4W installer. Same problem also exists
> with dev and release versions. Any ideas what is wrong and how to fix
> this?
>
> Thanks
> --
> Alexander Bruy
> _______________________________________________
> Qgis-developer mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5236556&i=0>
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://osgeo-org.1560.x6.nabble.com/Problem-with-using-QGIS-custom-widgets-in-plugin-tp5236556.html
> To unsubscribe from Quantum GIS - Developer, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4099106&code=ZW5yaWNvZmVyQGdtYWlsLmNvbXw0MDk5MTA2fDcwMTIyMjE0OA==>
> .
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-with-using-QGIS-custom-widgets-in-plugin-tp5236556p5236568.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151116/4a3e830d/attachment.html>


More information about the Qgis-developer mailing list