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


Python LauncherConfig.set_multiple方法代码示例

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


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

示例1: browse

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
    def browse(self, dir_mode):
        default_dir = FSGSDirectories.get_hard_drives_dir()
        dialog = LauncherFilePicker(
            self.get_window(),
            gettext("Choose Hard Drive"),
            "hd",
            LauncherConfig.get(self.config_key),
            dir_mode=dir_mode,
        )
        if not dialog.show_modal():
            dialog.destroy()
            return
        path = dialog.get_path()
        dialog.destroy()

        checksum_tool = ChecksumTool(self.get_window())
        sha1 = ""
        if dir_mode:
            print("not calculating HD checksums for directories")
        else:
            size = os.path.getsize(path)
            if size < 64 * 1024 * 1024:
                sha1 = checksum_tool.checksum(path)
            else:
                print("not calculating HD checksums HD files > 64MB")
        full_path = path

        # FIXME: use contract function
        dir_path, file = os.path.split(path)
        self.text_field.set_text(file)
        if os.path.normcase(os.path.normpath(dir_path)) == os.path.normcase(
            os.path.normpath(default_dir)
        ):
            path = file

        self.text_field.set_text(path)
        values = [(self.config_key, path), (self.config_key_sha1, sha1)]
        if self.index == 0:
            # whdload_args = ""
            # dummy, ext = os.path.splitext(path)
            # if not dir_mode and ext.lower() in Archive.extensions:
            #     try:
            #         whdload_args = self.calculate_whdload_args(full_path)
            #     except Exception:
            #         traceback.print_exc()
            # values.append(("x_whdload_args", whdload_args))
            values.extend(
                whdload.generate_config_for_archive(
                    full_path, model_config=False
                ).items()
            )
        LauncherConfig.set_multiple(values)
开发者ID:,项目名称:,代码行数:54,代码来源:

示例2: set_new_config

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
 def set_new_config(self, items):
     if self.cd_mode:
         max_items = Amiga.MAX_CDROM_IMAGES
     else:
         max_items = Amiga.MAX_FLOPPY_IMAGES
     set_list = []
     for i in range(max(max_items, len(items))):
         if i >= max_items:
             break
         elif i >= len(items):
             path, sha1 = "", ""
         else:
             path, sha1 = items[i]
         set_list.append((self.file_key.format(i), path))
         set_list.append((self.sha1_key.format(i), sha1))
     LauncherConfig.set_multiple(set_list)
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3: on_browse_button

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
    def on_browse_button(self, extended=False):
        default_dir = FSGSDirectories.get_kickstarts_dir()
        if extended:
            title = gettext("Choose Extended ROM")
            key = "kickstart_ext_file"
        else:
            title = gettext("Choose Kickstart ROM")
            key = "kickstart_file"
        dialog = LauncherFilePicker(
            self.get_window(), title, "rom", LauncherConfig.get(key)
        )
        if not dialog.show_modal():
            return
        path = dialog.get_path()

        checksum_tool = ChecksumTool(self.get_window())
        sha1 = checksum_tool.checksum_rom(path)

        dir_path, file = os.path.split(path)
        if extended:
            self.ext_text_field.set_text(file)
        else:
            self.text_field.set_text(file)
        if os.path.normcase(os.path.normpath(dir_path)) == os.path.normcase(
            os.path.normpath(default_dir)
        ):
            path = file

        if extended:
            LauncherConfig.set_multiple(
                [
                    ("kickstart_ext_file", path),
                    ("x_kickstart_ext_file", path),
                    ("x_kickstart_ext_file_sha1", sha1),
                ]
            )
        else:
            LauncherConfig.set_multiple(
                [
                    ("kickstart_file", path),
                    ("x_kickstart_file", path),
                    ("x_kickstart_file_sha1", sha1),
                ]
            )
开发者ID:,项目名称:,代码行数:46,代码来源:

