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


Python FSGSDirectories.FSGSDirectories类代码示例

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


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

示例1: _get_state_dir

    def _get_state_dir(self):
        config_name = self.config_name
        if not config_name:
            config_name = "Default"

        # Use a temporary state dir, for now, to avoid problems with
        # floppy overlays etc interfering with net play.
        if self.fsgc.netplay.enabled:
            # It is possible to manually specify the state dir.
            config_name = self.fsgc.config.get("__netplay_state_dir_name")
            if not config_name:
                # This is the default behavior, create a clean state
                # dir for the net play session.
                netplay_game = self.fsgc.config.get("__netplay_game")
                if netplay_game:
                    config_name = "Net Play ({0})".format(netplay_game)

        # Convert the config name to a name which can be represented on
        # the file system (really all/most filesystems).
        config_name = GameNameUtil.create_fs_name(config_name)

        letter = self.get_letter(config_name)
        if not letter:
            config_name = "Default"
            letter = self.get_letter(config_name)
        # We use an existing state dir in a "letter" dir if it already
        # exists (legacy support).
        path = os.path.join(
            FSGSDirectories.get_save_states_dir(), letter, config_name
        )
        if os.path.exists(path):
            return path
        # If not, we use a direct sub-folder of save states dir.
        path = os.path.join(FSGSDirectories.get_save_states_dir(), config_name)
        return path
开发者ID:FrodeSolheim,项目名称:fs-uae-launcher,代码行数:35,代码来源:saves.py

示例2: _get_state_dir

    def _get_state_dir(self):
        config_name = self.config_name
        if not config_name:
            config_name = "Default"

        # use a temporary state dir, for now, to avoid problems with
        # floppy overlays etc interfering with net play
        from .netplay.netplay import Netplay
        if Netplay.current():
            # it is possible to manually specify the state dir
            config_name = LauncherConfig.get("__netplay_state_dir_name")
            if not config_name:
                # this is the default behavior, create a clean state
                # dir for the net play session
                netplay_game = LauncherConfig.get("__netplay_game")
                if netplay_game:
                    config_name = "Net Play ({0})".format(netplay_game)

        letter = self.get_letter(config_name)
        if not letter:
            config_name = "Default"
            letter = self.get_letter(config_name)
        # we use an existing state dir in a "letter" dir if it exists
        # (legacy support).
        path = os.path.join(FSGSDirectories.get_save_states_dir(), letter,
                            config_name)
        if os.path.exists(path):
            return path
        # if not, we use a direct sub-folder of save states dir
        path = os.path.join(FSGSDirectories.get_save_states_dir(),
                            config_name)
        return path
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:32,代码来源:game_paths.py

示例3: plugin_path

 def plugin_path(cls):
     result = []
     plugins_dir = FSGSDirectories.get_plugins_dir()
     if plugins_dir and os.path.isdir(plugins_dir):
         result.append(plugins_dir)
     expansion_dir = os.path.join(
         FSGSDirectories.get_base_dir(), "Workspace", "Expansion"
     )
     if expansion_dir and os.path.isdir(expansion_dir):
         result.append(expansion_dir)
     if System.macos:
         system_plugins_dir = os.path.join(
             fsboot.executable_dir(),
             "..",
             "..",
             "..",
             "..",
             "..",
             "..",
             "Plugins",
         )
     else:
         system_plugins_dir = os.path.join(
             fsboot.executable_dir(), "..", "..", "..", "Plugins"
         )
     if os.path.isdir(system_plugins_dir):
         result.append(system_plugins_dir)
     return result
开发者ID:,项目名称:,代码行数:28,代码来源:

示例4: get_default_directory

 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,代码行数:10,代码来源:LauncherFilePicker.py

示例5: plugin_path

 def plugin_path(cls):
     result = []
     plugins_dir = FSGSDirectories.get_plugins_dir()
     if plugins_dir and os.path.isdir(plugins_dir):
         result.append(plugins_dir)
     expansion_dir = os.path.join(
             FSGSDirectories.get_base_dir(), "Workspace", "Expansion")
     if expansion_dir and os.path.isdir(expansion_dir):
         result.append(expansion_dir)
     return result
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:10,代码来源:plugin_manager.py

示例6: get_default_directory

 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:,项目名称:,代码行数:11,代码来源:

示例7: custom_database_names

 def custom_database_names():
     custom_dir = os.path.join(FSGSDirectories.databases_dir(), "Custom")
     custom_databases = []
     if os.path.exists(custom_dir):
         for item in os.listdir(custom_dir):
             if item.endswith(".sqlite"):
                 custom_databases.append("Custom/" + item[:-7])
     custom_dir = os.path.join(FSGSDirectories.databases_dir(), "User")
     custom_databases = []
     if os.path.exists(custom_dir):
         for item in os.listdir(custom_dir):
             if item.endswith(".sqlite"):
                 custom_databases.append("User/" + item[:-7])
     return custom_databases
开发者ID:,项目名称:,代码行数:14,代码来源:

