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 launch(self): """Request launching a game. The game may not be installed yet.""" if not self.is_installed: raise RuntimeError("Tried to launch a game that isn't installed") self.load_config() # Reload the config before launching it. if str(self.id) in LOG_BUFFERS: # Reset game logs on each launch LOG_BUFFERS.pop(str(self.id)) if not self.runner: dialogs.ErrorDialog(_("Invalid game configuration: Missing runner")) return if not self.is_launchable(): logger.error("Game is not launchable") return self.state = self.STATE_LAUNCHING self.prelaunch_pids = system.get_running_pid_list() self.emit("game-start") jobs.AsyncCall(self.runner.prelaunch, self.configure_game)
def launch(self): """Request launching a game. The game may not be installed yet.""" if not self.is_installed: self.emit("game-install") return self.load_config() # Reload the config before launching it. if self.id in LOG_BUFFERS: # Reset game logs on each launch LOG_BUFFERS.pop(self.id) if not self.runner: dialogs.ErrorDialog(_("Invalid game configuration: Missing runner")) return if not self.is_launchable(): logger.error("Game is not launchable") return self.state = self.STATE_LAUNCHING self.emit("game-start") jobs.AsyncCall(self.runner.prelaunch, self.configure_game)
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