Skip to content

Commit 4d77431

Browse files
committed
MetaSearch: consolidate "Add WxS" buttons into single dropdown button
1 parent 2af1e9f commit 4d77431

File tree

2 files changed

+109
-81
lines changed

2 files changed

+109
-81
lines changed

python/plugins/MetaSearch/dialogs/maindialog.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ def __init__(self, iface):
128128
self.btnNext.clicked.connect(self.navigate)
129129
self.btnLast.clicked.connect(self.navigate)
130130

131-
self.btnAddToWms.clicked.connect(self.add_to_ows)
132-
self.btnAddToWfs.clicked.connect(self.add_to_ows)
133-
self.btnAddToWcs.clicked.connect(self.add_to_ows)
131+
self.mActionAddWms.triggered.connect(self.add_to_ows)
132+
self.mActionAddWfs.triggered.connect(self.add_to_ows)
133+
self.mActionAddWcs.triggered.connect(self.add_to_ows)
134134
self.btnShowXml.clicked.connect(self.show_xml)
135135

136136
# settings
@@ -614,13 +614,14 @@ def find_services(self, record, item):
614614
wcs_link_types]):
615615
if link_type in wmswmst_link_types:
616616
services['wms'] = link['url']
617-
self.btnAddToWms.setEnabled(True)
617+
self.mActionAddWms.setEnabled(True)
618618
if link_type in wfs_link_types:
619619
services['wfs'] = link['url']
620-
self.btnAddToWfs.setEnabled(True)
620+
self.mActionAddWfs.setEnabled(True)
621621
if link_type in wcs_link_types:
622622
services['wcs'] = link['url']
623-
self.btnAddToWcs.setEnabled(True)
623+
self.mActionAddWcs.setEnabled(True)
624+
self.tbAddData.setEnabled(True)
624625

625626
set_item_data(item, 'link', json.dumps(services))
626627

@@ -695,13 +696,13 @@ def add_to_ows(self):
695696
caller = self.sender().objectName()
696697

697698
# stype = human name,/Qgis/connections-%s,providername
698-
if caller == 'btnAddToWms':
699+
if caller == 'mActionAddWms':
699700
stype = ['OGC:WMS/OGC:WMTS', 'wms', 'wms']
700701
data_url = item_data['wms']
701-
elif caller == 'btnAddToWfs':
702+
elif caller == 'mActionAddWfs':
702703
stype = ['OGC:WFS', 'wfs', 'WFS']
703704
data_url = item_data['wfs']
704-
elif caller == 'btnAddToWcs':
705+
elif caller == 'mActionAddWcs':
705706
stype = ['OGC:WCS', 'wcs', 'wcs']
706707
data_url = item_data['wcs']
707708

@@ -834,9 +835,10 @@ def reset_buttons(self, services=True, xml=True, navigation=True):
834835
"""Convenience function to disable WMS/WMTS|WFS|WCS buttons"""
835836

836837
if services:
837-
self.btnAddToWms.setEnabled(False)
838-
self.btnAddToWfs.setEnabled(False)
839-
self.btnAddToWcs.setEnabled(False)
838+
self.tbAddData.setEnabled(False)
839+
self.mActionAddWms.setEnabled(False)
840+
self.mActionAddWfs.setEnabled(False)
841+
self.mActionAddWcs.setEnabled(False)
840842

841843
if xml:
842844
self.btnShowXml.setEnabled(False)

python/plugins/MetaSearch/ui/maindialog.ui

