예제 #1
0
def load_config():

    global previous_config_version
    global new_config_version
    global section_deprecations
    global section_replacements
    global section_warnings
    global string_replacements

    config_dict = FileManager.load(CONFIG_VERSION_FILE)

    for key in config_dict.keys():
        if type(key) is not int:
            del config_dict[key]

    # todo could add support for command line param to specify version
    new_config_version = max(config_dict)
    previous_config_version = new_config_version-1

    print
    print ("Migrating MPF config files from v" + str(previous_config_version) +
           " to v" + str(new_config_version))

    target_file_versions.add(previous_config_version)

    if options['force']:
        print ("Will also re-check v" + str(new_config_version) + " files")
        target_file_versions.add(new_config_version)

    section_replacements = config_dict[new_config_version].get('section_replacements', dict())
    section_warnings = config_dict[new_config_version].get('section_warnings', dict())
    section_deprecations = config_dict[new_config_version].get('section_deprecations', dict())
    string_replacements = config_dict[new_config_version].get('string_replacements', dict())
예제 #2
0
파일: data_manager.py 프로젝트: HarryXS/mpf
    def _load(self):
        self.log.debug("Loading %s from %s", self.name, self.filename)
        if os.path.isfile(self.filename):
            self.data = FileManager.load(self.filename, halt_on_error=False)

        else:
            self.log.debug("Didn't find the %s file. No prob. We'll create "
                          "it when we save.", self.name)
예제 #3
0
    def _load(self):
        self.log.debug("Loading %s from %s", self.name, self.filename)
        if os.path.isfile(self.filename):
            self.data = FileManager.load(self.filename, halt_on_error=False)

        else:
            self.log.debug(
                "Didn't find the %s file. No prob. We'll create "
                "it when we save.", self.name)
예제 #4
0
    def load_config_file(filename, verify_version=True, halt_on_error=True):
        config = FileManager.load(filename, verify_version, halt_on_error)

        if 'config' in config:
            path = os.path.split(filename)[0]

            for file in Util.string_to_list(config['config']):
                full_file = os.path.join(path, file)
                config = Util.dict_merge(config,
                                         Config.load_config_file(full_file))
        return config
예제 #5
0
파일: config.py 프로젝트: HarryXS/mpf
    def load_config_file(filename, verify_version=True, halt_on_error=True):
        config = FileManager.load(filename, verify_version, halt_on_error)

        if 'config' in config:
            path = os.path.split(filename)[0]

            for file in Util.string_to_list(config['config']):
                full_file = os.path.join(path, file)
                config = Util.dict_merge(config,
                                           Config.load_config_file(full_file))
        return config
예제 #6
0
    def _load_config_file(self, filename, verify_version=True, halt_on_error=True):
        config_file = MPFConfigFile(filename, FileManager.load(filename, verify_version, halt_on_error, True))

        try:
            if 'config' in config_file.config:
                path = os.path.split(filename)[0]

                for file in Util.string_to_list(config_file.config['config']):
                    full_file = os.path.join(path, file)
                    new_config = self._load_config_file(full_file)
                    config_file.add_child_file(new_config)
            return config_file
        except TypeError:
            return dict()
예제 #7
0
def load_config():

    global previous_config_version
    global new_config_version
    global section_deprecations
    global section_replacements
    global section_warnings
    global string_replacements

    config_dict = FileManager.load(CONFIG_VERSION_FILE)

    for key in config_dict.keys():
        if type(key) is not int:
            del config_dict[key]

    # todo could add support for command line param to specify version
    new_config_version = max(config_dict)
    previous_config_version = new_config_version - 1

    print
    print("Migrating MPF config files from v" + str(previous_config_version) +
          " to v" + str(new_config_version))

    target_file_versions.add(previous_config_version)

    if options['force']:
        print("Will also re-check v" + str(new_config_version) + " files")
        target_file_versions.add(new_config_version)

    section_replacements = config_dict[new_config_version].get(
        'section_replacements', dict())
    section_warnings = config_dict[new_config_version].get(
        'section_warnings', dict())
    section_deprecations = config_dict[new_config_version].get(
        'section_deprecations', dict())
    string_replacements = config_dict[new_config_version].get(
        'string_replacements', dict())
예제 #8
0
 def load_show_from_disk(self):
     return FileManager.load(self.file_name)
예제 #9
0
 def load_show_from_disk(self):
     return FileManager.load(self.file_name)