예제 #1
0
def _parseGuiItem(xmlCtx, section, flags, itemFlags):
    itemID = parseID(xmlCtx, section, 'Specify a GUI item ID')
    props = {}
    tags = section.keys()
    if 'properties' in tags:
        for _, subSec in _xml.getChildren(xmlCtx, section, 'properties'):
            propType, propSec = subSec.items()[0]
            props[subSec.asString] = readVarValue(propType, propSec)

    item = chapter.GuiItemRef(itemID,
                              props,
                              conditions=_parseConditions(
                                  xmlCtx, section, flags))
    if 'on-scene-effects' in tags:
        for _, effectSec in _xml.getChildren(xmlCtx, section,
                                             'on-scene-effects'):
            effect = _parseEffect(xmlCtx, effectSec, itemFlags)
            if effect is not None:
                item.addOnSceneEffect(effect)

    if 'not-on-scene-effects' in tags:
        for _, effectSec in _xml.getChildren(xmlCtx, section,
                                             'not-on-scene-effects'):
            effect = _parseEffect(xmlCtx, effectSec, itemFlags)
            if effect is not None:
                item.addNotOnSceneEffect(effect)

    return item
예제 #2
0
def _parseGuiItem(xmlCtx, section, flags, itemFlags):
    itemID = parseID(xmlCtx, section, 'Specify a GUI item ID')
    tags = section.keys()
    item = tutorial_chapter.GuiItemRef(itemID, conditions=_parseConditions(xmlCtx, section, flags))
    if 'on-scene-effects' in tags:
        for _, effectSec in _xml.getChildren(xmlCtx, section, 'on-scene-effects'):
            effect = _parseEffect(xmlCtx, effectSec, itemFlags)
            if effect is not None:
                item.addOnSceneEffect(effect)

    if 'not-on-scene-effects' in tags:
        for _, effectSec in _xml.getChildren(xmlCtx, section, 'not-on-scene-effects'):
            effect = _parseEffect(xmlCtx, effectSec, itemFlags)
            if effect is not None:
                item.addNotOnSceneEffect(effect)

    return item