当前位置: 首页>>代码示例>>Python>>正文


Python LauncherConfig.load_default_config方法代码示例

本文整理汇总了Python中launcher.launcher_config.LauncherConfig.load_default_config方法的典型用法代码示例。如果您正苦于以下问题:Python LauncherConfig.load_default_config方法的具体用法?Python LauncherConfig.load_default_config怎么用?Python LauncherConfig.load_default_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launcher.launcher_config.LauncherConfig的用法示例。


在下文中一共展示了LauncherConfig.load_default_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_settings

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import load_default_config [as 别名]
    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", "")
开发者ID:,项目名称:,代码行数:61,代码来源:

示例2: new_config

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import load_default_config [as 别名]
 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", "")
开发者ID:,项目名称:,代码行数:10,代码来源:

示例3: load_settings

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import load_default_config [as 别名]
    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
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:39,代码来源:fs_uae_launcher.py

示例4: new_config

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import load_default_config [as 别名]
 def new_config():
     LauncherConfig.load_default_config()
     # Settings.set("config_changed", "1")
     LauncherSettings.set("parent_uuid", "")
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:6,代码来源:newbutton.py


注:本文中的launcher.launcher_config.LauncherConfig.load_default_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。