<div dir="ltr">Hi<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 26, 2014 at 2:45 PM, Anita Graser <span dir="ltr"><<a href="mailto:anitagraser@gmx.at" target="_blank">anitagraser@gmx.at</a>></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">Hi,<br>
<br>
I'm wondering if there is an advantage in using pyuic to manually compile .ui files instead of just using uic.loadUi() in the plugin directly, e.g.<br>
<br>
from PyQt4 import uic<br>
self.dock = uic.loadUi( os.path.join( path, "dockwidget2.ui" ) )<br>
<br></blockquote><div><br></div><div>As Martin mentioned, getting the class type back is nicer. I tested this and it works nicely:</div><div><br></div><div><br></div><div>----------------</div><div><br></div><div><div>import os</div>
<div><br></div><div>from PyQt4 import QtCore, QtGui, uic</div><div><br></div><div>BASE_CLASS = uic.loadUiType(os.path.join(</div><div> os.path.dirname(__file__), 'results_dialog_base.ui'))[0]</div><div><br></div>
<div><br></div><div>class ResultDialog(QtGui.QDialog, BASE_CLASS):</div><div> """Dialog for showing the results of the plugin creation process."""</div><div> def __init__(self):</div><div>
QtGui.QDialog.__init__(self)</div><div> # Set up the user interface from Designer.</div><div> self.setupUi(self)</div></div><div><br></div><div>--------------</div><div><br></div><div>The advantage is that you can use Qt multi-inheritance which means less and cleaner code. More details in the Qt section at [1].</div>
<div><br></div><div>[1] <a href="http://test.inasafe.org/en/developer-docs/coding_standards.html">http://test.inasafe.org/en/developer-docs/coding_standards.html</a><br></div><div><br></div><div>Regards</div><div><br></div>
<div>Tim</div><div><br></div><div><br></div><div> </div><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">
Thanks for any insights!<br>
<br>
Best wishes,<br>
Anita<span class=""><font color="#888888"><br>
<br>
<br>
<br>
-- <br>
<a href="http://anitagraser.com" target="_blank">anitagraser.com</a><br>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Tim Sutton - QGIS Project Steering Committee Member<br>==============================================<br>Please do not email me off-list with technical<br>
support questions. Using the lists will gain<br>more exposure for your issues and the knowledge<br>surrounding your issue will be shared with all.<br><br>Irc: timlinux on #qgis at <a href="http://freenode.net" target="_blank">freenode.net</a><br>
==============================================</div>
</div></div>