Example #1
0
 def _readBasicConfig(self, xmlCtx, section):
     self.name = section.name
     self.id = (nations.NONE_INDEX,
                _xml.readInt(xmlCtx, section, 'id', 0, 65535))
     self.compactDescr = vehicles.makeIntCompactDescrByID(
         self.itemTypeName, *self.id)
     if not section.has_key('tags'):
         self.tags = frozenset()
     else:
         self.tags = _readTags(xmlCtx, section, 'tags', self.itemTypeName)
     if IS_CLIENT or IS_WEB:
         self.i18n = shared_components.I18nComponent(
             section.readString('userString'),
             section.readString('description'))
         self.icon = _xml.readIcon(xmlCtx, section, 'icon')
     if IS_CELLAPP or not section.has_key('vehicleFilter'):
         self.__vehicleFilter = None
     else:
         self.__vehicleFilter = _VehicleFilter((xmlCtx, 'vehicleFilter'),
                                               section['vehicleFilter'])
     if not section.has_key('incompatibleTags'):
         self.__artefactFilter = None
     else:
         self.__artefactFilter = _ArtefactFilter(
             (xmlCtx, 'incompatibleTags'), section['incompatibleTags'],
             self.itemTypeName)
     self.removable = section.readBool('removable', False)
     return
def _readSkillBasics(xmlCtx, section, subsectionName):
    section = _xml.getSubsection(xmlCtx, section, subsectionName)
    xmlCtx = (xmlCtx, subsectionName)
    if IS_CLIENT or IS_WEB:
        skill = skills_components.BasicSkill(subsectionName, i18n=shared_components.I18nComponent(section.readString('userString'), section.readString('description')), icon=_xml.readNonEmptyString(xmlCtx, section, 'icon'))
    else:
        skill = skills_components.BasicSkill(subsectionName)
    return (skill, xmlCtx, section)
Example #3
0
def readUserText(section):
    """Reads i18n information that contains user-friendly name, description of item.
    :param section: instance of DataSection.
    :return: instance of I18nComponent.
    """
    return shared_components.I18nComponent(
        section.readString('userString'), section.readString('description'),
        section.readString('shortUserString'))
Example #4
0
def readUserText(section):
    return shared_components.I18nComponent(
        section.readString('userString'), section.readString('description'),
        section.readString('shortUserString'),
        section.readString('shortDescriptionSpecial'),
        section.readString('longDescriptionSpecial'))