Skip to content

Commit

Permalink
Watershed: Include computational grid name in result selector combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
benvanbasten-ns committed Sep 21, 2023
1 parent 97f2203 commit f3b0214
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions threedi_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def initGui(self):
self.model.result_added.connect(self.watershed_tool.result_added)
self.model.result_removed.connect(self.watershed_tool.result_removed)
self.model.result_changed.connect(self.watershed_tool.result_changed)
self.model.grid_changed.connect(self.watershed_tool.grid_changed)
self.watershed_tool.closing.connect(self.loader.reset_styling)

# statistics signals
Expand Down
6 changes: 3 additions & 3 deletions tool_watershed/watershed_analysis_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def __init__(self, iface, model, preloaded_layers, parent=None):
def _populate_results(self) -> None:
self.comboBoxResult.clear()
for result in self.model.get_results(checked_only=False):
self.comboBoxResult.addItem(result.text(), result.id)
self.comboBoxResult.addItem(f"{result.parent().text()} | {result.text()}", result.id)

def select_result(self, index: int) -> None:
result_id = self.comboBoxResult.itemData(index)
Expand Down Expand Up @@ -932,7 +932,7 @@ def select_result(self, index: int) -> None:

def add_result(self, result_item: ThreeDiResultItem) -> None:
currentIndex = self.comboBoxResult.currentIndex()
self.comboBoxResult.addItem(result_item.text(), result_item.id)
self.comboBoxResult.addItem(f"{result_item.parent().text()} | {result_item.text()}", result_item.id)
self.comboBoxResult.setCurrentIndex(currentIndex)

def remove_result(self, result_item: ThreeDiResultItem):
Expand All @@ -949,7 +949,7 @@ def remove_result(self, result_item: ThreeDiResultItem):
def change_result(self, result_item: ThreeDiResultItem):
idx = self.comboBoxResult.findData(result_item.id)
assert idx != -1
self.comboBoxResult.setItemText(idx, result_item.text())
self.comboBoxResult.setItemText(idx, f"{result_item.parent().text()} | {result_item.text()}")

def closeEvent(self, event):
QgsProject.instance().cleared.disconnect(self.close)
Expand Down

0 comments on commit f3b0214

Please sign in to comment.