Skip to content

Commit

Permalink
synchronize server widgets (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Feb 20, 2014
1 parent 232332c commit 2167739
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugin/MetaSearch/dialogs/maindialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(self, iface):
self.btnServerInfo.clicked.connect(self.connection_info)
self.btnAddDefault.clicked.connect(self.add_default_connections)
self.btnCapabilities.clicked.connect(self.show_xml)
self.tabWidget.currentChanged.connect(self.populate_connection_list)

# server management buttons
self.btnNew.clicked.connect(self.add_connection)
Expand Down Expand Up @@ -175,6 +176,7 @@ def set_connection_list_position(self):
for i in range(conn_count):
if self.cmbConnectionsServices.itemText(i) == to_select:
self.cmbConnectionsServices.setCurrentIndex(i)
self.cmbConnectionsSearch.setCurrentIndex(i)
exists = True
break

Expand All @@ -193,6 +195,7 @@ def set_connection_list_position(self):
current_index = conn_count - 1

self.cmbConnectionsServices.setCurrentIndex(current_index)
self.cmbConnectionsSearch.setCurrentIndex(current_index)

def save_connection(self):
"""save connection"""
Expand Down Expand Up @@ -249,6 +252,7 @@ def add_connection(self):
conn_new.setWindowTitle(self.tr('New Catalogue service'))
if conn_new.exec_() == QDialog.Accepted: # add to service list
self.populate_connection_list()
self.textMetadata.clear()

def edit_connection(self):
"""modify existing connection"""
Expand Down Expand Up @@ -277,8 +281,9 @@ def delete_connection(self):
QMessageBox.Ok | QMessageBox.Cancel)
if result == QMessageBox.Ok: # remove service from list
self.settings.remove(key)
self.cmbConnectionsServices.removeItem(
self.cmbConnectionsServices.currentIndex())
index_to_delete = self.cmbConnectionsServices.currentIndex()
self.cmbConnectionsServices.removeItem(index_to_delete)
self.cmbConnectionsSearch.removeItem(index_to_delete)
self.set_connection_list_position()

def load_connections(self):
Expand Down
1 change: 1 addition & 0 deletions plugin/MetaSearch/dialogs/newconnectiondialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def accept(self):
self.settings.remove(key_orig)

self.settings.setValue(keyurl, conn_url)
self.settings.setValue('/CSWClient/selected', conn_name)

QDialog.accept(self)

Expand Down

0 comments on commit 2167739

Please sign in to comment.