<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 13, 2017 at 4:24 PM, Tom Kralidis <span dir="ltr"><<a href="mailto:tomkralidis@gmail.com" target="_blank">tomkralidis@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 class="HOEnZb"><div>On Mon, Nov 13, 2017 at 10:17 AM, Alessandro Pasotti <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>> wrote:<br>
> On Mon, Nov 13, 2017 at 3:59 PM, Tom Kralidis <<a href="mailto:tomkralidis@gmail.com">tomkralidis@gmail.com</a>> wrote:<br>
>><br>
>> On Mon, Nov 13, 2017 at 9:18 AM, Alessandro Pasotti <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>><br>
>> wrote:<br>
>> > On Mon, Nov 13, 2017 at 3:06 PM, Tom Kralidis <<a href="mailto:tomkralidis@gmail.com">tomkralidis@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi devs:<br>
>> >><br>
>> >> Given <a href="https://issues.qgis.org/issues/17347" rel="noreferrer" target="_blank">https://issues.qgis.org/<wbr>issues/17347</a> I'm working on fixing<br>
>> >> MetaSearch<br>
>> >> provider connections in master. The core part of the code is currently<br>
>> >> at<br>
>> >> [1]. A<br>
>> >> standalone example can be found at [2].  Result is that the WMS/WMTS<br>
>> >> provider<br>
>> >> opens connecting to the selected WMS/WMTS (good).  When clicking 'Ok',<br>
>> >> 'Close',<br>
>> >> or 'Add', the WMS/WMTS layer is added (expecting 'Close' to simply<br>
>> >> close the dialog<br>
>> >> and 'Ok' to add the layer and then close).  Finally clicking the 'X'<br>
>> >> (top right) closes<br>
>> >> the dialog as expected.<br>
>> >><br>
>> >> - are there other slots to call instead?<br>
>> >> - should the Data Source Manager be used instead [3]?  Are there plans<br>
>> >> for providing<br>
>> >> Python binding to this? <br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
>> ><br>
>> ><br>
>> ><br>
>> > I can't tell if it's a good idea, but you can definitely add whatever<br>
>> > you<br>
>> > want to the DataSourceManager dialog with plain python:<br>
>> ><br>
>> > class ConcreteDataSourceWidget(<wbr>QgsAbstractDataSourceWidget):<br>
>> >     pass<br>
>> ><br>
>> > class ConcreteSourceSelectProvider(<wbr>QgsSourceSelectProvider):<br>
>> ><br>
>> >     def providerKey(self):<br>
>> >         return "MyTestProviderKey"<br>
>> ><br>
>> >     def text(self):<br>
>> >         return "MyTestProviderText"<br>
>> ><br>
>> >     def icon(self):<br>
>> >         return QIcon()<br>
>> ><br>
>> >     def createDataSourceWidget(self):<br>
>> >         return ConcreteDataSourceWidget()<br>
>> ><br>
>> >     def ordering(self):<br>
>> >         return 1<br>
>> ><br>
>> > registry = QgsSourceSelectProviderRegistr<wbr>y()<br>
>> > registry.addProvider(<wbr>ConcreteSourceSelectProvider()<wbr>)<br>
>> ><br>
>> > Note that the DataSourceManager dialog is created when QGIS starts, you<br>
>> > will<br>
>> > want to register your provider early in the startup process, for now,<br>
>> > there<br>
>> > is no way to refresh the dialog after it has been constructed.<br>
>> ><br>
>><br>
>> Thanks Alessandro.  Is this example to add a provider type?  MetaSearch<br>
>> simply wants to open a given existing provider dialog, open based on a<br>
>> given<br>
>> provider type and let the user interact from there.<br>
>><br>
>> ..Tom<br>
><br>
><br>
><br>
> Yes, that's the way to add a new "provider" (it does not really need to be a<br>
> provider) to the items in the data source manager dialog.<br>
><br>
> Maybe you wanted to use this:<br>
> <a href="http://qgis.org/api/classQgsDataSourceManagerDialog.html#a6b9046d38467a13ec321a70166bff289" rel="noreferrer" target="_blank">http://qgis.org/api/<wbr>classQgsDataSourceManagerDialo<wbr>g.html#<wbr>a6b9046d38467a13ec321a70166bff<wbr>289</a><br>
><br>
<br>
</div></div>Thanks Alessandro.  Is QgsDataSourceManagerDialog planned to be<br>
available via Python?  See:<br>
<br>
<a href="http://qgis.org/api/classQgsDataSourceManagerDialog.html" rel="noreferrer" target="_blank">http://qgis.org/api/<wbr>classQgsDataSourceManagerDialo<wbr>g.html</a> (docs say not<br>
available in Python<br>
bindings)<br>
<span class=""><br></span></blockquote><div><br></div><div><br></div><div>Yes, that was planned. The idea was to build a generic re-usable widget to select data sources.</div><div><br></div><div>But you are probably talking about exposing it through iface, correct?</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
> Btw you can also get the individual source selects from provider registry:<br>
> QgsProviderRegistry.instance()<wbr>.createSelectionWidget('ogr').<wbr>show()<br>
><br>
<br>
</span>This is exactly what MetaSearch is doing currently which results in the<br>
issues originally mentioned.<br>
<span class="HOEnZb"><font color="#888888"><br>
..Tom<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
><br>
> Cheers.<br>
><br>
>><br>
>> ><br>
>> ><br>
>> ><br>
>> >><br>
>> >><br>
>> >> Thanks<br>
>> >><br>
>> >> ..Tom<br>
>> >><br>
>> >> [1]<br>
>> >><br>
>> >> <a href="https://github.com/qgis/QGIS/blob/master/python/plugins/MetaSearch/dialogs/maindialog.py#L759-L792" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/<wbr>blob/master/python/plugins/<wbr>MetaSearch/dialogs/maindialog.<wbr>py#L759-L792</a><br>
>> >> [2]<br>
>> >> <a href="https://gist.github.com/tomkralidis/dccb49efa760a585be38ee0c3188b8b3" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>tomkralidis/<wbr>dccb49efa760a585be38ee0c3188b8<wbr>b3</a><br>
>> >> [3] <a href="http://qgis.org/api/classQgsDataSourceManagerDialog.html" rel="noreferrer" target="_blank">http://qgis.org/api/<wbr>classQgsDataSourceManagerDialo<wbr>g.html</a><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>
>> ><br>
>> ><br>
>> > --<br>
>> > Alessandro Pasotti<br>
>> > w3:   <a href="http://www.itopen.it" rel="noreferrer" target="_blank">www.itopen.it</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Alessandro Pasotti<br>
> w3:   <a href="http://www.itopen.it" rel="noreferrer" target="_blank">www.itopen.it</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div>