Skip to content

Commit

Permalink
[metasearch] Minor UI updates to conform to HIG (#7810)
Browse files Browse the repository at this point in the history
* [metasearch] Use QgsFilterLineEdit for keyword search box

* [metasearch] Remove version number from dialog title

This is no longer required now that the plugin is bundled with
QGIS - the version number now follows QGIS version numbering

* Capitalization, ellipsis

* [metasearch] Use a question messagebox
  • Loading branch information
nyalldawson authored and tomkralidis committed Sep 7, 2018
1 parent 36f592c commit 1002824
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 31 deletions.
16 changes: 9 additions & 7 deletions python/plugins/MetaSearch/dialogs/maindialog.py
Expand Up @@ -84,8 +84,10 @@ def __init__(self, iface):
self.catalog_password = None
self.context = StaticContext()

version = self.context.metadata.get('general', 'version')
self.setWindowTitle(self.tr('MetaSearch {0}').format(version))
self.leKeywords.setShowSearchIcon(True)
self.leKeywords.setPlaceholderText(self.tr('Search keywords'))

self.setWindowTitle(self.tr('MetaSearch'))

self.rubber_band = QgsRubberBand(self.map, True) # True = a polygon
self.rubber_band.setColor(QColor(255, 0, 0, 75))
Expand Down Expand Up @@ -297,7 +299,7 @@ def add_connection(self):
"""add new service"""

conn_new = NewConnectionDialog()
conn_new.setWindowTitle(self.tr('New Catalog service'))
conn_new.setWindowTitle(self.tr('New Catalog Service'))
if conn_new.exec_() == QDialog.Accepted: # add to service list
self.populate_connection_list()
self.textMetadata.clear()
Expand All @@ -310,7 +312,7 @@ def edit_connection(self):
url = self.settings.value('/MetaSearch/%s/url' % current_text)

conn_edit = NewConnectionDialog(current_text)
conn_edit.setWindowTitle(self.tr('Edit Catalog service'))
conn_edit.setWindowTitle(self.tr('Edit Catalog Service'))
conn_edit.leName.setText(current_text)
conn_edit.leURL.setText(url)
conn_edit.leUsername.setText(self.settings.value('/MetaSearch/%s/username' % current_text))
Expand All @@ -328,9 +330,9 @@ def delete_connection(self):

msg = self.tr('Remove service {0}?').format(current_text)

result = QMessageBox.information(self, self.tr('Confirm delete'), msg,
QMessageBox.Ok | QMessageBox.Cancel)
if result == QMessageBox.Ok: # remove service from list
result = QMessageBox.question(self, self.tr('Delete Service'), msg,
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if result == QMessageBox.Yes: # remove service from list
self.settings.remove(key)
index_to_delete = self.cmbConnectionsServices.currentIndex()
self.cmbConnectionsServices.removeItem(index_to_delete)
Expand Down
46 changes: 33 additions & 13 deletions python/plugins/MetaSearch/ui/maindialog.ui
Expand Up @@ -43,7 +43,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QLineEdit" name="leKeywords">
<widget class="QgsFilterLineEdit" name="leKeywords">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -216,7 +216,7 @@
<item row="1" column="3" colspan="2">
<widget class="QPushButton" name="btnShowXml">
<property name="text">
<string>View search results as XML</string>
<string>View Search Results as XML</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -418,42 +418,42 @@
<item row="1" column="0">
<widget class="QPushButton" name="btnServerInfo">
<property name="text">
<string>Service info</string>
<string>Service Info</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QPushButton" name="btnCapabilities">
<property name="text">
<string>GetCapabilities response</string>
<string>GetCapabilities Response</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnNew">
<property name="text">
<string>New</string>
<string>New</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnEdit">
<property name="text">
<string>Edit</string>
<string>Edit</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="btnDelete">
<property name="text">
<string>Delete</string>
<string>Delete</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="btnSave">
<property name="text">
<string>Save</string>
<string>Save</string>
</property>
</widget>
</item>
Expand All @@ -467,14 +467,14 @@
<item row="1" column="3" colspan="2">
<widget class="QPushButton" name="btnAddDefault">
<property name="text">
<string>Add default services</string>
<string>Add Default Services</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="btnLoad">
<property name="text">
<string>Load</string>
<string>Load</string>
</property>
</widget>
</item>
Expand All @@ -488,7 +488,7 @@
<item>
<widget class="QGroupBox" name="saveStrategyGroup">
<property name="title">
<string>Connection naming</string>
<string>Connection Naming</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
Expand Down Expand Up @@ -528,7 +528,7 @@
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Server timeout</string>
<string>Server Timeout</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand All @@ -551,7 +551,7 @@
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Results paging</string>
<string>Results Paging</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
Expand All @@ -577,6 +577,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
Expand Down Expand Up @@ -628,4 +641,11 @@
</hints>
</connection>
</connections>
<customwidgets>
<customwidget>
<class>QgsFilterLineEdit</class>
<extends>QLineEdit</extends>
<header>qgis.gui</header>
</customwidget>
</customwidgets>
</ui>
2 changes: 1 addition & 1 deletion python/plugins/MetaSearch/ui/manageconnectionsdialog.ui
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Manage connections</string>
<string>Manage Connections</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down
4 changes: 0 additions & 4 deletions python/plugins/MetaSearch/util.py
Expand Up @@ -29,7 +29,6 @@
warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)

import configparser
from gettext import gettext, ngettext
import logging
import os
Expand Down Expand Up @@ -59,9 +58,6 @@ class StaticContext(object):
def __init__(self):
"""init"""
self.ppath = os.path.dirname(os.path.abspath(__file__))
self.metadata = configparser.ConfigParser()
with codecs.open(os.path.join(self.ppath, 'metadata.txt'), "r", "utf8") as f:
self.metadata.read_file(f)


def get_ui_class(ui_file):
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmapsavedialog.cpp
Expand Up @@ -113,7 +113,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co
}
else
{
QPushButton *button = new QPushButton( tr( "Copy to clipboard" ) );
QPushButton *button = new QPushButton( tr( "Copy to Clipboard" ) );
buttonBox->addButton( button, QDialogButtonBox::ResetRole );
connect( button, &QPushButton::clicked, this, &QgsMapSaveDialog::copyToClipboard );
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/coordinate_capture/coordinatecapture.cpp
Expand Up @@ -128,7 +128,7 @@ void CoordinateCapture::initGui()
mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system (lat,lon or east,north)" ) );

QPushButton *mypCopyButton = new QPushButton( mypWidget );
mypCopyButton->setText( tr( "Copy to clipboard" ) );
mypCopyButton->setText( tr( "Copy to Clipboard" ) );
connect( mypCopyButton, &QAbstractButton::clicked, this, &CoordinateCapture::copy );

mpTrackMouseButton = new QToolButton( mypWidget );
Expand Down
8 changes: 4 additions & 4 deletions src/ui/qgsextentgroupboxwidget.ui
Expand Up @@ -86,7 +86,7 @@
</size>
</property>
<property name="text">
<string>Map view extent</string>
<string>Map Canvas Extent</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -138,7 +138,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Calculate from layer</string>
<string>Calculate from Layer</string>
</property>
</widget>
</item>
Expand All @@ -151,7 +151,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Draw on canvas</string>
<string>Draw on Canvas</string>
</property>
</widget>
</item>
Expand All @@ -164,7 +164,7 @@
</size>
</property>
<property name="text">
<string>Current layer extent</string>
<string>Current Layer Extent</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 1002824

Please sign in to comment.