def on_show_logs(self, _widget): """Display game log""" _buffer = LOG_BUFFERS.get(self.game.id) if not _buffer: logger.info("No log for game %s", self.game) return LogWindow(title=_("Log for {}").format(self.game), buffer=_buffer, application=self.application)
def log_buffer(self): """Access the log buffer object, creating it if necessary""" _log_buffer = LOG_BUFFERS.get(self.id) if _log_buffer: return _log_buffer _log_buffer = Gtk.TextBuffer() _log_buffer.create_tag("warning", foreground="red") if self.game_thread: self.game_thread.set_log_buffer(self._log_buffer) _log_buffer.set_text(self.game_thread.stdout) LOG_BUFFERS[self.id] = _log_buffer return _log_buffer