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


Python FSGSDirectories.get_floppies_dir方法代码示例

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


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

示例1: on_add_button

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
    def on_add_button(self):
        existing_items = self.create_list()

        default_dir = FSGSDirectories.get_floppies_dir()
        if self.cd_mode:
            dialog = LauncherFilePicker(
                self.get_window(), gettext("Select Multiple CD-ROMs"),
                "cd", multiple=True)
        else:
            dialog = LauncherFilePicker(
                self.get_window(), gettext("Select Multiple Floppies"),
                "floppy", multiple=True)
        if not dialog.show_modal():
            print("dialog.show returned false")
            return
        print("dialog.show returned true")
        paths = dialog.get_paths()
        paths.sort()
        print(paths)

        checksum_tool = ChecksumTool(self.get_window())
        for i, path in enumerate(paths):
            sha1 = checksum_tool.checksum(path)
            path = Paths.contract_path(path, default_dir)

            dir, file = os.path.split(path)
            if os.path.normcase(os.path.normpath(dir)) == \
                    os.path.normcase(os.path.normpath(default_dir)):
                path = file

            existing_items.append((path, sha1))
        self.set_new_config(existing_items)
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:34,代码来源:MediaListGroup.py

示例2: app_main

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
def app_main():
    FSGSDirectories.initialize()
    Settings.instance().load()
    print("")
    print("Directories:")
    print("* base_dir =", FSGSDirectories.get_base_dir())
    print("* cache_dir =", FSGSDirectories.get_cache_dir())
    print("* cdroms_dir =", FSGSDirectories.get_cdroms_dir())
    print("* configurations_dir =", FSGSDirectories.get_configurations_dir())
    print("* controllers_dir =", FSGSDirectories.get_controllers_dir())
    print("* covers_dir =", FSGSDirectories.get_covers_dir())
    print("* data_dir =", FSGSDirectories.get_data_dir())
    print("* downloads_dir =", FSGSDirectories.downloads_dir())
    print("* floppies_dir =", FSGSDirectories.get_floppies_dir())
    print("* hard_drives_dir =", FSGSDirectories.get_hard_drives_dir())
    # print("* images_dir =", FSGSDirectories.get_images_dir())
    print("* kickstarts_dir =", FSGSDirectories.get_kickstarts_dir())
    print("* launcher_dir =", FSGSDirectories.get_launcher_dir())
    print("* logs_dir =", FSGSDirectories.get_logs_dir())
    print("* plugins_dir =", FSGSDirectories.get_plugins_dir())
    # print("* portable_dir =", FSGSDirectories.portable_dir())
    print("* save_states_dir =", FSGSDirectories.get_save_states_dir())
    print("* screenshots_dir =", FSGSDirectories.get_screenshots_dir())
    print("* screenshots_output_dir =", FSGSDirectories.screenshots_output_dir())
    print("* themes_dir =", FSGSDirectories.get_themes_dir())
    print("* titles_dir =", FSGSDirectories.get_titles_dir())
    print("* whdload_dir =", FSGSDirectories.get_whdload_dir())
    print("")
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:30,代码来源:list_dirs.py

示例3: insert_floppy

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
 def insert_floppy(self, drive, path, sha1=None):
     if sha1 is None:
         sha1 = ChecksumTool().checksum(path)
     default_dir = FSGSDirectories.get_floppies_dir()
     path = Paths.contract_path(path, default_dir)
     self.set_config([
         ("floppy_drive_{0}".format(drive), path),
         ("x_floppy_drive_{0}_sha1".format(drive), sha1)])
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:10,代码来源:AmigaContext.py

