diff --git a/QgisModelBaker/gui/panel/gpkg_config_panel.py b/QgisModelBaker/gui/panel/gpkg_config_panel.py index d6d70c6b..c61d47a8 100644 --- a/QgisModelBaker/gui/panel/gpkg_config_panel.py +++ b/QgisModelBaker/gui/panel/gpkg_config_panel.py @@ -62,7 +62,7 @@ def __init__(self, parent, db_action_type): def _show_panel(self): if ( - self._db_action_type == DbActionType.GENERATE + self._db_action_type == DbActionType.SCHEMA_IMPORT or self._db_action_type == DbActionType.IMPORT_DATA ): validator = self.gpkgSaveFileValidator @@ -73,7 +73,10 @@ def _show_panel(self): extensions=["." + ext for ext in self.ValidExtensions], dont_confirm_overwrite=True, ) - elif self._db_action_type == DbActionType.EXPORT: + elif ( + self._db_action_type == DbActionType.EXPORT + or self._db_action_type == DbActionType.GENERATE + ): validator = self.gpkgOpenFileValidator file_selector = make_file_selector( self.gpkg_file_line_edit, diff --git a/QgisModelBaker/gui/panel/mssql_config_panel.py b/QgisModelBaker/gui/panel/mssql_config_panel.py index 7898da55..7ef3475b 100644 --- a/QgisModelBaker/gui/panel/mssql_config_panel.py +++ b/QgisModelBaker/gui/panel/mssql_config_panel.py @@ -66,7 +66,7 @@ def __init__(self, parent, db_action_type): self.mssql_password_line_edit.textChanged.connect(self.notify_fields_modified) def _show_panel(self): - if self._db_action_type == DbActionType.GENERATE: + if self._db_action_type == DbActionType.SCHEMA_IMPORT: self.mssql_schema_line_edit.setPlaceholderText( self.tr("[Leave empty to create a default schema]") ) @@ -74,7 +74,10 @@ def _show_panel(self): self.mssql_schema_line_edit.setPlaceholderText( self.tr("[Leave empty to import data into a default schema]") ) - elif self._db_action_type == DbActionType.EXPORT: + elif ( + self._db_action_type == DbActionType.EXPORT + or self._db_action_type == DbActionType.GENERATE + ): self.mssql_schema_line_edit.setPlaceholderText( self.tr("[Enter a valid schema]") ) diff --git a/QgisModelBaker/gui/panel/pg_config_panel.py b/QgisModelBaker/gui/panel/pg_config_panel.py index 909bc4ff..bde65be2 100644 --- a/QgisModelBaker/gui/panel/pg_config_panel.py +++ b/QgisModelBaker/gui/panel/pg_config_panel.py @@ -193,13 +193,16 @@ def _show_panel(self): self._fill_schema_combo_box() if ( - self._db_action_type == DbActionType.GENERATE + self._db_action_type == DbActionType.SCHEMA_IMPORT or self._db_action_type == DbActionType.IMPORT_DATA ): self.pg_schema_combo_box.lineEdit().setPlaceholderText( self.tr("Schema Name") ) - elif self._db_action_type == DbActionType.EXPORT: + elif ( + self._db_action_type == DbActionType.EXPORT + or self._db_action_type == DbActionType.GENERATE + ): self.pg_schema_combo_box.lineEdit().setPlaceholderText( self.tr("[Enter a valid schema]") ) diff --git a/QgisModelBaker/gui/panel/session_panel.py b/QgisModelBaker/gui/panel/session_panel.py index eb4642f1..6f76fd86 100644 --- a/QgisModelBaker/gui/panel/session_panel.py +++ b/QgisModelBaker/gui/panel/session_panel.py @@ -80,7 +80,7 @@ def __init__( self.set_button_to_create_action.triggered.connect(self.set_button_to_create) self.db_action_type = db_action_type - if self.db_action_type == DbActionType.GENERATE: + if self.db_action_type == DbActionType.SCHEMA_IMPORT: self.create_without_constraints_text = self.tr("Run without constraints") else: self.create_without_constraints_text = self.tr("Run without validation") @@ -116,7 +116,7 @@ def __init__( and not self.configuration.dbusr ): self.configuration.dbusr = QgsApplication.userLoginName() - if self.db_action_type == DbActionType.GENERATE: + if self.db_action_type == DbActionType.SCHEMA_IMPORT: self.configuration.ilifile = "" if os.path.isfile(self.file): self.configuration.ilifile = self.file @@ -331,7 +331,7 @@ def run(self, edited_command=None): self.set_button_to_cancel() self.is_running = True - if self.db_action_type == DbActionType.GENERATE: + if self.db_action_type == DbActionType.SCHEMA_IMPORT: self._pre_generate_project() porter = self._get_porter() @@ -350,7 +350,7 @@ def run(self, edited_command=None): try: if porter.run(edited_command) != iliexecutable.IliExecutable.SUCCESS: self.progress_bar.setValue(0) - if not self.db_action_type == DbActionType.GENERATE: + if not self.db_action_type == DbActionType.SCHEMA_IMPORT: self.set_button_to_create_without_constraints() else: self.set_button_to_create() @@ -359,7 +359,7 @@ def run(self, edited_command=None): except JavaNotFoundError as e: self.print_info.emit(e.error_string, LogLevel.FAIL) self.progress_bar.setValue(0) - if not self.db_action_type == DbActionType.GENERATE: + if not self.db_action_type == DbActionType.SCHEMA_IMPORT: self.set_button_to_create_without_constraints() else: self.set_button_to_create() @@ -377,7 +377,7 @@ def run(self, edited_command=None): # an user interaction (cancel) here cannot interupt the process, why it's disabled (and enabled again below). self.setDisabled(True) if ( - self.db_action_type == DbActionType.GENERATE + self.db_action_type == DbActionType.SCHEMA_IMPORT and self.configuration.create_basket_col ): self._create_default_dataset() diff --git a/QgisModelBaker/gui/workflow_wizard/database_selection_page.py b/QgisModelBaker/gui/workflow_wizard/database_selection_page.py index 61cf14ce..bfd2ca77 100644 --- a/QgisModelBaker/gui/workflow_wizard/database_selection_page.py +++ b/QgisModelBaker/gui/workflow_wizard/database_selection_page.py @@ -45,7 +45,6 @@ def __init__(self, parent, title, db_action_type): self.setupUi(self) self.setTitle(title) - # in this context we use GENERATE for the project generation and the IMPORT_DATA for the schema import (and the data import) if db_action_type == DbActionType.GENERATE: self.description.setText( self.tr( diff --git a/QgisModelBaker/gui/workflow_wizard/execution_page.py b/QgisModelBaker/gui/workflow_wizard/execution_page.py index 9c813130..38a5dcf5 100644 --- a/QgisModelBaker/gui/workflow_wizard/execution_page.py +++ b/QgisModelBaker/gui/workflow_wizard/execution_page.py @@ -47,8 +47,7 @@ def __init__(self, parent, title, db_action_type): self.setupUi(self) self.setTitle(title) - # in this context we use GENERATE for the schema import and IMPORT_DATA for the data import - if self.db_action_type == DbActionType.GENERATE: + if self.db_action_type == DbActionType.SCHEMA_IMPORT: self.description.setText( self.tr( "Run the ili2db sessions to make the model imports (or skip to continue)." @@ -186,7 +185,7 @@ def _on_process_finished(self, exit_code, result): if exit_code == 0: message = "Finished with success." level = LogLevel.SUCCESS - if self.db_action_type == DbActionType.GENERATE: + if self.db_action_type == DbActionType.SCHEMA_IMPORT: message = self.tr( "INTERLIS model(s) successfully imported into the database!" ) diff --git a/QgisModelBaker/gui/workflow_wizard/workflow_wizard.py b/QgisModelBaker/gui/workflow_wizard/workflow_wizard.py index 936f03f4..d7089aea 100644 --- a/QgisModelBaker/gui/workflow_wizard/workflow_wizard.py +++ b/QgisModelBaker/gui/workflow_wizard/workflow_wizard.py @@ -154,7 +154,7 @@ def __init__(self, iface, base_config, parent): self.import_schema_execution_page = ExecutionPage( self, self._current_page_title(PageIds.ImportSchemaExecution), - DbActionType.GENERATE, + DbActionType.SCHEMA_IMPORT, ) self.default_baskets_page = DefaultBasketsPage( self, self._current_page_title(PageIds.DefaultBaskets) diff --git a/QgisModelBaker/utils/globals.py b/QgisModelBaker/utils/globals.py index 30a50a13..b421f363 100644 --- a/QgisModelBaker/utils/globals.py +++ b/QgisModelBaker/utils/globals.py @@ -56,5 +56,5 @@ class AdministrativeDBActionTypes(Enum): """Defines constants for modelbaker actions that require superuser login""" - GENERATE = DbActionType.GENERATE + SCHEMA_IMPORT = DbActionType.SCHEMA_IMPORT IMPORT_DATA = DbActionType.IMPORT_DATA