Skip to content

Commit

Permalink
feat: when creating ToolConsole and calling WorkflowProgressGui.attac…
Browse files Browse the repository at this point in the history
…h_logger verify that signals have been attached
  • Loading branch information
henryborchers committed Nov 25, 2024
1 parent 2348b8b commit 6b35e12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions speedwagon/frontend/qtwidgets/dialog/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ def flush(self) -> None:
def attach_logger(self, logger: logging.Logger) -> None:
self._parent_logger = logger
self._log_handler = logging_helpers.QtSignalLogHandler(self)
if self._log_handler.signals is None:
raise RuntimeError("attach_logger failed to connect signals")
self._log_handler.signals.messageSent.connect(
self.write_html_block_to_console
)
Expand Down
2 changes: 2 additions & 0 deletions speedwagon/frontend/qtwidgets/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,8 @@ def __init__(self, parent: Optional[QtWidgets.QWidget] = None) -> None:
super().__init__(parent)

self.log_handler = logging_helpers.QtSignalLogHandler(self)
if self.log_handler.signals is None:
raise RuntimeError("attach_logger failed to connect signals")
self.log_handler.signals.messageSent.connect(self.add_message)

self.log_formatter = logging_helpers.ConsoleFormatter()
Expand Down

0 comments on commit 6b35e12

Please sign in to comment.