本文整理汇总了Python中lutris.game.Game.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Game.connect方法的具体用法?Python Game.connect怎么用?Python Game.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lutris.game.Game
的用法示例。
在下文中一共展示了Game.connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from lutris.game import Game [as 别名]
# 或者: from lutris.game.Game import connect [as 别名]
class GameActions:
"""Regroup a list of callbacks for a game"""
def __init__(self, application=None, window=None):
self.application = application or Gio.Application.get_default()
self.window = window
self.game_id = None
self._game = None
@property
def game(self):
if not self._game:
self._game = self.application.get_game_by_id(self.game_id)
if not self._game:
self._game = Game(self.game_id)
self._game.connect("game-error", self.window.on_game_error)
return self._game
@property
def is_game_running(self):
return bool(self.application.get_game_by_id(self.game_id))
def set_game(self, game=None, game_id=None):
if game:
self._game = game
self.game_id = game.id
else:
self._game = None
self.game_id = game_id
def get_game_actions(self):
"""Return a list of game actions and their callbacks"""
return [
(
"play", "Play",
self.on_game_run
),
(
"stop", "Stop",
self.on_stop
),
(
"show_logs", "Show logs",
self.on_show_logs
),
(
"install", "Install",
self.on_install_clicked
),
(
"add", "Add installed game",
self.on_add_manually
),
(
"configure", "Configure",
self.on_edit_game_configuration
),
(
"execute-script", "Execute script",
self.on_execute_script_clicked
),
(
"browse", "Browse files",
self.on_browse_files
),
(
"desktop-shortcut", "Create desktop shortcut",
self.on_create_desktop_shortcut,
),
(
"rm-desktop-shortcut", "Delete desktop shortcut",
self.on_remove_desktop_shortcut,
),
(
"menu-shortcut", "Create application menu shortcut",
self.on_create_menu_shortcut,
),
(
"rm-menu-shortcut", "Delete application menu shortcut",
self.on_remove_menu_shortcut,
),
(
"install_more", "Install another version",
self.on_install_clicked
),
(
"remove", "Remove",
self.on_remove_game
),
(
"view", "View on Lutris.net",
self.on_view_game
),
]
def get_displayed_entries(self):
"""Return a dictionary of actions that should be shown for a game"""
return {
"add": not self.game.is_installed and not self.game.is_search_result,
"install": not self.game.is_installed,
"play": self.game.is_installed and not self.is_game_running,
#.........这里部分代码省略.........