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


Python launcher_config.LauncherConfig类代码示例

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


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

示例1: on_activate_item

 def on_activate_item(self, item):
     path = LauncherConfig.get(self.file_key.format(item))
     sha1 = LauncherConfig.get(self.sha1_key.format(item))
     if self.cd_mode:
         pass
     else:
         fsgs.amiga.insert_floppy_in_free_drive(path, sha1=sha1)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: __init__

 def __init__(self, parent):
     self.parent = weakref.ref(parent)
     LauncherConfig.add_listener(self)
     LauncherSettings.add_listener(self)
     self.dirty = True
     self.do_update()
     parent.destroyed.connect(self.on_parent_destroyed)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: get_initial_text

 def get_initial_text():
     text = ""
     # FIXME: accessing values directly here, not very nice
     keys = app.settings.values.keys()
     for key in sorted(keys):
         if key in LauncherSettings.default_settings:
             continue
         # if key in LauncherConfig.config_keys:
         #     # print("(settings) ignoring key", key)
         #     text += "\n# {0} is ignored here " \
         #             "(use config dialog instead)\n".format(key)
         if LauncherConfig.is_config_only_option(key):
             text += ("\n# {0} will here function as a global config "
                      "default and may cause\nunexpected problems. It is "
                      "recommended to only use this as a per-config "
                      "option.\n".format(key))
         value = app.settings[key]
         if LauncherConfig.get(key):
             text += "\n# {0} is overridden by current " \
                     "configuration\n".format(key)
         text += "{0} = {1}\n".format(key, value)
         if LauncherConfig.get(key):
             text += "\n"
         if key in LauncherConfig.config_keys:
             text += "\n"
     return text
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:26,代码来源:advanced_settings_page.py

示例4: center_window

    def center_window(cls, args, env):
        # FIXME: does not really belong here (dependency loop)
        from launcher.launcher_config import LauncherConfig
        from launcher.launcher_settings import LauncherSettings
        width = (LauncherConfig.get("window_width") or
                 LauncherSettings.get("window_width"))
        height = (LauncherConfig.get("window_height") or
                  LauncherSettings.get("window_height"))
        try:
            width = int(width)
        except:
            width = 960
        try:
            height = int(height)
        except:
            height = 540
        from launcher.ui.launcher_window import LauncherWindow
        if LauncherWindow.current() is None:
            return

        main_w, main_h = LauncherWindow.current().get_size()
        main_x, main_y = LauncherWindow.current().get_position()

        x = main_x + (main_w - width) // 2
        y = main_y + (main_h - height) // 2

        # FIXME: re-implement without wx
        # if windows:
        #     import wx
        #    y += wx.SystemSettings_GetMetric(wx.SYS_CAPTION_Y)

        env[str("SDL_VIDEO_WINDOW_POS")] = str("{0},{1}".format(x, y))
        args.append("--window-x={0}".format(x))
        args.append("--window-y={0}".format(y))
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:34,代码来源:FSUAE.py

示例5: load_settings

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

示例6: new_config

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

示例7: on_model_changed

 def on_model_changed(self):
     print("ModelGroup.on_model_change\n")
     index = self.model_choice.get_index()
     model = self.model_ids[index]
     if model == "A500":
         # The default model (A500) can be specified with the empty string
         model = ""
     LauncherConfig.set("amiga_model", model)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: on_done

        def on_done():
            # FIXME: these should be removed soon
            LauncherSettings.set("last_scan", str(time.time()))
            LauncherSettings.set("__config_refresh", str(time.time()))

            # this must be called from main, since callbacks are broadcast
            # when settings are changed

            LauncherSignal.broadcast("scan_done")
            LauncherConfig.update_kickstart()
开发者ID:,项目名称:,代码行数:10,代码来源:

示例9: __init__

    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        self.error_icon = Image("launcher:res/16/error.png")
        self.warning_icon = Image("launcher:res/16/warning_3.png")
        self.notice_icon = Image("launcher:res/16/information.png")
        self.icons = [
            self.error_icon,
            self.warning_icon,
            self.notice_icon,
        ]
        self.coordinates = []
        self.warnings = []
        self.game_notice = ""
        self.variant_notice = ""
        self.variant_warning = ""
        self.variant_error = ""
        self.joy_emu_conflict = ""
        self.using_joy_emu = False
        self.kickstart_file = ""
        self.x_kickstart_file_sha1 = ""
        self.update_available = ""
        self.__error = ""
        self.x_missing_files = ""
        self.download_page = ""
        self.download_file = ""
        self.amiga_model = ""
        self.amiga_model_calculated = ""
        self.chip_memory = ""
        self.chip_memory_calculated = 0
        self.outdated_plugins = []
        self.custom_config = set()
        self.custom_uae_config = set()
        self.settings_config_keys = set()

        plugin_manager = PluginManager.instance()
        for plugin in plugin_manager.plugins():
            if plugin.outdated:
                self.outdated_plugins.append(plugin.name)

        ConfigBehavior(self, [
            "x_game_notice", "x_variant_notice", "x_variant_warning",
            "x_variant_error", "x_joy_emu_conflict", "amiga_model",
            "x_kickstart_file_sha1", "kickstart_file", "download_page",
            "download_file", "x_missing_files", "__error",
            "chip_memory", "jit_compiler"])
        SettingsBehavior(self, ["__update_available"])

        LauncherConfig.add_listener(self)
        for key in JOYSTICK_KEYS:
            self.on_config(key, LauncherConfig.get(key))
        for key in LauncherConfig.keys():
            if LauncherConfig.is_custom_uae_option(key):
                self.on_config(key, LauncherConfig.get(key))
            elif LauncherConfig.is_custom_option(key):
                self.on_config(key, LauncherConfig.get(key))

        LauncherSettings.add_listener(self)
        for key in LauncherSettings.keys():
            if LauncherConfig.is_config_only_option(key):
                self.on_setting(key, LauncherSettings.get(key))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:60,代码来源:WarningsElement.py

