def on_setting(self, key, _):
     if key in [
             "config_search",
             "game_list_uuid",
             "database_show_games",
             "database_show_adult",
             "database_show_unpublished",
     ]:
         # if key == "game_list_uuid":
         self.update_search()
         if len(self.items) > 0:
             self.select_item(None)
             self.select_item(0)
         else:
             # self.select_item(None)
             if LauncherSettings.get(PARENT_UUID):
                 LauncherSettings.set(PARENT_UUID, "")
                 LauncherConfig.load_default_config()
     elif key == "__config_refresh":
         self.update_search()
         self.select_item(None)
         old_parent_uuid = LauncherSettings.get(PARENT_UUID)
         if old_parent_uuid:
             LauncherSettings.set(PARENT_UUID, "")
             LauncherSettings.set(PARENT_UUID, old_parent_uuid)
     elif key == PARENT_UUID or key == "config_path":
         if not (LauncherSettings.get(PARENT_UUID)
                 or LauncherSettings.get("config_path")):
             self.select_item(None)
示例#2
0
    def load_settings(cls):
        if cls.settings_loaded:
            return
        cls.settings_loaded = True

        settings = Settings.instance()
        settings.load()
        path = settings.path
        # path = app.get_settings_path()
        print("loading last config from " + repr(path))
        if not os.path.exists(path):
            print("settings file does not exist")
        # noinspection PyArgumentList
        cp = ConfigParser(interpolation=None)
        try:
            cp.read([path])
        except Exception as e:
            print(repr(e))
            return

        for key in LauncherSettings.old_keys:
            if app.settings.get(key):
                print("[SETTINGS] Removing old key", key)
                app.settings.set(key, "")

        if fsgs.config.add_from_argv():
            print("[CONFIG] Configuration specified via command line")
            # Prevent the launcher from loading the last used game
            LauncherSettings.set("parent_uuid", "")
        elif LauncherSettings.get("config_path"):
            if LauncherConfig.load_file(LauncherSettings.get("config_path")):
                print("[CONFIG] Loaded last configuration file")
            else:
                print("[CONFIG] Failed to load last configuration file")
                LauncherConfig.load_default_config()
        else:
            pass
            # config = {}
            # try:
            #     keys = cp.options("config")
            # except NoSectionError:
            #     keys = []
            # for key in keys:
            #     config[key] = fs.from_utf8_str(cp.get("config", key))
            # for key, value in config.items():
            #     print("loaded", key, value)
            #     fsgs.config.values[key] = value

        # Argument --new-config[=<platform>]
        new_config = "--new-config" in sys.argv
        new_config_platform = None
        for platform_id in PLATFORM_IDS:
            if "--new-config=" + platform_id in sys.argv:
                new_config = True
                new_config_platform = platform_id
        if new_config:
            LauncherConfig.load_default_config(platform=new_config_platform)
            # Prevent the launcher from loading the last used game
            LauncherSettings.set("parent_uuid", "")
示例#3
0
    def load_settings(cls):
        if cls.settings_loaded:
            return
        cls.settings_loaded = True

        settings = Settings.instance()
        settings.load()
        path = settings.path
        # path = app.get_settings_path()
        print("loading last config from " + repr(path))
        if not os.path.exists(path):
            print("settings file does not exist")
        # noinspection PyArgumentList
        cp = ConfigParser(interpolation=None)
        try:
            cp.read([path])
        except Exception as e:
            print(repr(e))
            return

        for key in LauncherSettings.old_keys:
            if app.settings.get(key):
                print("[SETTINGS] Removing old key", key)
                app.settings.set(key, "")

        if fsgs.config.add_from_argv():
            print("[CONFIG] Configuration specified via command line")
            # Prevent the launcher from loading the last used game
            LauncherSettings.set("parent_uuid", "")
        elif LauncherSettings.get("config_path"):
            if LauncherConfig.load_file(LauncherSettings.get("config_path")):
                print("[CONFIG] Loaded last configuration file")
            else:
                print("[CONFIG] Failed to load last configuration file")
                LauncherConfig.load_default_config()
        else:
            pass
            # config = {}
            # try:
            #     keys = cp.options("config")
            # except NoSectionError:
            #     keys = []
            # for key in keys:
            #     config[key] = fs.from_utf8_str(cp.get("config", key))
            # for key, value in config.items():
            #     print("loaded", key, value)
            #     fsgs.config.values[key] = value

        # Argument --new-config[=<platform>]
        new_config = "--new-config" in sys.argv
        new_config_platform = None
        for platform_id in PLATFORM_IDS:
            if "--new-config=" + platform_id in sys.argv:
                new_config = True
                new_config_platform = platform_id
        if new_config:
            LauncherConfig.load_default_config(platform=new_config_platform)
            # Prevent the launcher from loading the last used game
            LauncherSettings.set("parent_uuid", "")
