Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MetaSearch: consolidate "Add WxS" buttons into single dropdown button
  • Loading branch information
tomkralidis committed Mar 9, 2017
1 parent 2af1e9f commit 4d77431
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 81 deletions.
26 changes: 14 additions & 12 deletions python/plugins/MetaSearch/dialogs/maindialog.py
Expand Up @@ -128,9 +128,9 @@ def __init__(self, iface):
self.btnNext.clicked.connect(self.navigate)
self.btnLast.clicked.connect(self.navigate)

self.btnAddToWms.clicked.connect(self.add_to_ows)
self.btnAddToWfs.clicked.connect(self.add_to_ows)
self.btnAddToWcs.clicked.connect(self.add_to_ows)
self.mActionAddWms.triggered.connect(self.add_to_ows)
self.mActionAddWfs.triggered.connect(self.add_to_ows)
self.mActionAddWcs.triggered.connect(self.add_to_ows)
self.btnShowXml.clicked.connect(self.show_xml)

# settings
Expand Down Expand Up @@ -614,13 +614,14 @@ def find_services(self, record, item):
wcs_link_types]):
if link_type in wmswmst_link_types:
services['wms'] = link['url']
self.btnAddToWms.setEnabled(True)
self.mActionAddWms.setEnabled(True)
if link_type in wfs_link_types:
services['wfs'] = link['url']
self.btnAddToWfs.setEnabled(True)
self.mActionAddWfs.setEnabled(True)
if link_type in wcs_link_types:
services['wcs'] = link['url']
self.btnAddToWcs.setEnabled(True)
self.mActionAddWcs.setEnabled(True)
self.tbAddData.setEnabled(True)

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

Expand Down Expand Up @@ -695,13 +696,13 @@ def add_to_ows(self):
caller = self.sender().objectName()

# stype = human name,/Qgis/connections-%s,providername
if caller == 'btnAddToWms':
if caller == 'mActionAddWms':
stype = ['OGC:WMS/OGC:WMTS', 'wms', 'wms']
data_url = item_data['wms']
elif caller == 'btnAddToWfs':
elif caller == 'mActionAddWfs':
stype = ['OGC:WFS', 'wfs', 'WFS']
data_url = item_data['wfs']
elif caller == 'btnAddToWcs':
elif caller == 'mActionAddWcs':
stype = ['OGC:WCS', 'wcs', 'wcs']
data_url = item_data['wcs']

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

if services:
self.btnAddToWms.setEnabled(False)
self.btnAddToWfs.setEnabled(False)
self.btnAddToWcs.setEnabled(False)
self.tbAddData.setEnabled(False)
self.mActionAddWms.setEnabled(False)
self.mActionAddWfs.setEnabled(False)
self.mActionAddWcs.setEnabled(False)

if xml:
self.btnShowXml.setEnabled(False)
Expand Down
164 changes: 95 additions & 69 deletions python/plugins/MetaSearch/ui/maindialog.ui
Expand Up @@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<width>656</width>
<height>550</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MetaSearch</string>
</property>
Expand Down Expand Up @@ -193,14 +199,41 @@
<string>Results</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="3">
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="lblResults">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<item row="3" column="0">
<widget class="QPushButton" name="btnFirst">
<property name="text">
<string>&lt;&lt;</string>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<widget class="QPushButton" name="btnShowXml">
<property name="text">
<string>View search results as XML</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="btnPrev">
<property name="minimumSize">
<size>
<width>145</width>
<height>27</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<widget class="QTreeWidget" name="treeRecords">
<property name="toolTip">
<string>Double click to see full record information</string>
Expand Down Expand Up @@ -238,50 +271,36 @@
</column>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnPrev">
<item row="3" column="4">
<widget class="QPushButton" name="btnLast">
<property name="minimumSize">
<size>
<width>145</width>
<height>27</height>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="2">
<widget class="QPushButton" name="btnShowXml">
<property name="text">
<string>View search results as XML</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnFirst">
<property name="text">
<string>&lt;&lt;</string>
<string>&gt;&gt;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="btnAddToWms">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="3" column="3">
<widget class="QPushButton" name="btnNext">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Add WMS/WMTS</string>
<string>&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="btnAddToWfs">
<item row="5" column="0">
<widget class="QToolButton" name="tbAddData">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -292,48 +311,57 @@
<height>27</height>
</size>
</property>
<property name="text">
<string>Add WFS</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="btnLast">
<property name="minimumSize">
<property name="maximumSize">
<size>
<width>140</width>
<height>0</height>
<width>145</width>
<height>27</height>
</size>
</property>
<property name="text">
<string>&gt;&gt;</string>
<string>Add Data</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="btnAddToWcs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="text">
<string>Add WCS</string>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="btnNext">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
<property name="autoRaise">
<bool>false</bool>
</property>
<property name="text">
<string>&gt;</string>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
<action name="mActionAddWms">
<property name="icon">
<iconset>
<normaloff>:/images/themes/default/mActionAddWmsLayer.svg</normaloff>:/images/themes/default/mActionAddWmsLayer.svg</iconset>
</property>
<property name="text">
<string>Add WMS/WMTS</string>
</property>
</action>
<action name="mActionAddWfs">
<property name="icon">
<iconset>
<normaloff>:/images/themes/default/mActionAddWfsLayer.svg</normaloff>:/images/themes/default/mActionAddWfsLayer.svg</iconset>
</property>
<property name="text">
<string>Add WFS</string>
</property>
</action>
<action name="mActionAddWcs">
<property name="icon">
<iconset>
<normaloff>:/images/themes/default/mActionAddWcsLayer.svg</normaloff>:/images/themes/default/mActionAddWcsLayer.svg</iconset>
</property>
<property name="text">
<string>Add WCS</string>
</property>
</action>
<addaction name="mActionAddWms"/>
<addaction name="mActionAddWfs"/>
<addaction name="mActionAddWcs"/>
</widget>
</item>
</layout>
Expand All @@ -342,11 +370,9 @@
<zorder>btnPrev</zorder>
<zorder>btnFirst</zorder>
<zorder>btnShowXml</zorder>
<zorder>btnAddToWms</zorder>
<zorder>btnAddToWfs</zorder>
<zorder>btnLast</zorder>
<zorder>btnAddToWcs</zorder>
<zorder>btnNext</zorder>
<zorder>tbAddData</zorder>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 4d77431

Please sign in to comment.