<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><font size="-1"><font face="Verdana">Hi,</font></font></p>
    <p><font size="-1"><font face="Verdana">QgsColorButtonV2 is a QGIS
          custom widget.</font></font></p>
    <p><font size="-1"><font face="Verdana">When compiling the UI file
          having a custom widget, uic needs to find the qgis gui library
          which has its definition.</font></font></p>
    <font size="-1"><font face="Verdana">That means you have to specify
        the QGIS python directory in your python path. This works fine
        when using pyuic4 in command line.<br>
        <br>
        I am not sure about uic.loadType. Why not using pyuic4 directly?<br>
        <br>
        Maybe this is relevant:
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/pipermail/qgis-developer/2015-September/039196.html">https://lists.osgeo.org/pipermail/qgis-developer/2015-September/039196.html</a><br>
        <br>
        Cheers,<br>
        Denis<br>
        <br>
      </font></font>
    <div class="moz-cite-prefix">On 08/17/2016 04:09 PM, Casper Børgesen
      (CABO) wrote:<br>
    </div>
    <blockquote
      cite="mid:BCF6B63AE0B25941A7F56567B58A2805C5788248@allkexa1.NIRAS.INT"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US">Hi Calvin<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US">I’m facing the same problem and before I go
            home I just wanted to ask if you found a solution to this
            problem?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US">Regards, Casper<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
              lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
            lang="EN-US"> Qgis-developer
            [<a class="moz-txt-link-freetext" href="mailto:qgis-developer-bounces@lists.osgeo.org">mailto:qgis-developer-bounces@lists.osgeo.org</a>]
            <b>On Behalf Of </b>C Hamilton<br>
            <b>Sent:</b> 30. juni 2016 20:45<br>
            <b>To:</b> qgis-developer<br>
            <b>Subject:</b> [Qgis-developer] Problems with using QGIS
            Custom Widgets<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <div>
            <div>
              <p class="MsoNormal" style="margin-bottom:12.0pt">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:<br>
                <br>
                FORM_CLASS, _ = uic.loadUiType(os.path.join(<br>
                    os.path.dirname(__file__), 'heatmapdialog.ui'))<br>
                <br>
                When I load the plugin in QGIS I get the error:<br>
                <br>
                ---------------------------<br>
                ImportError: No module named qgscolorbuttonv2<br>
                <br>
                Traceback (most recent call last):<br>
                  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py",
                line 306, in startPlugin<br>
                    plugins[packageName] = package.classFactory(iface)<br>
                  File
                "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\__init__.py",
                line 2, in classFactory<br>
                    from .d3datavis import D3DataVis<br>
                  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py",
                line 572, in _import<br>
                    mod = _builtin_import(name, globals, locals,
                fromlist, level)<br>
                  File
                "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\d3datavis.py",
                line 10, in
                <br>
                    from heatmapDialog import HeatmapDialog<br>
                  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py",
                line 572, in _import<br>
                    mod = _builtin_import(name, globals, locals,
                fromlist, level)<br>
                  File
                "C:/Users/Calvin/.qgis2/python/plugins\d3datavis\heatmapDialog.py",
                line 17, in
                <br>
                    os.path.dirname(__file__), 'heatmapdialog.ui'))<br>
                  File
                "C:\OSGeo4W\apps\Python27\lib\site-packages\PyQt4\uic\__init__.py",
                line 213, in loadUiType<br>
                    exec(code_string.getvalue(), ui_globals)<br>
                  File "", line 169, in <br>
                  File "C:/OSGeo4W/apps/qgis/./python\qgis\utils.py",
                line 572, in _import<br>
                    mod = _builtin_import(name, globals, locals,
                fromlist, level)<br>
                ImportError: No module named qgscolorbuttonv2<br>
                ---------------------------<br>
                <br>
                In my code I have the import line:<br>
                <br>
                from qgis.gui import *<br>
                <br>
                From the QGIS console if I do that import,
                QgsColorButtonV2 is available.<br>
                <br>
                It appears that uic.loadUiType is the problem. How do I
                solve this?<o:p></o:p></p>
            </div>
            <p class="MsoNormal" style="margin-bottom:12.0pt">Thanks,<o:p></o:p></p>
          </div>
          <p class="MsoNormal">Calvin<o:p></o:p></p>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
    </blockquote>
    <br>
  </body>
</html>