Esempio n. 1
0
    def save_game_path(self, path: str, plugin: Plugin) -> None:
        """
        Saves the path to the game associated with a plugin.

        :param path: the absolute file path to the game's root folder
        :param plugin: the plugin which handles the game
        """
        plugin.game_path = path

        data = self.load_yaml()
        if not data.get("gamePaths"):
            data["gamePaths"] = {}

        data["gamePaths"][plugin.get_uid()] = path
        self.save_yaml(data)
Esempio n. 2
0
    def on_plugin_activation_changed(self, plugin: Plugin) -> None:
        for p in self.plugin_widgets:
            if p.plugin is not plugin and p.active:
                p.toggle_activation(trigger=False)

        loc = plugin.game_path or "Game location unknown"
        self.lbl_game_loc.setText(loc)

        features = plugin.get_features()
        self._setup_check_boxes(features)
        self._update_profiles_list(plugin)
Esempio n. 3
0
    def get_profiles(self, plugin: Plugin) -> List[Profile]:
        profile_dir = make_path(join(self.profiles_folder, plugin.get_uid()))

        return plugin.get_profiles(profile_dir)
Esempio n. 4
0
 def delete_profile(self, plugin: Plugin, profile: Profile) -> None:
     target_dir = self._get_profile_path(plugin, profile)
     plugin.delete(profile, target_dir)
Esempio n. 5
0
 def apply_profile(self, plugin: Plugin, profile: Profile) -> None:
     target_dir = self._get_profile_path(plugin, profile)
     plugin.apply(profile, target_dir)
Esempio n. 6
0
 def _get_profile_path(self, plugin: Plugin, profile: Profile) -> str:
     base_plugin_profile_dir = make_path(
         join(self.profiles_folder, plugin.get_uid())
     )
     target_dir = make_path(join(base_plugin_profile_dir, profile.uuid))
     return target_dir