Skip to content

Commit

Permalink
Merge pull request #983 from opengisch/fix-auth
Browse files Browse the repository at this point in the history
log output from ili2db in the log files
  • Loading branch information
signedav authored Nov 14, 2024
2 parents 71f10a7 + bb0e65f commit 4fae2e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
6 changes: 3 additions & 3 deletions QgisModelBaker/gui/panel/log_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from QgisModelBaker.utils.gui_utils import (
LogLevel,
get_parsed_log_text_color,
get_parsed_log_text_level,
get_text_color_object,
)

Expand Down Expand Up @@ -71,8 +71,8 @@ def print_info(self, text, level=LogLevel.INFO):
elif level == LogLevel.FAIL:
logging.error(text)

def on_stderr(self, text):
get_parsed_log_text_color(text, self.txtStdout)
def print_stdout_info(self, text):
self.print_info(text, get_parsed_log_text_level(text))

def show_message(self, level, message):
if level == Qgis.Warning:
Expand Down
6 changes: 3 additions & 3 deletions QgisModelBaker/gui/panel/session_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
class SessionPanel(QWidget, WIDGET_UI):

print_info = pyqtSignal(str, int)
on_stderr = pyqtSignal(str)
on_stdout = pyqtSignal(str)
on_process_started = pyqtSignal(str)
on_process_finished = pyqtSignal(int, int)
on_done_or_skipped = pyqtSignal(object, bool)
Expand Down Expand Up @@ -340,8 +340,8 @@ def run(self, edited_command=None):
self.progress_bar.setTextVisible(False)
self.progress_bar.setValue(10)

porter.stdout.connect(lambda str: self.print_info.emit(str, LogLevel.INFO))
porter.stderr.connect(self.on_stderr)
porter.stdout.connect(self.on_stdout)
porter.stderr.connect(self.on_stdout)
porter.process_started.connect(self.on_process_started)
porter.process_finished.connect(self.on_process_finished)
self.cancel_session.connect(porter.cancel_process)
Expand Down
6 changes: 4 additions & 2 deletions QgisModelBaker/gui/workflow_wizard/execution_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def setup_sessions(self, configuration, sessions):
)
session.on_done_or_skipped.connect(self._on_done_or_skipped_received)
session.print_info.connect(self.workflow_wizard.log_panel.print_info)
session.on_stderr.connect(self.workflow_wizard.log_panel.on_stderr)
session.on_stdout.connect(
self.workflow_wizard.log_panel.print_stdout_info
)
session.on_process_started.connect(self._on_process_started)
session.on_process_finished.connect(self._on_process_finished)
new_sessions.append(session)
Expand Down Expand Up @@ -177,7 +179,7 @@ def _run(self):
loop.exec()

def _on_process_started(self, command):
self.workflow_wizard.log_panel.print_info(command, "#000000")
self.workflow_wizard.log_panel.print_info(command, LogLevel.INFO)
QCoreApplication.processEvents()

def _on_process_finished(self, exit_code, result):
Expand Down
18 changes: 6 additions & 12 deletions QgisModelBaker/utils/gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,12 @@ def get_text_color_object(level: LogLevel = LogLevel.INFO) -> QColor:
return QColor(get_text_color(level))


def get_parsed_log_text_color(text, txt_edit) -> None:
textlines = text.splitlines()
for textline in textlines:
if textline.startswith("Warning:"):
txt_edit.setTextColor(get_text_color_object(LogLevel.WARNING))
txt_edit.append(textline)
elif "error" in textline.lower() or "failed" in textline.lower():
txt_edit.setTextColor(get_text_color_object(LogLevel.FAIL))
txt_edit.append(textline)
else:
txt_edit.setTextColor(get_text_color_object(LogLevel.INFO))
txt_edit.append(textline)
def get_parsed_log_text_level(text) -> LogLevel:
if text.startswith("Warning:"):
return LogLevel.WARNING
elif "error" in text.lower() or "failed" in text.lower():
return LogLevel.FAIL
return LogLevel.INFO


class SchemaDataFilterMode(IntEnum):
Expand Down

0 comments on commit 4fae2e7

Please sign in to comment.