+95-69
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>653</width>
9+
<width>656</width>
1010
<height>550</height>
1111
</rect>
1212
</property>
13+
<property name="sizePolicy">
14+
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
15+
<horstretch>0</horstretch>
16+
<verstretch>0</verstretch>
17+
</sizepolicy>
18+
</property>
1319
<property name="windowTitle">
1420
<string>MetaSearch</string>
1521
</property>
@@ -193,14 +199,41 @@
193199
<string>Results</string>
194200
</property>
195201
<layout class="QGridLayout" name="gridLayout_5">
196-
<item row="0" column="0" colspan="3">
202+
<item row="1" column="0" colspan="3">
197203
<widget class="QLabel" name="lblResults">
198204
<property name="text">
199205
<string/>
200206
</property>
201207
</widget>
202208
</item>
203-
<item row="1" column="0" colspan="5">
209+
<item row="3" column="0">
210+
<widget class="QPushButton" name="btnFirst">
211+
<property name="text">
212+
<string>&lt;&lt;</string>
213+
</property>
214+
</widget>
215+
</item>
216+
<item row="1" column="3" colspan="2">
217+
<widget class="QPushButton" name="btnShowXml">
218+
<property name="text">
219+
<string>View search results as XML</string>
220+
</property>
221+
</widget>
222+
</item>
223+
<item row="3" column="1">
224+
<widget class="QPushButton" name="btnPrev">
225+
<property name="minimumSize">
226+
<size>
227+
<width>145</width>
228+
<height>27</height>
229+
</size>
230+
</property>
231+
<property name="text">
232+
<string>&lt;</string>
233+
</property>
234+
</widget>
235+
</item>
236+
<item row="2" column="0" colspan="5">
204237
<widget class="QTreeWidget" name="treeRecords">
205238
<property name="toolTip">
206239
<string>Double click to see full record information</string>
@@ -238,50 +271,36 @@
238271
</column>
239272
</widget>
240273
</item>
241-
<item row="2" column="1">
242-
<widget class="QPushButton" name="btnPrev">
274+
<item row="3" column="4">
275+
<widget class="QPushButton" name="btnLast">
243276
<property name="minimumSize">
244277
<size>
245-
<width>145</width>
246-
<height>27</height>
278+
<width>140</width>
279+
<height>0</height>
247280
</size>
248281
</property>
249282
<property name="text">
250-
<string>&lt;</string>
251-
</property>
252-
</widget>
253-
</item>
254-
<item row="0" column="3" colspan="2">
255-
<widget class="QPushButton" name="btnShowXml">
256-
<property name="text">
257-
<string>View search results as XML</string>
258-
</property>
259-
</widget>
260-
</item>
261-
<item row="2" column="0">
262-
<widget class="QPushButton" name="btnFirst">
263-
<property name="text">
264-
<string>&lt;&lt;</string>
283+
<string>&gt;&gt;</string>
265284
</property>
266285
</widget>
267286
</item>
268-
<item row="4" column="0">
269-
<widget class="QPushButton" name="btnAddToWms">
270-
<property name="sizePolicy">
271-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
272-
<horstretch>0</horstretch>
273-
<verstretch>0</verstretch>
274-
</sizepolicy>
287+
<item row="3" column="3">
288+
<widget class="QPushButton" name="btnNext">
289+
<property name="minimumSize">
290+
<size>
291+
<width>140</width>
292+
<height>0</height>
293+
</size>
275294
</property>
276295
<property name="text">
277-
<string>Add WMS/WMTS</string>
296+
<string>&gt;</string>
278297
</property>
279298
</widget>
280299
</item>
281-
<item row="4" column="1">
282-
<widget class="QPushButton" name="btnAddToWfs">
300+
<item row="5" column="0">
301+
<widget class="QToolButton" name="tbAddData">
283302
<property name="sizePolicy">
284-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
303+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
285304
<horstretch>0</horstretch>
286305
<verstretch>0</verstretch>
287306
</sizepolicy>
@@ -292,48 +311,57 @@
292311
<height>27</height>
293312
</size>
294313
</property>
295-
<property name="text">
296-
<string>Add WFS</string>
297-
</property>
298-
</widget>
299-
</item>
300-
<item row="2" column="4">
301-
<widget class="QPushButton" name="btnLast">
302-
<property name="minimumSize">
314+
<property name="maximumSize">
303315
<size>
304-
<width>140</width>
305-
<height>0</height>
316+
<width>145</width>
317+
<height>27</height>
306318
</size>
307319
</property>
308320
<property name="text">
309-
<string>&gt;&gt;</string>
321+
<string>Add Data</string>
310322
</property>
311-
</widget>
312-
</item>
313-
<item row="4" column="3">
314-
<widget class="QPushButton" name="btnAddToWcs">
315-
<property name="sizePolicy">
316-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
317-
<horstretch>0</horstretch>
318-
<verstretch>0</verstretch>
319-
</sizepolicy>
323+
<property name="popupMode">
324+
<enum>QToolButton::InstantPopup</enum>
320325
</property>
321-
<property name="text">
322-
<string>Add WCS</string>
326+
<property name="toolButtonStyle">
327+
<enum>Qt::ToolButtonTextOnly</enum>
323328
</property>
324-
</widget>
325-
</item>
326-
<item row="2" column="3">
327-
<widget class="QPushButton" name="btnNext">
328-
<property name="minimumSize">
329-
<size>
330-
<width>140</width>
331-
<height>0</height>
332-
</size>
329+
<property name="autoRaise">
330+
<bool>false</bool>
333331
</property>
334-
<property name="text">
335-
<string>&gt;</string>
332+
<property name="arrowType">
333+
<enum>Qt::NoArrow</enum>
336334
</property>
335+
<action name="mActionAddWms">
336+
<property name="icon">
337+
<iconset>
338+
<normaloff>:/images/themes/default/mActionAddWmsLayer.svg</normaloff>:/images/themes/default/mActionAddWmsLayer.svg</iconset>
339+
</property>
340+
<property name="text">
341+
<string>Add WMS/WMTS</string>
342+
</property>
343+
</action>
344+
<action name="mActionAddWfs">
345+
<property name="icon">
346+
<iconset>
347+
<normaloff>:/images/themes/default/mActionAddWfsLayer.svg</normaloff>:/images/themes/default/mActionAddWfsLayer.svg</iconset>
348+
</property>
349+
<property name="text">
350+
<string>Add WFS</string>
351+
</property>
352+
</action>
353+
<action name="mActionAddWcs">
354+
<property name="icon">
355+
<iconset>
356+
<normaloff>:/images/themes/default/mActionAddWcsLayer.svg</normaloff>:/images/themes/default/mActionAddWcsLayer.svg</iconset>
357+
</property>
358+
<property name="text">
359+
<string>Add WCS</string>
360+
</property>
361+
</action>
362+
<addaction name="mActionAddWms"/>
363+
<addaction name="mActionAddWfs"/>
364+
<addaction name="mActionAddWcs"/>
337365
</widget>
338366
</item>
339367
</layout>
@@ -342,11 +370,9 @@
342370
<zorder>btnPrev</zorder>
343371
<zorder>btnFirst</zorder>
344372
<zorder>btnShowXml</zorder>
345-
<zorder>btnAddToWms</zorder>
346-
<zorder>btnAddToWfs</zorder>
347373
<zorder>btnLast</zorder>
348-
<zorder>btnAddToWcs</zorder>
349374
<zorder>btnNext</zorder>
375+
<zorder>tbAddData</zorder>
350376
</widget>
351377
</item>
352378
</layout>

0 commit comments

Comments
 (0)