示例4: insert_multiple_floppies

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
    def insert_multiple_floppies(self, insert_paths):
        paths = []
        for path in insert_paths:
            embedded_files = []
            if path.endswith(".zip"):
                archive = Archive(path)
                files = archive.list_files()
                for file in files:
                    name, ext = os.path.splitext(file)
                    # FIXME: get list of floppy extensions from a central
                    # place
                    if ext in [".adf", ".ipf"]:
                        embedded_files.append(file)
            if len(embedded_files) > 0:
                embedded_files.sort()
                print("found embedded floppy images:")
                print(embedded_files)
                for file in embedded_files:
                    paths.append(file)
            else:
                paths.append(path)

        default_dir = FSGSDirectories.get_floppies_dir()
        checksum_tool = ChecksumTool()
        for i, path in enumerate(paths):
            sha1 = checksum_tool.checksum(path)
            path = Paths.contract_path(path, default_dir)

            if i < 4:
                self.set_config(
                    [
                        ("floppy_drive_{0}".format(i), path),
                        ("x_floppy_drive_{0}_sha1".format(i), sha1),
                    ]
                )
            self.set_config(
                [
                    ("floppy_image_{0}".format(i), path),
                    ("x_floppy_image_{0}_sha1".format(i), sha1),
                ]
            )

        # blank the rest of the drives
        for i in range(len(paths), 4):
            self.set_config(
                [
                    ("floppy_drive_{0}".format(i), ""),
                    ("x_floppy_drive_{0}_sha1".format(i), ""),
                ]
            )
        # blank the rest of the image list
        for i in range(len(paths), 20):
            self.set_config(
                [
                    ("floppy_image_{0}".format(i), ""),
                    ("x_floppy_image_{0}_sha1".format(i), ""),
                ]
            )
开发者ID:FrodeSolheim,项目名称:fs-uae-launcher,代码行数:60,代码来源:amigacontext.py

示例5: get_default_directory

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
 def get_default_directory(self, type):
     if type == "floppy":
         return FSGSDirectories.get_floppies_dir()
     elif type == "cd":
         return FSGSDirectories.get_cdroms_dir()
     elif type == "hd":
         return FSGSDirectories.get_hard_drives_dir()
     elif type == "rom":
         return FSGSDirectories.get_kickstarts_dir()
     raise Exception("unknown file dialog type")
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:12,代码来源:LauncherFilePicker.py

示例6: on_item_selected

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
 def on_item_selected(self, index):
     self.set_path(FSGSDirectories.get_floppies_dir())
     if index == 0:
         size = "0.86"
     elif index == 1:
         size = "2.00"
     else:
         raise Exception("Unexpected index " + repr(index))
     self.size_field.set_text(size)
     self.size_field.enable(False)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例7: multiselect

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
    def multiselect(cls, parent=None):
        default_dir = FSGSDirectories.get_floppies_dir()
        dialog = LauncherFilePicker(
            parent, gettext("Select Multiple Floppies"),
            "floppy", multiple=True)
        if not dialog.show_modal():
            return
        original_paths = dialog.get_paths()
        original_paths.sort()
        paths = []
        for path in original_paths:
            path = Paths.get_real_case(path)
            embedded_files = []
            if path.endswith(".zip"):
                archive = Archive(path)
                files = archive.list_files()
                for file in files:
                    name, ext = os.path.splitext(file)
                    # FIXME: get list of floppy extensions from a central
                    # place
                    if ext in [".adf", ".ipf"]:
                        embedded_files.append(file)
            if len(embedded_files) > 0:
                embedded_files.sort()
                print("found embedded floppy images:")
                print(embedded_files)
                for file in embedded_files:
                    paths.append(file)
            else:
                paths.append(path)

        checksum_tool = ChecksumTool(parent)
        for i, path in enumerate(paths):
            sha1 = checksum_tool.checksum(path)
            path = Paths.contract_path(
                path, default_dir, force_real_case=False)

            if i < 4:
                LauncherConfig.set_multiple([
                    ("floppy_drive_{0}".format(i), path),
                    ("x_floppy_drive_{0}_sha1".format(i), sha1)])
            LauncherConfig.set_multiple([
                ("floppy_image_{0}".format(i), path),
                ("x_floppy_image_{0}_sha1".format(i), sha1)])

        # blank the rest of the drives
        for i in range(len(paths), 4):
            LauncherConfig.set_multiple([
                ("floppy_drive_{0}".format(i), ""),
                ("x_floppy_drive_{0}_sha1".format(i), "")])
        # blank the rest of the image list
        for i in range(len(paths), 20):
            LauncherConfig.set_multiple([
                ("floppy_image_{0}".format(i), ""),
                ("x_floppy_image_{0}_sha1".format(i), "")])
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:57,代码来源:floppy_manager.py