示例4: update_config

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
 def update_config(self):
     text = self.text_area.get_text()
     update_config = {}
     # First mark all unknown config values as cleared
     for key in list(fsgs.config.values.keys()):
         if key not in LauncherConfig.default_config:
             update_config[key] = ""
     # Then we overwrite with specific values
     for line in text.split("\n"):
         line = line.strip()
         parts = line.split("=", 1)
         if len(parts) == 2:
             key = parts[0].strip()
             # if key in Config.no_custom_config:
             #     continue
             value = parts[1].strip()
             update_config[key] = value
     # Finally, set everything at once
     LauncherConfig.set_multiple(update_config.items())
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:21,代码来源:CustomOptionsPage.py

示例5: multi_select

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
    def multi_select(cls, parent=None):
        default_dir = FSGSDirectories.get_cdroms_dir()
        dialog = LauncherFilePicker(
            parent, gettext("Select Multiple CD-ROMs"), "cd", multiple=True
        )

        if not dialog.show_modal():
            return
        paths = dialog.get_paths()
        paths.sort()

        # checksum_tool = ChecksumTool(parent)
        for i, path in enumerate(paths):
            # sha1 = checksum_tool.checksum(path)
            sha1 = ""
            print("FIXME: not calculating CD checksum just yet")
            path = Paths.contract_path(path, default_dir)

            if i < 1:
                LauncherConfig.set_multiple(
                    [
                        ("cdrom_drive_{0}".format(i), path),
                        ("x_cdrom_drive_{0}_sha1".format(i), sha1),
                    ]
                )
            LauncherConfig.set_multiple(
                [
                    ("cdrom_image_{0}".format(i), path),
                    ("x_cdrom_image_{0}_sha1".format(i), sha1),
                ]
            )

        # blank the rest of the drives
        for i in range(len(paths), 1):
            LauncherConfig.set_multiple(
                [
                    ("cdrom_drive_{0}".format(i), ""),
                    ("x_cdrom_drive_{0}_sha1".format(i), ""),
                ]
            )

            # Config.set("x_cdrom_drive_{0}_sha1".format(i), "")
            # Config.set("x_cdrom_drive_{0}_name".format(i), "")
        # blank the rest of the image list
        for i in range(len(paths), Amiga.MAX_CDROM_IMAGES):
            LauncherConfig.set_multiple(
                [
                    ("cdrom_image_{0}".format(i), ""),
                    ("x_cdrom_image_{0}_sha1".format(i), ""),
                ]
            )
开发者ID:,项目名称:,代码行数:53,代码来源:

示例6: do_update

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
    def do_update(self):
        if not self.dirty:
            return
        self.dirty = False
        print("ImplicitConfigHandler.do_update")
        implicit = ImplicitConfig(ConfigProxy(), SettingsProxy())
        # failed = False
        try:
            expand_config(implicit, ExpandFunctions())
        except Exception:
            traceback.print_exc()
            print("expand_config failed")
            # failed = True
        implicit_config = {
            key: "" for key in LauncherConfig.keys()
            if key.startswith("__implicit_")}
        for key, value in implicit.items():
            implicit_config["__implicit_" + key] = value
        LauncherConfig.set_multiple(list(implicit_config.items()))

        if self.parent().config_browser:
            self.parent().config_browser.update_from_implicit(implicit)
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:24,代码来源:implicit_handler.py

示例7: clear_cdrom_list

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
 def clear_cdrom_list(cls):
     values = []
     for i in range(Amiga.MAX_CDROM_IMAGES):
         values.append(("cdrom_image_{0}".format(i), ""))
         values.append(("x_cdrom_image_{0}_sha1".format(i), ""))
     LauncherConfig.set_multiple(values)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: eject

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
 def eject(cls, drive):
     values = [
         ("cdrom_drive_{0}".format(drive), ""),
         ("x_cdrom_drive_{0}_sha1".format(drive), ""),
     ]
     LauncherConfig.set_multiple(values)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例9: on_eject_button

# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set_multiple [as 别名]
 def on_eject_button(self):
     LauncherConfig.set_multiple(
         [(self.config_key, ""), (self.config_key_sha1, "")]
     )
开发者ID:,项目名称:,代码行数:6,代码来源:


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