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

make difference between action type SCHEMA_IMPORT and GENERATE #989

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions QgisModelBaker/gui/panel/gpkg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions QgisModelBaker/gui/panel/mssql_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ 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]")
)
elif self._db_action_type == DbActionType.IMPORT_DATA:
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]")
)
Expand Down
7 changes: 5 additions & 2 deletions QgisModelBaker/gui/panel/pg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
)
Expand Down
12 changes: 6 additions & 6 deletions QgisModelBaker/gui/panel/session_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 2 additions & 3 deletions QgisModelBaker/gui/workflow_wizard/execution_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)."
Expand Down Expand Up @@ -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!"
)
Expand Down
2 changes: 1 addition & 1 deletion QgisModelBaker/gui/workflow_wizard/workflow_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion QgisModelBaker/utils/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading