<div dir="ltr">Hey gus,<div>thanks for the tips, I'll give it a try!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 12, 2017 at 9:36 AM, Ismail Sunni <span dir="ltr"><<a href="mailto:imajimatika@gmail.com" target="_blank">imajimatika@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi, I (or we) also use the same method as Arnaud.</div><div><br></div><div>The only drawback is you can’t get the autocomplete from the python file (from the ui file). But the benefit is greater: no need to ship generated python code, no need to compile every time we change the .ui file. The development is faster now.</div><div><br></div><div>I don’t think we need to see the generated python code from the .ui file.</div><div><br></div><div>You can see here for the utilities method : <a href="https://github.com/inasafe/inasafe/blob/develop/safe/utilities/resources.py#L107" target="_blank">https://github.com/inasafe/<wbr>inasafe/blob/develop/safe/<wbr>utilities/resources.py#L107</a> </div><div><br></div><div>Best Regards</div><div><div class="h5"><div><br></div><br><div><blockquote type="cite"><div>On 12May, 2017, at 12:34, Michal Zimmermann <<a href="mailto:zimmicz@gmail.com" target="_blank">zimmicz@gmail.com</a>> wrote:</div><br class="m_1497404844223603323Apple-interchange-newline"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Hi,<div>that looks like an interesting workaround! What are the pitfalls? Don't you need to see the real python code when developing? </div></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Thu, May 11, 2017 at 1:55 PM, Arnaud Morvan<span class="m_1497404844223603323Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:arnaud.morvan@camptocamp.com" target="_blank">arnaud.morvan@<wbr>camptocamp.com</a>></span><span class="m_1497404844223603323Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">Hello Michal,<span class="m_1497404844223603323Apple-converted-space"> </span><br><br>I've also had this error some times ago, I do not remember if I succeed with pyuic4, nor the solution.<br><br>But IMHO it is simpler to load "ui" files at runtime.<br>Here is an example from "processing" plugin :<br><br>import os<br>from qgis.PyQt import uic<br><br>pluginPath = os.path.split(os.path.dirname(<wbr>__file__))[0]<br>WIDGET, BASE = uic.loadUiType(<br>   <span class="m_1497404844223603323Apple-converted-space"> </span>os.path.join(pluginPath, 'ui', 'DlgConfig.ui'))<br><br>class ConfigDialog(BASE, WIDGET):<br><br><br>=> no need to run make or similar to create python files each time you change something in your ui files.<br><br>load the plugin from the source folder (create a symbolic link from home QGIS plugins dir to plugin source dir)<br>change something in the ui file<br>reload the plugin using "plugin reloader" and you immediately see the result in QGIS.<br><br>Regards<pre class="m_1497404844223603323m_-2501770787831927990moz-signature" cols="72">Arnaud Morvan
Ingénieur logiciel
Tél: <a href="tel:+33%204%2058%2048%2020%2032" value="+33458482032" target="_blank">+33 (0)4 58 48 20 32</a>

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
<a class="m_1497404844223603323m_-2501770787831927990moz-txt-link-freetext" href="http://www.camptocamp.com/" target="_blank">http://www.camptocamp.com</a></pre><div><div class="m_1497404844223603323h5"><div class="m_1497404844223603323m_-2501770787831927990moz-cite-prefix">Le 11/05/2017 à 12:44, Michal Zimmermann a écrit :<br></div></div></div><blockquote type="cite"><div><div class="m_1497404844223603323h5"><div dir="ltr">Hi,<div>I'm starting with qgis plugin development on ubuntu-based Mint OS (v 18.1 Serena). I created a very simple form in Qt Designer 4.8.7 and tried to convert it to python file with <br><div><div><br></div><div>pyuic4 -d form.ui -o form.py<br></div><div><br></div><div>This results in </div><div><br></div><div><div>Traceback (most recent call last):</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/port_v2/invoke.<wbr>py", line 34, in invoke</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>exit_status = driver.invoke()</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/driver.py", line 59, in invoke</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>self._generate()</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/driver.py", line 98, in _generate</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>self._opts.resource_suffix)</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/__init__.py", line 173, in compileUi</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>winfo = compiler.UICompiler().compileU<wbr>i(uifile, pyfile, from_imports, resource_suffix)</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/Compiler/compile<wbr>r.py", line 55, in __init__</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>CompilerCreatorPolicy())</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/uiparser.py", line 170, in __init__</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>self.factory = QObjectCreator(creatorPolicy)</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/PyQt4/uic/objcreator.py", line 94, in __init__</div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>modinfo = plugin_locals["moduleInformati<wbr>on"]()</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "<string>", line 52, in moduleInformation</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/qgis/__init__.py", line 26, in <module></div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>from qgis.PyQt import QtCore</div><div> <span class="m_1497404844223603323Apple-converted-space"> </span>File "/usr/lib/python2.7/dist-packa<wbr>ges/qgis/PyQt/QtCore.py", line 28, in <module></div><div>   <span class="m_1497404844223603323Apple-converted-space"> </span>sip.setapi(api, 2)</div><div>ValueError: API 'QDate' has already been set to version 1</div></div><div><br></div><div>If I change /usr/lib/python2.7/dist<wbr>-packages/qgis/PyQt/QtCore.py line 28 to sip.setapi(api, 1), it works, QGIS starts with a following message though:</div><div><br></div><div><div style="margin:0px"><span style="color:rgb(255,0,0)">Couldn't load PyQGIS.<br>Python support will be disabled.</span><br></div><pre style="margin-top:12px;margin-bottom:12px"><span style="font-family:'courier new,courier'">
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/dist-packa<wbr>ges/qgis/__init__.py", line 26, in 
    from qgis.PyQt import QtCore
  File "/usr/lib/python2.7/dist-packa<wbr>ges/qgis/PyQt/QtCore.py", line 28, in 
    sip.setapi(api, 1)
