; K@c@sdZdkZdklZlZlZdZdZdfdYZe djoee GHeei dZ d e i GHe id GHd e iGHe iGHx8e iD]*Zd ed edeedfGHqWe iGHe iGHndS(sIParse the AppInfo files. Written by Christopher Arndt and Stephen Watson.N(sNodesminidoms XML_NAMESPACEcCsu|tjo:dddg}ydk}|ii|}WqmqmXn't|tdjo |g}n|SdS(NsensCs(slangssNonesroxsi18nstype(slangssrox((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys _getlangss   cCsOdigi}|iD]*}|itijo||i qq~SdS(s2Return all the text directly inside this DOM Node.sN( sjoinsappends_[1]snodes childNodesstextsnodeTypesNodes TEXT_NODEs nodeValue(snodes_[1]stext((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys_datassAppInfocBstZdZdZdZdZdZdZedZ edZ dZ ed Z d Z ed Zd Zed ZdZdZdZdZdZRS(scParsed AppInfo.xml file. Current only deals with the , and elementscCs4ti||_|i|i|idS(s,Read the file and parse the element.N(sminidomsparsessourcesselfs_docs _parseAbouts _parseSummarys _parseMenu(sselfssource((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys__init__s   cCsh|_x|iiidD]}|itd}h|i|ssItemsoptionsLabelslangsAppMenuslabels sub-menusN(snodesgetElementsByTagNamesitems getAttributesoptslabelsslabelsgetAttributeNSs XML_NAMESPACEslangs_datas sub_menusssubsselfs _parseAppMenusmenussappend( sselfsmenussnodesopts sub_menusslangsitemslabelsslabelssub((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys _parseAppMenu?scCsft|}xS|D]G}|ii|o.|i|i|o|i||SqZqqWtSdS(sReturn an entry from the section. elname is the name of the element to return text from langs is a list of acceptable languages, or None to use rox.i18n.langs N(s _getlangsslangsslangsselfsaboutshas_keyselnamesNone(sselfselnameslangsslang((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pysgetAboutMs cCsV|id|}|tjo|id|}n|tjodSn|dSdS(skReturn the contents of the element in the section (also tries if needed.sAuthorssAuthorsiN(sselfsgetAboutslangssauthsNone(sselfslangssauth((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys getAuthors]s  cCs!|ii| o<|iid}|itd||ii i |nx|ii i dD]}|i td|jox|i D]x}|itijo |i|joO|i||ii|}|ii|}|i ||i |qqWqfqfW|idS(sSet the value of an element in the section. If no element 'elname' is present in the section with the matching 'lang' attribute, append a new one. If no such section exists yet, create it first. value must be a unicode string. sAboutsxml:langslangN(sselfsaboutshas_keyslangs_docs createElementsabssetAttributeNSs XML_NAMESPACEsdocumentElements appendChildsgetElementsByTagNamesgetAttributeNSs childNodessnodesnodeTypesNodes ELEMENT_NODEs localNameselnames removeChildselscreateTextNodesvaluestexts _parseAbout(sselfselnamesvalueslangsnodesabselstext((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pyssetAbouths" #  cCsGt|}x4|D](}|ii|o|i|SqqWtSdS(sReturn the content of the element. langs is a list of acceptable languages, or None to use rox.i18n.langs N(s _getlangsslangsslangsselfssummaryshas_keysNone(sselfslangsslang((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys getSummarys cCs|ii|oQxN|iiidD]3}|itd|jo|i i |q)q)Wn|ii d}|i td||ii |}|i||iii||idS(sSet content of the Summary element with matching 'lang' attribute. If no such element is present, append a new one to the DOM object. value must be a unicode string. sSummaryslangsxml:langN(sselfssummaryshas_keyslangs_docsdocumentElementsgetElementsByTagNamesgetAttributeNSs XML_NAMESPACEs parentNodes removeChilds createElementssetAttributeNSscreateTextNodesvaluestexts appendChilds _parseSummary(sselfsvalueslangstextssummary((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys setSummarys cCs8|tjo|ii|Sn|ii||SdS(sqReturn all instances of the named element with an optional name space. They are returned as DOM objects.N(snssNonesselfs_docsgetElementsByTagNameselnamesgetElementsByTagNameNS(sselfselnamesns((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys findElementss cCshd|d<}|d}xW|D])}|i|o|||d %d subslabelsoptions sub-menus(s__doc__ssyssxml.domsNodesminidoms XML_NAMESPACEs _getlangss_datasAppInfos__name__sNonesargvsais getSummarysgetAbouts getAuthorssmenus getAppMenuslens getCanRunsgetCanThumbnail( sNodesminidomsAppInfos _getlangssaismenussyss_datas XML_NAMESPACE((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/AppInfo.pys?s"     (