def read(xml_path):
    params = {}
    for item in resource_helper.root_iterator(xml_path):
        params[item.name] = item.value

    coefficients = params.pop('coefficients')
    bonuses = params.pop('bonuses')
    for paramName, bonusTypes in bonuses.iteritems():
        bonuses[paramName] = tuple(_getBonusTypesGenerator(bonusTypes))

    return (coefficients, bonuses)
Example #2
0
    def __init__(self):
        self.__settings = _DEFAULT_SETTINGS.copy()
        settings = {}
        for item in resource_helper.root_iterator(GUI_SETTINGS_FILE_PATH, customReaders={'macros': _readMacros}):
            if item.name in _SETTING_CONVERTERS:
                setting = _DEFAULT_SETTINGS[item.name]
                converter = _SETTING_CONVERTERS[item.name]
                value = converter(setting, item)
            else:
                value = item.value
            settings[item.name] = value

        if constants.IS_DEVELOPMENT:
            diff = set(self.__settings.keys()) - set(settings.keys())
            if diff:
                _logger.info('Settings are not in %s: %r', GUI_SETTINGS_FILE_PATH, diff)
        self.__settings.update(settings)
Example #3
0
    def __init__(self):
        """
        constructs GuiSettings instance using values from guiPresetsResource
        """
        self.__settings = _DEFAULT_SETTINGS.copy()
        settings = {}
        for item in resource_helper.root_iterator(GUI_SETTINGS_FILE_PATH, customReaders={'macros': _readMacros}):
            if item.name in _SETTING_CONVERTERS:
                setting = _DEFAULT_SETTINGS[item.name]
                converter = _SETTING_CONVERTERS[item.name]
                value = converter(setting, item)
            else:
                value = item.value
            settings[item.name] = value

        if constants.IS_DEVELOPMENT:
            diff = set(self.__settings.keys()) - set(settings.keys())
            if len(diff):
                LOG_NOTE('Settings are not in {0}:'.format(GUI_SETTINGS_FILE_PATH), diff)
        self.__settings.update(settings)
Example #4
0
    def __init__(self):
        """
        constructs GuiSettings instance using values from guiPresetsResource
        """
        self.__settings = _DEFAULT_SETTINGS.copy()
        settings = {}
        for item in resource_helper.root_iterator(
                GUI_SETTINGS_FILE_PATH, customReaders={'macros': _readMacros}):
            if item.name in _SETTING_CONVERTERS:
                setting = _DEFAULT_SETTINGS[item.name]
                converter = _SETTING_CONVERTERS[item.name]
                value = converter(setting, item)
            else:
                value = item.value
            settings[item.name] = value

        if constants.IS_DEVELOPMENT:
            diff = set(self.__settings.keys()) - set(settings.keys())
            if len(diff):
                LOG_NOTE(
                    'Settings are not in {0}:'.format(GUI_SETTINGS_FILE_PATH),
                    diff)
        self.__settings.update(settings)
Example #5
0
 def __init__(self):
     self.__params = {}
     for item in resource_helper.root_iterator(
             SIMPLIFIED_COEFFICIENTS_PATH):
         self.__params[item.name] = item.value
 def __init__(self):
     self.__params = {}
     for item in resource_helper.root_iterator(SIMPLIFIED_COEFFICIENTS_PATH):
         self.__params[item.name] = item.value