ValueError: API 'QDate' has already been set to version 2

</span></pre><div style="margin:0px">Python version:<br>2.7.12 (default, Nov 19 2016, 06:48:10)<span class="m_1497404844223603323Apple-converted-space"> </span><br>[GCC 5.4.0 20160609]<br><br>QGIS version:<br>2.18.7 'Las Palmas', 3b30e6a</div></div><div><br></div><div>What exactly do I have to do to make the both sides work?</div><div><br></div>--<span class="m_1497404844223603323Apple-converted-space"> </span><br><div class="m_1497404844223603323m_-2501770787831927990gmail_signature"><div dir="ltr"><div>Michal Zimmermann (zimmi) <br>WWW:<span class="m_1497404844223603323Apple-converted-space"> </span><a href="https://www.zimmi.cz/" target="_blank">https://www.zimmi.cz</a></div></div></div></div></div></div><br><fieldset class="m_1497404844223603323m_-2501770787831927990mimeAttachmentHeader"></fieldset><br></div></div><pre>______________________________<wbr>_________________
QGIS-Developer mailing list
<a class="m_1497404844223603323m_-2501770787831927990moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="m_1497404844223603323m_-2501770787831927990moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/qgis-developer</a>
Unsubscribe: <a class="m_1497404844223603323m_-2501770787831927990moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/qgis-developer</a></pre></blockquote><br></div></blockquote></div><br><br clear="all"><div><br></div>--<span class="m_1497404844223603323Apple-converted-space"> </span><br><div class="m_1497404844223603323gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Michal Zimmermann (zimmi) <br>WWW:<span class="m_1497404844223603323Apple-converted-space"> </span><a href="https://www.zimmi.cz/" target="_blank">https://www.zimmi.cz</a></div></div></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">______________________________<wbr>_________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">QGIS-Developer mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:QGIS-Developer@lists.osgeo.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">QGIS-Developer@lists.osgeo.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">List info:<span class="m_1497404844223603323Apple-converted-space"> </span></span><a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Unsubscribe:<span class="m_1497404844223603323Apple-converted-space"> </span></span><a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.<wbr>osgeo.org/mailman/listinfo/<wbr>qgis-developer</a></div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Michal Zimmermann (zimmi) <br>WWW: <a href="https://www.zimmi.cz" target="_blank">https://www.zimmi.cz</a></div></div></div>
</div>