def _readHintSection(xmlCtx, section, flags): hintID = sub_parsers.parseID(xmlCtx, section, 'Specify a hint ID') if 'item-id' in section.keys(): itemID = sub_parsers.parseID(xmlCtx, section['item-id'], 'Specify a item ID') else: _xml.raiseWrongXml(xmlCtx, section.name, 'Specify a item ID') return tags = section.keys() text = translation(_xml.readString(xmlCtx, section, 'text')) if 'arrow' in tags: subSec = section['arrow'] direction = _xml.readString(xmlCtx, subSec, 'direction') if direction not in _AVAILABLE_DIRECTIONS: _xml.raiseWrongXml(xmlCtx, section, 'Arrow direction {} is invalid.'.format(direction)) arrow = _ArrowProps(direction, _xml.readBool(xmlCtx, subSec, 'loop')) else: arrow = None if 'padding' in tags: subSec = section['padding'] padding = _Padding(_xml.readFloat(xmlCtx, subSec, 'left'), _xml.readFloat(xmlCtx, subSec, 'top'), _xml.readFloat(xmlCtx, subSec, 'right'), _xml.readFloat(xmlCtx, subSec, 'bottom')) else: padding = None hint = chapter.ChainHint(hintID, itemID, text, section.readBool('has-box', True), arrow, padding) hint.setActions(sub_parsers.parseActions(xmlCtx, _xml.getSubsection(xmlCtx, section, 'actions'), flags)) return hint
def _readHintSection(xmlCtx, section, flags): hintID = sub_parsers.parseID(xmlCtx, section, 'Specify a hint ID') if 'item-id' in section.keys(): itemID = sub_parsers.parseID(xmlCtx, section['item-id'], 'Specify a item ID') else: _xml.raiseWrongXml(xmlCtx, section.name, 'Specify a item ID') return tags = section.keys() text = translation(_xml.readString(xmlCtx, section, 'text')) if 'arrow' in tags: subSec = section['arrow'] direction = _xml.readString(xmlCtx, subSec, 'direction') if direction not in _AVAILABLE_DIRECTIONS: _xml.raiseWrongXml( xmlCtx, section, 'Arrow direction {} is invalid.'.format(direction)) arrow = _ArrowProps(direction, _xml.readBool(xmlCtx, subSec, 'loop')) else: arrow = None if 'padding' in tags: subSec = section['padding'] padding = _Padding(_xml.readFloat(xmlCtx, subSec, 'left'), _xml.readFloat(xmlCtx, subSec, 'top'), _xml.readFloat(xmlCtx, subSec, 'right'), _xml.readFloat(xmlCtx, subSec, 'bottom')) else: padding = None hint = chapter.ChainHint(hintID, itemID, text, section.readBool('has-box', True), arrow, padding) hint.setActions( sub_parsers.parseActions( xmlCtx, _xml.getSubsection(xmlCtx, section, 'actions'), flags)) return hint
def readHintSection(xmlCtx, section, flags): sectionInfo = sub_parsers.parseHint(xmlCtx, section) hint = chapter.ChainHint(sectionInfo['hintID'], sectionInfo['itemID'], sectionInfo['text'], sectionInfo['hasBox'], sectionInfo['arrow'], sectionInfo['padding']) hint.setActions( sub_parsers.parseActions( xmlCtx, _xml.getSubsection(xmlCtx, section, 'actions'), flags)) return hint
def readHintSection(xmlCtx, section, flags): sectionInfo = sub_parsers.parseHint(xmlCtx, section) hint = chapter.ChainHint(sectionInfo['hintID'], sectionInfo['itemID'], sectionInfo['text'], sectionInfo['hasBox'], sectionInfo['arrow'], sectionInfo['padding']) hint.setActions(sub_parsers.parseActions(xmlCtx, _xml.getSubsection(xmlCtx, section, 'actions'), flags)) return hint