Skip to content

Commit

Permalink
If no user name (or auth config) is chosen, we fill up the user name …
Browse files Browse the repository at this point in the history
…with the user's account name (from the environment variable).
  • Loading branch information
signedav committed Oct 28, 2024
1 parent fb9a349 commit fc9e24b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
21 changes: 12 additions & 9 deletions QgisModelBaker/gui/panel/pg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import logging
from enum import IntEnum

from qgis.core import QgsApplication
from qgis.PyQt.QtCore import QSettings, Qt, QThread, QTimer

import QgisModelBaker.libs.modelbaker.utils.db_utils as db_utils
Expand Down Expand Up @@ -327,15 +328,6 @@ def is_valid(self):
elif not self.pg_database_line_edit.text().strip():
message = self.tr("Please set a database before creating the project.")
self.pg_database_line_edit.setFocus()
elif (
not self.pg_auth_settings.username()
and not self.pg_auth_settings.configId()
):
message = self.tr(
"Please set a username or select an authentication configuration before creating the "
"project."
)
self.pg_auth_settings.setFocus()
elif (
self.pg_auth_settings.configId()
and not self.pg_use_super_login.isChecked()
Expand All @@ -347,6 +339,17 @@ def is_valid(self):
"Use superuser login for data management tasks when you use an authentication configuration."
)
self.pg_use_super_login.setFocus()
elif (
not self.pg_auth_settings.username()
and not self.pg_auth_settings.configId()
):
self.pg_auth_settings.setUsername(QgsApplication.userLoginName())
message = self.tr(
"Set the user's account name '{}'as username.".format(
QgsApplication.userLoginName()
)
)
result = True
else:
result = True

Expand Down
5 changes: 5 additions & 0 deletions QgisModelBaker/gui/workflow_wizard/database_selection_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ def is_valid(self):
message,
gui_utils.LogLevel.FAIL,
)
elif message:
self.workflow_wizard.log_panel.print_info(
message,
gui_utils.LogLevel.WARNING,
)
return res

def help_text(self):
Expand Down

0 comments on commit fc9e24b

Please sign in to comment.