示例8: __init__

    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("settings", "pkg:workspace")
        # gettext("WHDLoad Settings")
        title = gettext("WHDLoad")
        subtitle = gettext("Options for WHDLoad support in FS-UAE Launcher")
        self.add_header(icon, title, subtitle)

        label = fsui.MultiLineLabel(self, gettext(
            "The following options only apply when you use the automatic "
            "WHDLoad support in FS-UAE Launcher, for example in relation with "
            "the online game database."), 640)
        self.layout.add(label, fill=True, margin_top=0)

        self.add_option("whdload_splash_delay")

        label = fsui.Label(
            self, gettext("Directory for WHDLoad.key file (if you have it):"))
        self.layout.add(label, margin_top=10)
        hor_layout = fsui.HorizontalLayout()
        self.layout.add(hor_layout, margin_top=4, fill=True)
        label = fsui.Label(
            self, FSGSDirectories.get_base_dir())
        hor_layout.add_spacer(0, expand=True)
        hor_layout.add(label)
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:25,代码来源:whdload_settings_page.py

示例9: decode_path

 def decode_path(self, path):
     if not path or path[0] != "$":
         return path
     base_dir = FSGSDirectories.get_base_dir() + "/"
     if path.startswith("$/"):
         path = base_dir + path[2:]
     return path
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:7,代码来源:FileDatabase.py

示例10: get_file_for_sha1_cached

def get_file_for_sha1_cached(sha1, size_arg, cache_ext):
    cache_zip = get_cache_zip_for_sha1(sha1)
    if cache_zip is not None:
        try:
            return cache_zip.open("{}/{}{}".format(
                sha1[:2], sha1, cache_ext))
        except KeyError:
            pass
    cache_dir = FSGSDirectories.images_dir_for_sha1(sha1)
    cache_file = os.path.join(cache_dir, sha1 + cache_ext)
    if os.path.exists(cache_file):
        # An old bug made it possible for 0-byte files to exist, so
        # we check for that here...
        if os.path.getsize(cache_file) > 0:
            return cache_file

    url = "{}/image/{}{}".format(openretro_url_prefix(), sha1, size_arg)
    print("[IMAGES]", url)
    r = urlopen(url)
    data = r.read()
    cache_file_partial = "{}.{}.partial".format(
        cache_file, str(uuid4())[:8])
    if not os.path.exists(os.path.dirname(cache_file_partial)):
        os.makedirs(os.path.dirname(cache_file_partial))
    with open(cache_file_partial, "wb") as f:
        f.write(data)
    os.rename(cache_file_partial, cache_file)
    return cache_file
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:28,代码来源:imageloader.py

示例11: __init__

    def __init__(self, fsgc):
        self.fsgc = fsgc
        self.files = GameFiles(fsgc)
        self.logger = GameDriverLogger()
        self.emulator = Emulator("no-emulator")

        self.options = defaultdict(str)
        self.init_options()

        self.ports = []
        self.init_ports()

        self._allow_gsync = True
        self._model_name = ""
        self._emulator_skin_prepared = {}
        self.__vsync = False
        self.__game_temp_file = None

        self.temp_root = TemporaryItem(
            root=None, prefix="fsgs-", suffix="tmp", directory=True
        )
        # # Default current working directory for the emulator.
        self.cwd = self.temp_dir("cwd")
        # # Fake home directory for the emulator.
        self.home = self.temp_dir("home")
        self.home._path = os.path.join(FSGSDirectories.get_cache_dir(), "Home")
        if not os.path.exists(self.home.path):
            os.makedirs(self.home.path)
        # noinspection PyProtectedMember
        self.cwd._path = self.home._path
开发者ID:FrodeSolheim,项目名称:fs-uae-launcher,代码行数:30,代码来源:gamedriver.py

示例12: get_cache_path

 def get_cache_path(cls, sha1_or_uuid):
     path = os.path.join(
         FSGSDirectories.get_cache_dir(), "Downloads", sha1_or_uuid[:3]
     )
     if not os.path.exists(path):
         os.makedirs(path)
     return os.path.join(path, sha1_or_uuid)
开发者ID:FrodeSolheim,项目名称:fs-uae-launcher,代码行数:7,代码来源:download.py

示例13: find_font_path_or_stream

def find_font_path_or_stream(name):
    path = os.path.join(
        FSGSDirectories.get_base_dir(), "Workspace", "Fonts", name)
    if os.path.exists(path):
        return path
    stream = resources.resource_stream(name)
    return stream
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:7,代码来源:window.py

示例14: setup_logging

def setup_logging(log_name):
    if sys.platform == "win32" and "FS_FORCE_STDOUT" not in os.environ:
        # noinspection PyUnresolvedReferences
        # import win32console
        if hasattr(sys, "frozen"):
            # or win32console.GetConsoleWindow() == 0:
            sys.stdout = NullOutput()
            sys.stderr = NullOutput()

    # FIXME: remove dependency on fsgs here!
    from fsgs.FSGSDirectories import FSGSDirectories
    logs_dir = FSGSDirectories.get_logs_dir()
    log_file = os.path.join(logs_dir, log_name)
    try:
        f = open(log_file, "wb")
    except Exception:
        print("could not open log file")
        # use MultiplexedOutput here too, for the mutex handling
        sys.stdout = MultiplexedOutput(sys.stdout)
        sys.stderr = MultiplexedOutput(sys.stderr)
    else:
        sys.stdout = MultiplexedOutput(FileOutput(f), sys.stdout)
        sys.stderr = MultiplexedOutput(FileOutput(f), sys.stderr)

    logging.basicConfig(stream=sys.stdout, level=logging.NOTSET)
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:25,代码来源:logging.py

示例15: on_add_button

    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,代码行数:32,代码来源:MediaListGroup.py


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