コード例 #1
0
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)
コード例 #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)
コード例 #3
0
ファイル: guisettings.py プロジェクト: webiumsk/WOT-0.9.14-CT
    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)
コード例 #4
0
ファイル: guiguisettings.py プロジェクト: Difrex/wotsdk
    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)
コード例 #5
0
 def __init__(self):
     self.__params = {}
     for item in resource_helper.root_iterator(
             SIMPLIFIED_COEFFICIENTS_PATH):
         self.__params[item.name] = item.value
コード例 #6
0
 def __init__(self):
     self.__params = {}
     for item in resource_helper.root_iterator(SIMPLIFIED_COEFFICIENTS_PATH):
         self.__params[item.name] = item.value