示例10: browse

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

示例11: function

 def function():
     if progress == "__run__":
         self.cancel_button.disable()
         # Hide dialog after 1.5 seconds. The reason for delaying it
         # is to avoid "confusing" flickering if/when the dialog is
         # only shown for a split second.
         # fsui.call_later(1500, hide_function)
         LauncherConfig.set(
             "__progress", gettext("Running: Emulator"))
     else:
         self.sub_title_label.set_text(progress)
         LauncherConfig.set(
             "__progress", "Preparing: {}".format(progress))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:13,代码来源:LaunchDialog.py

示例12: __init__

 def __init__(self, parent, names):
     parent.__config_enable_behavior = self
     self._parent = weakref.ref(parent)
     self._names = set(names)
     LauncherConfig.add_listener(self)
     try:
         parent.destroyed.connect(self.on_parent_destroyed)
     except AttributeError:
         print("WARNING: ConfigBehavior without remove_listener "
               "implementation")
     for name in names:
         # Broadcast initial value
         self.on_config(name, LauncherConfig.get(name))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:13,代码来源:configbehavior.py

示例13: add_config_warnings

 def add_config_warnings(self):
     # FIXME: move such warnings to config model code instead
     if self.chip_memory_calculated and \
                     self.chip_memory_calculated < 2048 and \
                     self.amiga_model_calculated in ["A1200", "A4000"]:
         text = gettext("{amiga_model} with < 2 MB chip memory").format(
             amiga_model=self.amiga_model)
         self.warnings.append((WARNING_LEVEL, text, ""))
     if LauncherConfig.get("amiga_model") == "A4000/OS4":
         if LauncherConfig.get("jit_compiler") == "1":
             text = gettext(
                 "JIT compiler with a PPC-only OS is not recommended")
             self.warnings.append((WARNING_LEVEL, text, ""))
开发者ID:EdwardBetts,项目名称:fs-uae-launcher,代码行数:13,代码来源:WarningsElement.py

示例14: create_list

 def create_list(self):
     items = []
     if self.cd_mode:
         max_items = Amiga.MAX_CDROM_IMAGES
     else:
         max_items = Amiga.MAX_FLOPPY_IMAGES
     for i in range(max_items):
         path = LauncherConfig.get(self.file_key.format(i))
         sha1 = LauncherConfig.get(self.sha1_key.format(i))
         if not path:
             continue
         items.append((path, sha1))
     return items
开发者ID:,项目名称:,代码行数:13,代码来源:

示例15: start_local_game

    def start_local_game(cls):
        print("START LOCAL GAME")
        print("x_missing_files", LauncherConfig.get("x_missing_files"))

        if LauncherConfig.get("x_missing_files"):
            if LauncherConfig.get("download_file"):
                if LauncherConfig.get("download_terms") and not \
                        Downloader.check_terms_accepted(
                            LauncherConfig.get("download_file"),
                            LauncherConfig.get("download_terms")):
                    from .ui.launcher_window import LauncherWindow
                    dialog = DownloadTermsDialog(LauncherWindow.current(), fsgs)
                    if not dialog.show_modal():
                        return

            elif LauncherConfig.get("download_page"):
                from .ui.launcher_window import LauncherWindow
                # fsui.show_error(_("This game must be downloaded first."))
                DownloadGameWindow(LauncherWindow.current(), fsgs).show()
                return
            else:
                fsui.show_error(
                    gettext("This game variant cannot be started "
                            "because you don't have all required files."))
                return

        platform_id = LauncherConfig.get("platform").lower()
        amiga_platform = platform_id in ["", "amiga", "cdtv", "cd32"]
        if amiga_platform:
            cls.start_local_game_amiga()
        else:
            cls.start_local_game_other()
开发者ID:glaubitz,项目名称:fs-uae-debian,代码行数:32,代码来源:fs_uae_launcher.py


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