示例#4
0
 def new_config():
     if openretro or settings.get(Option.PLATFORMS_FEATURE):
         platform_id = LauncherConfig.get(Option.PLATFORM)
     else:
         platform_id = None
     LauncherConfig.load_default_config(platform=platform_id)
     # Settings.set("config_changed", "1")
     LauncherSettings.set("parent_uuid", "")
 def load_variant(self, item):
     try:
         self._load_variant(item)
         # raise Exception()
     except Exception:
         traceback.print_exc()
         LauncherConfig.load_default_config()
         LauncherConfig.load({"__error": "Error Loading Configuration"})
         self.select_item(None)
    def new_config(config):
        settings = Settings().instance()
        if Product.default_platform_id:
            platform_id = Product.default_platform_id
        elif openretro or settings.get(Option.PLATFORMS_FEATURE):
            platform_id = config.get(Option.PLATFORM)
        else:
            platform_id = None

        LauncherConfig.load_default_config(platform=platform_id)

        # Settings.set("config_changed", "1")
        settings.set(PARENT_UUID, "")
    def _load_variant_2(self, variant_uuid, database_name, personal_rating,
                        have):
        config = get_config(self)
        if config.get("variant_uuid") == variant_uuid:
            print("Variant {} is already loaded".format(variant_uuid))
        game_database = fsgs.game_database(database_name)

        # game_database_client = GameDatabaseClient(game_database)
        # try:
        #     variant_id = game_database_client.get_game_id(variant_uuid)
        # except Exception:
        #     # game not found:
        #     print("could not find game", repr(variant_uuid))
        #     Config.load_default_config()
        #     return
        # values = game_database_client.get_final_game_values(variant_id)
        try:
            values = game_database.get_game_values_for_uuid(variant_uuid)
        except Exception:
            # game not found:
            traceback.print_exc()
            print("could not find game", repr(variant_uuid))
            LauncherConfig.load_default_config()
            return

        # values["variant_uuid"] = variant_uuid
        # values["variant_rating"] = str(item["personal_rating"])

        LauncherConfig.load_values(values, uuid=variant_uuid)

        # print("--->", config.get("variant_uuid"))

        # variant_rating = 0
        # if item["work_rating"] is not None:
        #     variant_rating = item["work_rating"] - 2
        # if item["like_rating"]:
        #     variant_rating = item["like_rating"]
        # Config.set("__variant_rating", str(variant_rating))

        # LauncherConfig.set("variant_uuid", variant_uuid)
        LauncherConfig.set("__changed", "0")
        LauncherConfig.set("__database", database_name)

        LauncherSettings.set("__variant_rating", str(personal_rating))

        if int(have) < self.AVAILABLE:
            print(" -- some files are missing --")
            LauncherConfig.set("x_missing_files", "1")
示例#8
0
    def load_settings(cls):
        if cls.settings_loaded:
            return
        cls.settings_loaded = True

        settings = Settings.instance()
        settings.load()
        path = settings.path
        # path = app.get_settings_path()
        print("loading last config from " + repr(path))
        if not os.path.exists(path):
            print("settings file does not exist")
        # noinspection PyArgumentList
        cp = ConfigParser(interpolation=None)
        try:
            cp.read([path])
        except Exception as e:
            print(repr(e))
            return

        for key in LauncherSettings.old_keys:
            if app.settings.get(key):
                print("[SETTINGS] Removing old key", key)
                app.settings.set(key, "")

        if fsgs.config.add_from_argv():
            print("[CONFIG] Configuration specified via command line")
            # Prevent the launcher from loading the last used game
            LauncherSettings.set("parent_uuid", "")
        elif LauncherSettings.get("config_path"):
            if LauncherConfig.load_file(LauncherSettings.get("config_path")):
                print("[CONFIG] Loaded last configuration file")
            else:
                print("[CONFIG] Failed to load last configuration file")
                LauncherConfig.load_default_config()

            pass
示例#9
0
 def new_config():
     LauncherConfig.load_default_config()
     # Settings.set("config_changed", "1")
     LauncherSettings.set("parent_uuid", "")
示例#10
0
 def new_config():
     LauncherConfig.load_default_config()
     # Settings.set("config_changed", "1")
     LauncherSettings.set("parent_uuid", "")