示例8: get_default_directory

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
 def get_default_directory(media_type):
     if media_type == "floppy":
         return FSGSDirectories.get_floppies_dir()
     elif media_type == "cd":
         return FSGSDirectories.get_cdroms_dir()
     elif media_type == "hd":
         return FSGSDirectories.get_hard_drives_dir()
     elif media_type == "rom":
         return FSGSDirectories.get_kickstarts_dir()
     # FIXME: Return new Media directory instead
     return FSGSDirectories.get_base_dir()
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: get_floppies_dir

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
 def get_floppies_dir(self):
     # FIXME: dependency loop
     return FSGSDirectories.get_floppies_dir()
开发者ID:FrodeSolheim,项目名称:fs-uae-launcher,代码行数:5,代码来源:amigacontext.py

示例10: fix_loaded_config

# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_floppies_dir [as 别名]
    def fix_loaded_config(cls, config):
        print("[CONFIG] Fix loaded config")
        # cls.fix_joystick_ports(config)

        # FIXME: parent
        checksum_tool = ChecksumTool(None)

        def fix_file_checksum(sha1_key, key, base_dir, is_rom=False):
            path = config.get(key, "")
            # hack to synchronize URLs
            # print(repr(path))
            if path.startswith("http://") or path.startswith("https://"):
                sha1 = path
                config[sha1_key] = sha1
                return
            path = Paths.expand_path(path)
            sha1 = config.get(sha1_key, "")
            if not path:
                return
            if sha1:
                # assuming sha1 is correct
                return
            if not os.path.exists(path):
                print(repr(path), "does not exist")
                path = os.path.join(base_dir, path)
                if not os.path.exists(path):
                    print(repr(path), "does not exist")
                    return
            if os.path.isdir(path):
                # could set a fake checksum here or something, to indicate
                # that it isn't supposed to be set..
                return
            print("checksumming", repr(path))
            size = os.path.getsize(path)
            if size > 64 * 1024 * 1024:
                # not checksumming large files right now
                print("not checksumming large file")
                return

            if is_rom:
                sha1 = checksum_tool.checksum_rom(path)
            else:
                sha1 = checksum_tool.checksum(path)
            config[sha1_key] = sha1

        for i in range(Amiga.MAX_FLOPPY_DRIVES):
            fix_file_checksum(
                "x_floppy_drive_{0}_sha1".format(i),
                "floppy_drive_{0}".format(i),
                FSGSDirectories.get_floppies_dir())
        for i in range(Amiga.MAX_FLOPPY_IMAGES):
            fix_file_checksum(
                "x_floppy_image_{0}_sha1".format(i),
                "floppy_image_{0}".format(i),
                FSGSDirectories.get_floppies_dir())
        for i in range(Amiga.MAX_CDROM_DRIVES):
            fix_file_checksum(
                "x_cdrom_drive_{0}_sha1".format(i),
                "cdrom_drive_{0}".format(i),
                FSGSDirectories.get_cdroms_dir())
        for i in range(Amiga.MAX_CDROM_IMAGES):
            fix_file_checksum(
                "x_cdrom_image_{0}_sha1".format(i),
                "cdrom_image_{0}".format(i),
                FSGSDirectories.get_cdroms_dir())
        for i in range(Amiga.MAX_HARD_DRIVES):
            fix_file_checksum(
                "x_hard_drive_{0}_sha1".format(i),
                "hard_drive_{0}".format(i),
                FSGSDirectories.get_hard_drives_dir())

        # FIXME: need to handle checksums for Cloanto here
        fix_file_checksum(
            "x_kickstart_file_sha1", "x_kickstart_file",
            FSGSDirectories.get_kickstarts_dir(), is_rom=True)
        fix_file_checksum(
            "x_kickstart_ext_file_sha1", "x_kickstart_ext_file",
            FSGSDirectories.get_kickstarts_dir(), is_rom=True)

        # Convert uaegfx_card to new graphics_card option
        uae_gfx_card = config.get(Option.UAEGFX_CARD, "")
        if uae_gfx_card:
            if uae_gfx_card == "1":
                if not config.get(Option.GRAPHICS_CARD, ""):
                    config[Option.GRAPHICS_CARD] = "uaegfx"
            del config[Option.UAEGFX_CARD]
            # FIXME: Set changed!
            config["__changed"] = "1"
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:90,代码来源:launcher_config.py


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