def __init__(self): Gtk.Application.__init__(self, application_id='net.lutris.Lutris', flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) gettext.bindtextdomain("lutris", "/usr/share/locale") gettext.textdomain("lutris") check_config() migrate() update_platforms() GLib.set_application_name(_('Lutris')) self.window = None self.css_provider = Gtk.CssProvider.new() try: self.css_provider.load_from_path(os.path.join(datapath.get(), 'ui', 'lutris.css')) except GLib.Error as e: logger.exception(e) if hasattr(self, 'add_main_option'): self.add_arguments() else: ErrorDialog("Your Linux distribution is too old, Lutris won't function properly")
def __init__(self): Gtk.Application.__init__( self, application_id='net.lutris.Lutris', flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) gettext.bindtextdomain("lutris", "/usr/share/locale") gettext.textdomain("lutris") check_config() migrate() update_platforms() GLib.set_application_name(_('Lutris')) self.window = None self.css_provider = Gtk.CssProvider.new() try: self.css_provider.load_from_path( os.path.join(datapath.get(), 'ui', 'lutris.css')) except GLib.Error as e: logger.exception(e) if hasattr(self, 'add_main_option'): self.add_arguments() else: ErrorDialog( "Your Linux distribution is too old, Lutris won't function properly" )
def __init__(self): super().__init__( application_id="net.lutris.Lutris", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE, ) logger.info("Running Lutris %s", settings.VERSION) set_child_subreaper() gettext.bindtextdomain("lutris", "/usr/share/locale") gettext.textdomain("lutris") check_config() migrate() update_platforms() check_driver() check_libs() check_vulkan() GLib.set_application_name(_("Lutris")) self.running_games = [] self.window = None self.help_overlay = None self.tray = None self.css_provider = Gtk.CssProvider.new() if os.geteuid() == 0: ErrorDialog( "Running Lutris as root is not recommended and may cause unexpected issues" ) try: self.css_provider.load_from_path( os.path.join(datapath.get(), "ui", "lutris.css") ) except GLib.Error as e: logger.exception(e) if hasattr(self, "add_main_option"): self.add_arguments() else: ErrorDialog( "Your Linux distribution is too old, Lutris won't function properly" )
def setUp(self): check_config() lutris_window = LutrisWindow() self.dlg = config_dialogs.AddGameDialog(lutris_window.window)
def setUp(self): check_config() lutris_application = Application() lutris_window = lutris_application.window self.dlg = AddGameDialog(lutris_window)
def setUp(self): check_config() lutris_window = LutrisWindow() self.dlg = config_dialogs.AddGameDialog(lutris_window)
def do_command_line(self, command_line): options = command_line.get_options_dict() if options.contains('debug'): logger.setLevel(logging.DEBUG) if options.contains('list-games'): game_list = pga.get_games() if options.contains('installed'): game_list = [game for game in game_list if game['installed']] if options.contains('json'): games = [] for game in game_list: games.append({ 'id': game['id'], 'slug': game['slug'], 'name': game['name'], 'runner': game['runner'], 'directory': game['directory'] }) self._print(command_line, json.dumps(games, indent=2)) else: for game in game_list: self._print( command_line, "{:4} | {:<40} | {:<40} | {:<15} | {:<64}".format( game['id'], game['name'][:40], game['slug'][:40], game['runner'] or '-', game['directory'] or '-' ) ) return 0 if options.contains('list-steam-games'): steamapps_paths = get_steamapps_paths() for platform in ('linux', 'windows'): for path in steamapps_paths[platform]: appmanifest_files = get_appmanifests(path) for appmanifest_file in appmanifest_files: appmanifest = AppManifest(os.path.join(path, appmanifest_file)) self._print( command_line, " {:8} | {:<60} | {:10} | {}".format( appmanifest.steamid, appmanifest.name or '-', platform, ", ".join(appmanifest.states) ) ) return 0 if options.contains('list-steam-folders'): steamapps_paths = get_steamapps_paths() for platform in ('linux', 'windows'): for path in steamapps_paths[platform]: self._print(command_line, path) return 0 check_config(force_wipe=False) migrate() game = None game_slug = '' uri = options.lookup_value(GLib.OPTION_REMAINING) if uri: uri = uri.get_strv() if uri and len(uri): uri = uri[0] # TODO: Support multiple if not uri.startswith('lutris:'): self._print(command_line, '%s is not a valid URI' % uri) return 1 game_slug = uri[7:] if game_slug or options.contains('install'): if options.contains('install'): installer_file = options.lookup_value('install').get_string() installer = installer_file else: installer_file = None installer = game_slug if not game_slug and not os.path.isfile(installer_file): self._print(command_line, "No such file: %s" % installer_file) return 1 db_game = None if game_slug: db_game = (pga.get_game_by_field(game_slug, 'id') or pga.get_game_by_field(game_slug, 'slug') or pga.get_game_by_field(game_slug, 'installer_slug')) if db_game and db_game['installed'] and not options.contains('reinstall'): self._print(command_line, "Launching %s" % db_game['name']) if self.window: self.run_game(db_game['id']) else: lutris_game = Game(db_game['id']) # FIXME: This is awful lutris_game.exit_main_loop = True lutris_game.play() try: GLib.MainLoop().run() except KeyboardInterrupt: lutris_game.stop() return 0 else: self._print(command_line, "Installing %s" % installer) if self.window: self.install_game(installer) else: runtime_updater = RuntimeUpdater() runtime_updater.update() # FIXME: This should be a Gtk.Dialog child of LutrisWindow dialog = InstallerDialog(installer) self.add_window(dialog) return 0 self.activate() return 0
def do_command_line(self, command_line): options = command_line.get_options_dict() if options.contains('debug'): logger.setLevel(logging.DEBUG) if options.contains('list-games'): game_list = pga.get_games() if options.contains('installed'): game_list = [game for game in game_list if game['installed']] if options.contains('json'): self.print_game_json(command_line, game_list) else: self.print_game_list(command_line, game_list) return 0 elif options.contains('list-steam-games'): self.print_steam_list(command_line) return 0 elif options.contains('list-steam-folders'): self.print_steam_folders(command_line) return 0 elif options.contains('exec'): command = options.lookup_value('exec').get_string() self.execute_command(command) return 0 check_config(force_wipe=False) migrate() game_slug = '' uri = options.lookup_value(GLib.OPTION_REMAINING) if uri: uri = uri.get_strv() if uri and len(uri): uri = uri[0] # TODO: Support multiple if not uri.startswith('lutris:'): self._print(command_line, '%s is not a valid URI' % uri) return 1 game_slug = uri[7:] if game_slug or options.contains('install'): if options.contains('install'): installer_file = options.lookup_value('install').get_string() installer = installer_file else: installer_file = None installer = game_slug if not game_slug and not os.path.isfile(installer_file): self._print(command_line, "No such file: %s" % installer_file) return 1 db_game = None if game_slug: db_game = (pga.get_game_by_field(game_slug, 'id') or pga.get_game_by_field(game_slug, 'slug') or pga.get_game_by_field(game_slug, 'installer_slug')) if db_game and db_game['installed'] and not options.contains( 'reinstall'): self._print(command_line, "Launching %s" % db_game['name']) if self.window: self.run_game(db_game['id']) else: lutris_game = Game(db_game['id']) # FIXME: This is awful lutris_game.exit_main_loop = True lutris_game.play() try: GLib.MainLoop().run() except KeyboardInterrupt: lutris_game.stop() return 0 else: self._print(command_line, "Installing %s" % installer) if self.window: self.install_game(installer) else: runtime_updater = RuntimeUpdater() runtime_updater.update() # FIXME: This should be a Gtk.Dialog child of LutrisWindow dialog = InstallerDialog(installer) self.add_window(dialog) return 0 self.activate() return 0
def setUp(self): check_config()
def setUp(self): check_config() lutris_application = Application() lutris_window = lutris_application.window self.dlg = config_dialogs.AddGameDialog(lutris_window)