[Qgis-developer] Problems with using QGIS Custom Widgets

C Hamilton adenaculture at gmail.com
Thu Jun 30 11:45:06 PDT 2016


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/20160630/5f031fff/attachment.html>


More information about the Qgis-developer mailing list