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


Python LauncherSettings.set方法代码示例

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


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

示例1: on_remove_button

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def on_remove_button(self):
     path = self.list_view.get_item(self.list_view.get_index())
     search_path = LauncherSettings.get("search_path")
     search_path = [x.strip() for x in search_path.split(";") if x.strip()]
     for i in range(len(search_path)):
         if search_path[i].startswith("-"):
             if path == search_path[i][1:]:
                 # Already removed.
                 break
         else:
             if search_path[i] == path:
                 search_path.remove(search_path[i])
                 break
     default_paths = FSGSDirectories.get_default_search_path()
     if path in default_paths:
         search_path.append("-" + path)
     LauncherSettings.set("search_path", ";".join(search_path))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:19,代码来源:scan_paths_group.py

示例2: on_add_button

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def on_add_button(self):
     search_path = LauncherSettings.get("search_path")
     search_path = [x.strip() for x in search_path.split(";") if x.strip()]
     path = fsui.pick_directory(parent=self.get_window())
     if path:
         for i in range(len(search_path)):
             if search_path[i].startswith("-"):
                 if path == search_path[i][1:]:
                     search_path.remove(search_path[i])
                     break
             else:
                 if search_path[i] == path:
                     # Already added.
                     break
         else:
             default_paths = FSGSDirectories.get_default_search_path()
             if path not in default_paths:
                 search_path.append(path)
         LauncherSettings.set("search_path", ";".join(search_path))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:21,代码来源:scan_paths_group.py

示例3: load_settings

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [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: on_changed

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def on_changed(self):
     LauncherSettings.set("video_sync", "1" if self.is_checked() else "")
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:4,代码来源:launch.py

示例5: new_config

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [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

示例6: save_config

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
    def save_config():
        print("SaveButton.save_config")
        database = Database.get_instance()

        name = LauncherSettings.get("config_name").strip()
        if not name:
            print("no config_name")
            # FIXME: notify user
            return

        file_name = name + ".fs-uae"
        path = os.path.join(
            FSGSDirectories.get_configurations_dir(), file_name)
        with io.open(path, "w", encoding="UTF-8") as f:
            f.write("# FS-UAE configuration saved by FS-UAE Launcher\n")
            f.write("# Last saved: {0}\n".format(
                    datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
            f.write("\n[fs-uae]\n")
            keys = sorted(fsgs.config.values.keys())
            for key in keys:
                value = LauncherConfig.get(key)
                if key.startswith("__"):
                    continue
                if key in LauncherConfig.no_save_keys_set:
                    continue
                # elif key == "joystick_port_2_mode" and value == "nothing":
                #     continue
                # elif key == "joystick_port_3_mode" and value == "nothing":
                #     continue
                if value == LauncherConfig.default_config.get(key, ""):
                    continue
                if value:
                    f.write("{0} = {1}\n".format(key, value))

        # scanner = ConfigurationScanner()
        # search = ConfigurationScanner.create_configuration_search(name)
        # name = scanner.create_configuration_name(name)
        # print("adding", path)
        # # deleting the path from the database first in case it already exists
        # database.delete_configuration(path=path)
        # database.delete_file(path=path)
        # database.add_file(path=path)
        # database.add_configuration(
        #     path=path, uuid="", name=name, scan=0, search=search)

        file_database = FileDatabase.get_instance()
        scanner = ConfigurationScanner()
        print("[save config] adding config", path)
        file_database.delete_file(path=path)
        with open(path, "rb") as f:
            sha1 = hashlib.sha1(f.read()).hexdigest()
        file_database.add_file(path=path, sha1=sha1)

        game_id = database.add_game(
            path=path, name=scanner.create_configuration_name(name))
        database.update_game_search_terms(
            game_id, scanner.create_search_terms(name))

        database.commit()
        file_database.commit()

        LauncherSettings.set("__config_refresh", str(time.time()))
        # Settings.set("config_changed", "0")
        LauncherConfig.set("__changed", "0")
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:66,代码来源:savebutton.py

示例7: __item_changed

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def __item_changed(self, index):
     LauncherSettings.set("language", LANGUAGE_ITEMS[index][1])
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:4,代码来源:language_settings_page.py

示例8: on_changed

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def on_changed(self):
     index = self.get_index()
     LauncherSettings.set("language", LANGUAGE_ITEMS[index][1])
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:5,代码来源:language_settings_page.py

示例9: on_search_changed

# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import set [as 别名]
 def on_search_changed(self):
     text = self.text_field.get_text()
     LauncherSettings.set("config_search", text)
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:5,代码来源:ConfigurationsPanel.py


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