<div dir="ltr">On Mon, Nov 13, 2017 at 3:06 PM, Tom Kralidis <span dir="ltr"><<a href="mailto:tomkralidis@gmail.com" target="_blank">tomkralidis@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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 MetaSearch<br>
provider connections in master. The core part of the code is currently at [1]. A<br>
standalone example can be found at [2].  Result is that the WMS/WMTS provider<br>
opens connecting to the selected WMS/WMTS (good).  When clicking 'Ok', '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></blockquote><div><br></div><div><br></div><div>I can't tell if it's a good idea, but you can definitely add whatever you want to the DataSourceManager dialog with plain python:</div><div><br></div><div>class ConcreteDataSourceWidget(QgsAbstractDataSourceWidget):<br>    pass<br><br>class ConcreteSourceSelectProvider(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></div><div><br></div><div>registry = QgsSourceSelectProviderRegistry()<br>registry.addProvider(ConcreteSourceSelectProvider())</div><div></div><div><br></div><div>Note that the DataSourceManager dialog is created when QGIS starts, you will want to register your provider early in the startup process, for now, there is no way to refresh the dialog after it has been constructed.</div><div><br></div><div></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks<br>
<br>
..Tom<br>
<br>
[1] <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></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>