[Qgis-developer] Problems with using QGIS Custom Widgets

Casper Børgesen (CABO) CABO at NIRAS.DK
Wed Aug 17 07:09:32 PDT 2016


Hi Calvin

I’m facing the same problem and before I go home I just wanted to ask if you found a solution to this problem?


Regards, Casper

From: Qgis-developer [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of C Hamilton
Sent: 30. juni 2016 20:45
To: qgis-developer
Subject: [Qgis-developer] Problems with using QGIS Custom Widgets

I am using Qt Designer to add a QgsColorButtonV2 to the ui of a QGIS plugin. I am using uic.loadUiType to load my .ui file. Specifically here is the line of code:

FORM_CLASS, _ = uic.loadUiType(os.path.join(
    os.path.dirname(__file__), 'heatmapdialog.ui'))

When I load the plugin in QGIS I get the error:

---------------------------
ImportError: No module named qgscolorbuttonv2

Traceback (most recent call last):
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 306, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\__init__.py", line 2, in classFactory
    from .d3datavis import D3DataVis
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\d3datavis.py", line 10, in
    from heatmapDialog import HeatmapDialog
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\heatmapDialog.py", line 17, in
    os.path.dirname(__file__), 'heatmapdialog.ui'))
  File "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\__init__.py", line 213, in loadUiType
    exec(code_string.getvalue(), ui_globals)
  File "", line 169, in
  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named qgscolorbuttonv2
---------------------------

In my code I have the import line:

from qgis.gui import *

From the QGIS console if I do that import, QgsColorButtonV2 is available.

It appears that uic.loadUiType is the problem. How do I solve this?
Thanks,
Calvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160817/99e47700/attachment.html>


More information about the Qgis-developer mailing list