Skip to content

Commit

Permalink
busy bar on topping exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Nov 27, 2024
1 parent f1d6841 commit c462134
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions QgisModelBaker/gui/topping_wizard/ili2dbsettings_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ def _refresh_combobox(self):
)

def _schema_changed(self):
self.topping_wizard.busy(
self, True, self.tr("Get ili2db settings of the current schema...")
)
configuration = self.schema_combobox.currentData()
if configuration:
db_connector = db_utils.get_db_connector(configuration)
Expand All @@ -299,3 +302,4 @@ def _schema_changed(self):
self.parameters_model.refresh_model(
self.topping_wizard.topping.metaconfig.ili2db_settings.parameters
)
self.topping_wizard.busy(self, False)
7 changes: 6 additions & 1 deletion QgisModelBaker/gui/topping_wizard/layers_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,12 @@ def __init__(self, parent, title):

self.categories_dialog = LayerStyleCategoriesDialog()
self.stylecat_delegate.button_clicked.connect(self.open_categories_dialog)
self.reset_button.clicked.connect(lambda: self.layermodel.reload(True))
self.reset_button.clicked.connect(self.reload_layermodel)

def reload_layermodel(self):
self.topping_wizard.busy(self, True, self.tr("Reload layertree..."))
self.layermodel.reload(True)
self.topping_wizard.busy(self, False)

def open_categories_dialog(self, index):
layername = index.data(int(Qt.DisplayRole))
Expand Down
2 changes: 2 additions & 0 deletions QgisModelBaker/gui/topping_wizard/models_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def validatePage(self) -> bool:
return super().validatePage()

def _refresh(self):
self.topping_wizard.busy(self, True, self.tr("Refresh model information..."))
self._load_available_models_and_sources()
self.models_model.check_entries(self.topping_wizard.topping.models)
self.topping_wizard.busy(self, False)

def _load_available_models_and_sources(self):
"""
Expand Down
6 changes: 6 additions & 0 deletions QgisModelBaker/gui/topping_wizard/referencedata_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def validatePage(self) -> bool:

def update_referecedata_cache_model(self, filter_models, type):
# updates the model and waits for the end
self.topping_wizard.busy(
self,
True,
self.tr("Search for available reference data in the repositories..."),
)
loop = QEventLoop()
self.ilireferencedatacache.model_refreshed.connect(lambda: loop.quit())
timer = QTimer()
Expand All @@ -144,6 +149,7 @@ def update_referecedata_cache_model(self, filter_models, type):
timer.start(3000)
self.refresh_referencedata_cache(filter_models, type)
loop.exec()
self.topping_wizard.busy(self, False)
return self.ilireferencedatacache.model

def refresh_referencedata_cache(self, filter_models, type):
Expand Down
8 changes: 8 additions & 0 deletions QgisModelBaker/gui/topping_wizard/topping_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ def id_changed(self, new_id):
self.tr(f" > ---------- {self._current_page_title(self.current_id)}")
)

def busy(self, page, busy, text="Busy..."):
page.setEnabled(not busy)
self.log_panel.busy_bar.setVisible(busy)
if busy:
self.log_panel.busy_bar.setFormat(text)
else:
self.log_panel.scrollbar.setValue(self.log_panel.scrollbar.maximum())

def _current_page_title(self, id):
if id == ToppingWizardPageIds.Target:
return self.tr("Target Folder Selection")
Expand Down

0 comments on commit c462134

Please sign in to comment.