<div dir="ltr"><div><div><div> It worked!<br><br>self.dockwidget = MyDockWidget()<br><br></div>That's the way it worked for me! <br><br></div>Thanks a lot !! ^^<br><br></div><br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-12-29 13:05 GMT+01:00 Richard Duivenvoorde <span dir="ltr"><<a href="mailto:rdmailings@duif.net" target="_blank">rdmailings@duif.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Apparently you do not declare the self.dockwidget anywhere?<br>
As everwhere where you try to USE that it appears to be None.<br>
<br>
Normally in the 'initGui' function you create your dialog or dockwidget<br>
using something like:<br>
<br>
self.dlg = MyDialog(self.iface)<br>
or in your case there should be:<br>
self.dockwidget = MyDockWidget(self.iface) <= your constructor<br>
<br>
my feeling is that you miss that step (or have a small naming error)<br>
<br>
HTH<br>
<br>
Richard Duivenvoorde<br>
<span class=""><br>
On 29-12-17 12:58, Luís Miguel Royo Pérez wrote:<br>
> Hello, I'm writing a QGIS plugin but I'm facing some basic problems. The<br>
> plugin is a dockwidget. I've built it with plugin Builder and then<br>
> compiled the resources file.<br>
><br>
> When I try to access the comboBox to populate it with values, an error<br>
> happens:<br>
><br>
</span>> /self.dockwidget.comboBox.<wbr>clear() AttributeError: 'NoneType' object<br>
> has no attribute 'comboBox'/<br>
<span class="">><br>
> I checked in the Qt _Designer the object name and it's comboBox. When I<br>
> do the same with a dialog plugin, instead a dockwidget, everything seems<br>
> to be right, and the comboBox is populated. This is the code for the run<br>
> method.<br>
><br>
</span>> |defrun(self):"""Run method that loads and starts the<br>
<span class="">> plugin"""self.dockwidget.<wbr>comboBox.clear()fori<br>
> inrange(9):self.dockwidget.<wbr>comboBox.addItem(str(i))<wbr>ifnotself.pluginIsActive:self.<wbr>pluginIsActive<br>
</span>> =True#print "** STARTING PruebaExp"# dockwidget may not exist if:# first<br>
> run of plugin# removed on close (see self.onClosePlugin<br>
> method)ifself.dockwidget ==None:# Create the dockwidget (after<br>
<span class="">> translation) and keep referenceself.dockwidget =PruebaExpDockWidget()#<br>
> connect to provide cleanup on closing of<br>
> dockwidgetself.dockwidget.<wbr>closingPlugin.connect(self.<wbr>onClosePlugin)#<br>
</span>> show the dockwidget# TODO: fix to allow choice of dock<br>
<span class="">> locationself.iface.<wbr>addDockWidget(Qt.<wbr>LeftDockWidgetArea,self.<wbr>dockwidget)self.dockwidget.<wbr>show()|<br>
><br>
> I don't know if it's related, but when I try to create a signal this<br>
> error is show:<br>
><br>
</span>> /File "XXXXXXXXXXX/PruebaExp.py", line 176, in initGui<br>
> self.dockwidget.signalBox.<wbr>connect(self.enviadato) AttributeError:<br>
> 'NoneType' object has no attribute 'signalBox'/<br>
<span class="">><br>
> Same error when I try to acces a pushButton:<br>
><br>
</span>> /File "/home/luismi/.qgis2/python/<wbr>plugins/PruebaExp/PruebaExp.<wbr>py", line<br>
> 221, in run/<br>
><br>
> /self.dockwidget.pushButton.<wbr>clicked.connect(self.<wbr>enviadato)/<br>
><br>
> /AttributeError: 'NoneType' object has no attribute 'pushButton'/<br>
<span class="">><br>
> Maybe is due to something I missed during the building of the plugin.<br>
> I'm using QGIS 2.18.14.<br>
><br>
><br>
><br>
> --<br>
> Luís Miguel Royo Pérez.<br>
> Analista-Programador GIS<br>
> Av. Blasco Ibañez nº 1. Manises (Valencia)<br>
> Teléfono: 679846103<br>
</span>> web: <a href="http://inisig.com" rel="noreferrer" target="_blank">inisig.com</a> <<a href="http://inisig.com" rel="noreferrer" target="_blank">http://inisig.com</a>><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span><font color="#888888"><span><font color="#888888">Luís Miguel Royo Pérez. <br>Analista-Programador GIS<br>Av. Blasco Ibañez nº 1. Manises (Valencia)<br>Teléfono: 679846103 <br>web: <a href="http://inisig.com" target="_blank">inisig.com</a></font></span></font></span><br><br></div></div></div>
</div>