NS @sddlmZddlZGdddZGdddZddZd d Zd d Zed krxedD]Z e e qWxeD]Z e e qWndS))print_functionNc@s(eZdZddZddZdS)VariantcCs||_||_||_dS)N)namedescraw_desc)selfrrrr6/usr/lib/python3/dist-packages/LanguageSelector/xkb.py__init__s  zVariant.__init__cCsd|j|j|jfS)Nz %s: %s, %s)rrr)rrrr __str__ szVariant.__str__N)__name__ __module__ __qualname__r r rrrr rs  rc@s(eZdZddZddZdS)LayoutcCs:||_||_||_||_||_||_dS)N)rrr short_descraw_short_descvariants)rrrrrrrrrr r s      zLayout.__init__cCs9d|j|j|j|j|jdd|jDfS)Nz%s: %s, %s; %s, %s;; %scSsg|]}d|qS)z%sr).0xrrr s z"Layout.__str__..)rrrrrr)rrrr r szLayout.__str__N)r r rr r rrrr rs  rcCsRt}tjd}|j}x'|jdD]}|j|jq4W|S)Nz/etc/X11/xkb/rules/xorg.xmlz;/xkbConfigRegistry/layoutList/layout/configItem/name/text())listlibxml2 parseFilexpathNewContext xpathEvalappendcontent)Zpossibility_listdocctxtirrr get_all_layout_possibilitiess   r cCst}|jd}x|D]w}t|jd|dkr^|jd|d}nd}t|j||jddj}|j|qW|S)Nz3../../../variantList/variant/configItem/name/text()z../description[@xml:lang='%s']rz../../description[position()=1])rrlenrrr)Z layout_nodelangZ variant_listZ variant_nodesrZtransvrrr get_variants&s  %r%c Cs&t}tjd}|j}|jd}x|D]}|j|kr:t|jd|dkr|jd|d}nd}t|jd|dkr|jd|d}nd}|jt|j||jddj||jddjt ||q:q:W|S) Nz/etc/X11/xkb/rules/xorg.xmlz;/xkbConfigRegistry/layoutList/layout/configItem/name/text()z../description[@xml:lang='%s']rr!z#../shortDescription[@xml:lang='%s']z../../description[position()=1]z$../../shortDescription[position()=1]) rrrrrrr"rrr%)r#Z layout_listrrZ layout_nodesrZ translationZ short_transrrr get_layouts6s"   r&__main__Zfr) Z __future__rrrrr r%r&r rprintrrrr s