Skip to content

Commit

Permalink
Merge pull request #40 from qgis/36-show-the-number-of-resource-in-th…
Browse files Browse the repository at this point in the history
…e-title-bar

Show the Number of Resources in the Title Bar
  • Loading branch information
ismailsunni authored Jun 14, 2023
2 parents fa52794 + 5739bd5 commit 521ca18
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qgis_hub_plugin/gui/resource_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def populate_resources(self, force_update=False):
text = self.tr(f"Successfully populated the resources")
self.iface.messageBar().pushMessage(self.tr("Success"), text, duration=5)

self.update_title_bar()

def update_checkbox_states(self):
geopackage_checked = self.checkBoxGeopackage.isChecked()
style_checked = self.checkBoxStyle.isChecked()
Expand Down Expand Up @@ -134,6 +136,8 @@ def on_filter_text_changed(self, text):
)
self.proxy_model.setCheckboxStates(self.checkbox_states)

self.update_title_bar()

@pyqtSlot("QItemSelection", "QItemSelection")
def on_resource_selection_changed(self, selected, deselected):
if self.selected_resource():
Expand Down Expand Up @@ -263,6 +267,14 @@ def add_model_to_qgis(self):
"model"
).refreshAlgorithms()

def update_title_bar(self):
num_total_resources = len(self.resources)
num_selected_resources = self.proxy_model.rowCount()
window_title = self.tr(
f"QGIS Hub Explorer ({num_selected_resources} of {num_total_resources})"
)
self.setWindowTitle(window_title)


# TODO: do it QGIS task to have
def download_resource_file(url: str, file_path: str):
Expand Down

0 comments on commit 521ca18

Please sign in to comment.