Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the Number of Resources in the Title Bar #40

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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