コード例 #1
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if not path:
         dialogs.NoticeDialog(_("This game has no installation directory"))
     elif path_exists(path):
         open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog(_("Can't open %s \nThe folder doesn't exist.") % path)
コード例 #2
0
ファイル: game_actions.py プロジェクト: sparr/lutris
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if not path:
         dialogs.NoticeDialog("This game has no installation directory")
     elif path_exists(path):
         if self.game.runner.system_config.get("use_xdg_utils"):
             subprocess.run(["xdg-open", path])
         else:
             open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." %
                              path)
コード例 #3
0
 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)
コード例 #4
0
ファイル: lutriswindow.py プロジェクト: dbrewii/lutris
 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)
コード例 #5
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     path = self.game.get_browse_dir()
     if path and os.path.exists(path):
         open_uri("file://%s" % path)
     else:
         dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." %
                              path)
コード例 #6
0
ファイル: lutriswindow.py プロジェクト: Kehlyos/lutris
 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)
コード例 #7
0
 def on_browse_files(self, _widget):
     """Callback to open a game folder in the file browser"""
     game = Game(self.view.selected_game)
     path = game.get_browse_dir()
     if path and os.path.exists(path):
         open_uri('file://%s' % path)
     else:
         dialogs.NoticeDialog("Can't open %s \nThe folder doesn't exist." %
                              path)
コード例 #8
0
 def on_synchronize_manually(self, *args):
     """Callback when Synchronize Library is activated."""
     sync = Sync()
     credentials = api.read_api_key()
     if credentials:  # Is connected
         sync.sync_all(caller=self)
     else:
         sync.sync_steam_local(caller=self)
     self.sync_icons()
     dialogs.NoticeDialog('Library synchronized')
コード例 #9
0
 def create_desktop_shortcut(self, *args):
     """Add the game to the system's Games menu."""
     game_slug = slugify(self.view.selected_game)
     create_launcher(game_slug, desktop=True)
     dialogs.NoticeDialog('Shortcut created on your desktop.')
コード例 #10
0
 def create_menu_shortcut(self, *args):
     """Add the game to the system's Games menu."""
     game_slug = slugify(self.view.selected_game)
     create_launcher(game_slug, menu=True)
     dialogs.NoticeDialog(
         "Shortcut added to the Games category of the global menu.")
コード例 #11
0
    def get_launch_parameters(self, gameplay_info):
        system_config = self.runner.system_config
        launch_arguments = gameplay_info["command"]

        optimus = system_config.get("optimus")
        if optimus == "primusrun" and system.find_executable("primusrun"):
            launch_arguments.insert(0, "primusrun")
        elif optimus == "optirun" and system.find_executable("optirun"):
            launch_arguments.insert(0, "virtualgl")
            launch_arguments.insert(0, "-b")
            launch_arguments.insert(0, "optirun")
        elif optimus == "pvkrun" and system.find_executable("pvkrun"):
            launch_arguments.insert(0, "pvkrun")

        # Mangohud activation
        mangohud = system_config.get("mangohud") or ""
        if mangohud and system.find_executable("mangohud"):
            # This is probably not the way to go. This only work with a few
            # Wine games. It will probably crash it, or do nothing at all.
            # I have never got mangohud to work on anything other than a Wine
            # game.
            dialogs.NoticeDialog("MangoHud support is experimental. Expect the "
                                 "game to crash or the framerate counter not to "
                                 "appear at all.")
            launch_arguments = ["mangohud"] + launch_arguments

        fps_limit = system_config.get("fps_limit") or ""
        if fps_limit:
            strangle_cmd = system.find_executable("strangle")
            if strangle_cmd:
                launch_arguments = [strangle_cmd, fps_limit] + launch_arguments
            else:
                logger.warning("libstrangle is not available on this system, FPS limiter disabled")

        prefix_command = system_config.get("prefix_command") or ""
        if prefix_command:
            launch_arguments = (shlex.split(os.path.expandvars(prefix_command)) + launch_arguments)

        single_cpu = system_config.get("single_cpu") or False
        if single_cpu:
            logger.info("The game will run on a single CPU core")
            launch_arguments.insert(0, "0")
            launch_arguments.insert(0, "-c")
            launch_arguments.insert(0, "taskset")


        env = {}
        env.update(self.runner.get_env())

        env.update(gameplay_info.get("env") or {})
        env["game_name"] = self.name

        # Set environment variables dependent on gameplay info

        # LD_PRELOAD
        ld_preload = gameplay_info.get("ld_preload")
        if ld_preload:
            env["LD_PRELOAD"] = ld_preload

        # LD_LIBRARY_PATH
        game_ld_libary_path = gameplay_info.get("ld_library_path")
        if game_ld_libary_path:
            ld_library_path = env.get("LD_LIBRARY_PATH")
            if not ld_library_path:
                ld_library_path = "$LD_LIBRARY_PATH"
            env["LD_LIBRARY_PATH"] = ":".join([game_ld_libary_path, ld_library_path])

        # Feral gamemode
        gamemode = system_config.get("gamemode") and LINUX_SYSTEM.gamemode_available()
        if gamemode:
            if system.find_executable("gamemoderun"):
                launch_arguments.insert(0, "gamemoderun")
            else:
                env["LD_PRELOAD"] = ":".join([path for path in [
                    env.get("LD_PRELOAD"),
                    "libgamemodeauto.so",
                ] if path])
        return launch_arguments, env