本文整理汇总了Python中lutris.game.Game类的典型用法代码示例。如果您正苦于以下问题:Python Game类的具体用法?Python Game怎么用?Python Game使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Game类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_browse_files
def on_browse_files(self, widget):
game = Game(self.view.selected_game)
path = game.get_browse_dir()
if path and os.path.exists(path):
Gtk.show_uri(None, "file://" + path, Gdk.CURRENT_TIME)
else:
dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." % path)
示例2: on_browse_files
def on_browse_files(self, widget):
game = Game(self.view.selected_game)
path = game.get_browse_dir()
if path and os.path.exists(path):
subprocess.Popen(['xdg-open', path])
else:
dialogs.NoticeDialog(
"Can't open %s \nThe folder doesn't exist." % path)
示例3: update_platforms
def update_platforms():
pga_games = pga.get_games(filter_installed=True)
for pga_game in pga_games:
if pga_game.get('platform') or not pga_game['runner']:
continue
game = Game(id=pga_game['id'])
game.set_platform_from_runner()
game.save()
示例4: launch_game
def launch_game(self, widget, _data=None):
"""Launch a game after it's been installed."""
widget.set_sensitive(False)
self.close(widget)
if self.parent:
self.parent.on_game_run(game_id=self.interpreter.game_id)
else:
game = Game(self.interpreter.game_id)
game.play()
示例5: on_browse_files
def on_browse_files(self, widget):
game = Game(self.view.selected_game)
path = game.get_browse_dir()
if path and os.path.exists(path):
system.xdg_open(path)
else:
dialogs.NoticeDialog(
"Can't open %s \nThe folder doesn't exist." % path
)
示例6: platform
def platform(self):
"""Platform"""
_platform = self._pga_data["platform"]
if not _platform and self.installed:
game_inst = Game(self._pga_data["id"])
if game_inst.platform:
_platform = game_inst.platform
else:
logger.debug("Game %s has no platform", self)
game_inst.set_platform_from_runner()
_platform = game_inst.platform
return _platform
示例7: build_game_tab
def build_game_tab(self):
if self.game and self.runner_name:
self.game.runner_name = self.runner_name
self.game_box = GameBox(self.lutris_config, self.game)
game_sw = self.build_scrolled_window(self.game_box)
elif self.runner_name:
game = Game(None)
game.runner_name = self.runner_name
self.game_box = GameBox(self.lutris_config, game)
game_sw = self.build_scrolled_window(self.game_box)
else:
game_sw = Gtk.Label(label=self.no_runner_label)
self.add_notebook_tab(game_sw, "Game options")
示例8: fill_missing_platforms
def fill_missing_platforms():
"""Sets the platform on games where it's missing.
This should never happen.
"""
pga_games = pga.get_games(filter_installed=True)
for pga_game in pga_games:
if pga_game.get("platform") or not pga_game["runner"]:
continue
game = Game(game_id=pga_game["id"])
logger.error("Providing missing platorm for game %s", game.slug)
game.set_platform_from_runner()
if game.platform:
game.save(metadata_only=True)
示例9: on_apply_button_clicked
def on_apply_button_clicked(self, widget):
widget.set_sensitive(False)
remove_from_library_button = self.builder.get_object(
'remove_from_library_button'
)
remove_from_library = remove_from_library_button.get_active()
remove_contents_button = self.builder.get_object(
'remove_contents_button'
)
remove_contents = remove_contents_button.get_active()
game = Game(self.game_slug)
game.remove(remove_from_library, remove_contents)
self.callback(self.game_slug, remove_from_library)
self.on_close()
示例10: on_save
def on_save(self, _button):
"""Save game info and destroy widget. Return True if success."""
if not self.is_valid():
return False
name = self.name_entry.get_text()
# Do not modify slug
if not self.slug:
self.slug = slugify(name)
if not self.game:
self.game = Game(self.slug)
self.game.config = self.lutris_config
if not self.lutris_config.game_slug:
self.lutris_config.game_slug = self.slug
self.lutris_config.save()
runner_class = runners.import_runner(self.runner_name)
runner = runner_class(self.lutris_config)
self.game.name = name
self.game.slug = self.slug
self.game.runner_name = self.runner_name
self.game.directory = runner.game_path
self.game.is_installed = True
self.game.save()
self.destroy()
logger.debug("Saved %s", name)
self.saved = True
示例11: game
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
示例12: on_save
def on_save(self, _button, callback=None):
"""Save game info and destroy widget. Return True if success."""
if not self.is_valid():
return False
name = self.name_entry.get_text()
# Do not modify slug
if not self.slug:
self.slug = slugify(name)
if not self.game:
self.game = Game()
if self.lutris_config.game_config_id == TEMP_CONFIG:
self.lutris_config.game_config_id = self.get_config_id()
runner_class = runners.import_runner(self.runner_name)
runner = runner_class(self.lutris_config)
self.game.name = name
self.game.slug = self.slug
self.game.runner_name = self.runner_name
self.game.config = self.lutris_config
self.game.directory = runner.game_path
self.game.is_installed = True
if self.runner_name in ('steam', 'winesteam'):
self.game.steamid = self.lutris_config.game_config['appid']
self.game.save()
self.destroy()
logger.debug("Saved %s", name)
self.saved = True
if callback:
callback()
示例13: initialize
def initialize(self, slug=None, callback=None):
self.game = Game(slug)
self.callback = callback
self.substitute_label(self.builder.get_object('description_label'),
'game', self.game.name)
self.substitute_label(
self.builder.get_object('remove_from_library_button'),
'game', self.game.name
)
remove_contents_button = self.builder.get_object(
'remove_contents_button'
)
try:
default_path = self.game.runner.default_path
except AttributeError:
default_path = "/"
if not is_removeable(self.game.directory, excludes=[default_path]):
remove_contents_button.set_sensitive(False)
path = self.game.directory or 'disk'
self.substitute_label(remove_contents_button, 'path', path)
cancel_button = self.builder.get_object('cancel_button')
cancel_button.connect('clicked', self.on_close)
apply_button = self.builder.get_object('apply_button')
apply_button.connect('clicked', self.on_apply_button_clicked)
示例14: _build_game_tab
def _build_game_tab(self):
if self.game and self.runner_name:
self.game.runner_name = self.runner_name
try:
self.game.runner = runners.import_runner(self.runner_name)
except runners.InvalidRunner:
pass
self.game_box = GameBox(self.lutris_config, self.game)
game_sw = self.build_scrolled_window(self.game_box)
elif self.runner_name:
game = Game(None)
game.runner_name = self.runner_name
self.game_box = GameBox(self.lutris_config, game)
game_sw = self.build_scrolled_window(self.game_box)
else:
game_sw = Gtk.Label(label=self.no_runner_label)
self._add_notebook_tab(game_sw, "Game options")
示例15: on_game_clicked
def on_game_clicked(self, *args):
"""Launch a game"""
game_slug = self.view.selected_game
if game_slug:
self.running_game = Game(game_slug)
if self.running_game.is_installed:
self.running_game.play()
else:
InstallerDialog(game_slug, self)