Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow to open data loader dialog from metasearch
fixes #34759

(cherry picked from commit eca5261)
  • Loading branch information
DelazJ authored and nyalldawson committed Mar 16, 2020
1 parent 8e655d9 commit f42360c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/plugins/MetaSearch/dialogs/maindialog.py
Expand Up @@ -41,7 +41,7 @@
from qgis.core import (QgsApplication, QgsCoordinateReferenceSystem,
QgsCoordinateTransform, QgsGeometry, QgsPointXY,
QgsProviderRegistry, QgsSettings, QgsProject)
from qgis.gui import QgsRubberBand
from qgis.gui import QgsRubberBand, QgsGui
from qgis.utils import OverrideCursor

with warnings.catch_warnings():
Expand Down Expand Up @@ -748,8 +748,7 @@ def add_to_ows(self):
self.settings.endGroup()

# open provider window
ows_provider = QgsProviderRegistry.instance().createSelectionWidget(stype[2],
self)
ows_provider = QgsGui.providerGuiRegistry().sourceSelectProviders(stype[2])[0].createDataSourceWidget()
service_type = stype[0]

# connect dialog signals to iface slots
Expand Down Expand Up @@ -777,8 +776,6 @@ def addAfsLayer(path, name):
ows_provider.addVectorLayer.connect(addAfsLayer)
conn_cmb = ows_provider.findChild(QComboBox)
connect = 'connectToServer'
ows_provider.setModal(False)
ows_provider.show()

# open provider dialogue against added OWS
index = conn_cmb.findText(sname)
Expand All @@ -791,6 +788,9 @@ def addAfsLayer(path, name):
ows_provider.cmbConnections_activated(index)
getattr(ows_provider, connect)()

ows_provider.setWindowModality(Qt.WindowModal)
ows_provider.exec_()

def add_gis_file(self):
"""add GIS file from result"""
item = self.treeRecords.currentItem()
Expand Down

2 comments on commit f42360c

@simone100
Copy link

@simone100 simone100 commented on f42360c May 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified as suggested but there is no improvement! Metashearch continue to have script problems

@simone100
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError: 'NoneType' object has no attribute 'addRasterLayer'
Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis-ltr/./python/plugins\MetaSearch\dialogs\maindialog.py", line 757, in add_to_ows
ows_provider.addRasterLayer.connect(self.iface.addRasterLayer)

AttributeError: 'NoneType' object has no attribute 'addRasterLayer'

After copying your script it continues to give: seems there is no valid script in the file and the error remains

Please sign in to comment.