class LogMessageDisplay(PluginWidget): def __init__(self, parent): super(LogMessageDisplay, self).__init__(parent) # layout self.display = MessageDisplay(text_font(), parent) layout = QHBoxLayout() layout.addWidget(self.display) self.setLayout(layout) self.setWindowTitle(self.get_plugin_title()) # output capture self.stdout = WriteToSignal(ORIGINAL_STDOUT) self.stdout.sig_write_received.connect(self.display.appendNotice) self.stderr = WriteToSignal(ORIGINAL_STDERR) self.stderr.sig_write_received.connect(self.display.appendError) def get_plugin_title(self): return "Messages" def readSettings(self, settings): self.display.readSettings(toQSettings(settings)) def writeSettings(self, settings): self.display.writeSettings(toQSettings(settings)) def register_plugin(self, menu=None): self.display.attachLoggingChannel(DEFAULT_LOG_PRIORITY) self._capture_stdout_and_stderr() self.main.add_dockwidget(self) def _capture_stdout_and_stderr(self): sys.stdout = self.stdout sys.stderr = self.stderr
class LogMessageDisplay(PluginWidget): def __init__(self, parent): super(LogMessageDisplay, self).__init__(parent) # layout self.display = MessageDisplay(parent) layout = QHBoxLayout() layout.addWidget(self.display) self.setLayout(layout) self.setWindowTitle(self.get_plugin_title()) # output capture stdout_capture, stderr_capture = WriteToSignal(), WriteToSignal() stdout_capture.sig_write_received.connect(self.display.appendNotice) stderr_capture.sig_write_received.connect(self.display.appendError) self.stdout, self.stderr = stdout_capture, stderr_capture def get_plugin_title(self): return "Messages" def read_user_settings(self, qsettings): self.display.readSettings(qsettings) def register_plugin(self, menu=None): self.display.attachLoggingChannel(DEFAULT_LOG_PRIORITY) self._capture_stdout_and_stderr() self.main.add_dockwidget(self) def _capture_stdout_and_stderr(self): sys.stdout = self.stdout sys.stderr = self.stderr
class LogMessageDisplay(PluginWidget): def __init__(self, parent): super(LogMessageDisplay, self).__init__(parent) # layout self.display = MessageDisplay(text_font(), parent) layout = QHBoxLayout() layout.addWidget(self.display) self.setLayout(layout) self.setWindowTitle(self.get_plugin_title()) # output capture self.stdout = WriteToSignal(ORIGINAL_STDOUT) self.stdout.sig_write_received.connect( self.display.append_script_notice) self.stderr = WriteToSignal(ORIGINAL_STDERR) self.stderr.sig_write_received.connect( self.display.append_script_error) def get_plugin_title(self): return "Messages" def current_tab_changed(self, script_path): self.display.current_tab_changed(script_path) def script_executing(self, script_path): self.display.script_executing(script_path) def file_name_modified(self, old_file_name, new_file_name): self.display.file_name_modified(old_file_name, new_file_name) def readSettings(self, settings): self.display.readSettings(toQSettings(settings)) def writeSettings(self, settings): self.display.writeSettings(toQSettings(settings)) def register_plugin(self, menu=None): self.display.attachLoggingChannel(DEFAULT_LOG_PRIORITY) self._capture_stdout_and_stderr() self.main.add_dockwidget(self) def _capture_stdout_and_stderr(self): sys.stdout = self.stdout sys.stderr = self.stderr