<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 13, 2017 at 3:59 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Mon, Nov 13, 2017 at 9:18 AM, Alessandro Pasotti <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>> wrote:<br>
> On Mon, Nov 13, 2017 at 3:06 PM, Tom Kralidis <<a href="mailto:tomkralidis@gmail.com">tomkralidis@gmail.com</a>> 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 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>
><br>
><br>
><br>
> I can't tell if it's a good idea, but you can definitely add whatever 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 will<br>
> want to register your provider early in the startup process, for now, there<br>
> is no way to refresh the dialog after it has been constructed.<br>
><br>
<br>
</div></div>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 given<br>
provider type and let the user interact from there.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
..Tom<br></font></span></blockquote><div><br></div><div><br></div><div>Yes, that's the way to add a new "provider" (it does not really need to be a provider) to the items in the data source manager dialog.</div><div><br></div><div>Maybe you wanted to use this: <a href="http://qgis.org/api/classQgsDataSourceManagerDialog.html#a6b9046d38467a13ec321a70166bff289">http://qgis.org/api/classQgsDataSourceManagerDialog.html#a6b9046d38467a13ec321a70166bff289</a></div><div><br></div><div>Btw you can also get the individual source selects from provider registry: QgsProviderRegistry.instance().createSelectionWidget('ogr').show()</div><div><br></div><div><br></div><div><br></div><div>Cheers.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-HOEnZb"><font color="#888888">
</font></span><div class="gmail-HOEnZb"><div class="gmail-h5"><br>
><br>
><br>
><br>
>><br>
>><br>
>> Thanks<br>
>><br>
>> ..Tom<br>
>><br>
>> [1]<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] <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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div>