Skip to content

Commit

Permalink
Merge pull request #990 from opengisch/busy2
Browse files Browse the repository at this point in the history
busy bar on topping exporter
  • Loading branch information
signedav authored Nov 27, 2024
2 parents fae8bcc + 84cb302 commit bb57e06
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions QgisModelBaker/gui/topping_wizard/ili2dbsettings_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,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()
parsed_from_file = False
if configuration:
Expand All @@ -306,6 +309,8 @@ def _schema_changed(self):
self.parameters_model.refresh_model(
self.topping_wizard.topping.metaconfig.ili2db_settings.parameters
)
self.topping_wizard.busy(self, False)

def _log_on_export_metagonfig_error(self, log):
QgsMessageLog.logMessage(log, self.tr("Export metaConfig"), Qgis.Critical)

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 bb57e06

Please sign in to comment.