On Mon, Nov 13, 2017 at 3:59 PM, Tom Kralidis <[email protected]> wrote:
> On Mon, Nov 13, 2017 at 9:18 AM, Alessandro Pasotti <[email protected]> > wrote: > > On Mon, Nov 13, 2017 at 3:06 PM, Tom Kralidis <[email protected]> > wrote: > >> > >> Hi devs: > >> > >> Given https://issues.qgis.org/issues/17347 I'm working on fixing > >> MetaSearch > >> provider connections in master. The core part of the code is currently > at > >> [1]. A > >> standalone example can be found at [2]. Result is that the WMS/WMTS > >> provider > >> opens connecting to the selected WMS/WMTS (good). When clicking 'Ok', > >> 'Close', > >> or 'Add', the WMS/WMTS layer is added (expecting 'Close' to simply > >> close the dialog > >> and 'Ok' to add the layer and then close). Finally clicking the 'X' > >> (top right) closes > >> the dialog as expected. > >> > >> - are there other slots to call instead? > >> - should the Data Source Manager be used instead [3]? Are there plans > >> for providing > >> Python binding to this? > > > > > > > > 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: > > > > class ConcreteDataSourceWidget(QgsAbstractDataSourceWidget): > > pass > > > > class ConcreteSourceSelectProvider(QgsSourceSelectProvider): > > > > def providerKey(self): > > return "MyTestProviderKey" > > > > def text(self): > > return "MyTestProviderText" > > > > def icon(self): > > return QIcon() > > > > def createDataSourceWidget(self): > > return ConcreteDataSourceWidget() > > > > def ordering(self): > > return 1 > > > > registry = QgsSourceSelectProviderRegistry() > > registry.addProvider(ConcreteSourceSelectProvider()) > > > > 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. > > > > Thanks Alessandro. Is this example to add a provider type? MetaSearch > simply wants to open a given existing provider dialog, open based on a > given > provider type and let the user interact from there. > > ..Tom > 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. Maybe you wanted to use this: http://qgis.org/api/classQgsDataSourceManagerDialog.html#a6b9046d38467a13ec321a70166bff289 Btw you can also get the individual source selects from provider registry: QgsProviderRegistry.instance().createSelectionWidget('ogr').show() Cheers. > > > > > > > >> > >> > >> Thanks > >> > >> ..Tom > >> > >> [1] > >> https://github.com/qgis/QGIS/blob/master/python/plugins/ > MetaSearch/dialogs/maindialog.py#L759-L792 > >> [2] https://gist.github.com/tomkralidis/dccb49efa760a585be38ee0c3188b8 > b3 > >> [3] http://qgis.org/api/classQgsDataSourceManagerDialog.html > >> _______________________________________________ > >> QGIS-Developer mailing list > >> [email protected] > >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > > > > > > > > -- > > Alessandro Pasotti > > w3: www.itopen.it > -- Alessandro Pasotti w3: www.itopen.it
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
