def termChar(s): if len(compose.char(s)) > 1: return xmlChar(compose.terminators.get(compose.char(s), "?")) return xmlChar(compose.terminators.get(compose.char(s), compose.char(s)))
for v in xkb.tmplValues.itervalues(): if terminators.has_key(v): dks.add(v) composeDeadKeys = {} # parse compose to find the chars not supported xkb with the dead keys fCompose = file(defaults.composeFile) for l in fCompose: if not l.startswith("XCOMM") and not l.startswith("##") and "<Multi_key>" not in l and len(l.strip()) != 0:# and "<KP_" not in l and "<underbar>" not in l and "<rightcaret>" not in l and "<leftshoe>" not in l and "<leftcaret>" not in l and "<rightshoe>" not in l and "<U223C>" not in l: seq = re.findall('<([^ ]+)>', l.split(":")[0]) seq = [compose.upperUnicode(s) for s in seq] if compose.areSupportedChars(seq): c = l.split(":")[1].split()[1] k = tuple(compose.char(n) for n in seq) composeDeadKeys[k] = compose.char(c) # print composeDeadKeys f = file(sys.argv[2], "w") for m in sorted([m for m in dead_keys.dmm if len(m) == 1]): if m[0] in dks: comm = u"" else: comm = u"#" deadName = "dead_" + m[0].replace("ringabove", "abovering") print >> f, "# %s" % deadName print >> f for k, mods in sorted(dead_keys.dc): if mods == m and dead_keys.dc.has_key((k, ())):
f = file(defaults.xkbFile) normal = {} shift = {} altgr = {} altgrshift = {} options = {} for l in f: res = re_catchKey.match(l) if res: key = unicode(res.group(1)) charsGroup = res.group(3) chars = re.split(r', *', charsGroup) chars = [c.strip() for c in chars] chars = [compose.char(c) for c in chars] chars = chars + [''] * (4 - len(chars)) normal[key], shift[key], altgr[key], altgrshift[key] = chars options[key] = res.group(2) # print key, chars # print altgr["AD09"] # sys.exit() tmplValues = {} chars = set() tmplValues.update(normal) for k, v in normal.iteritems(): V = v
f = file(defaults.xkbFile) normal = {} shift = {} altgr = {} altgrshift = {} options = {} for l in f: res = re_catchKey.match(l) if res: key = unicode(res.group(1)) charsGroup = res.group(3) chars = re.split(r', *', charsGroup) chars = [c.strip() for c in chars] chars = [compose.char(c) for c in chars] chars = chars + ['']*(4-len(chars)) normal[key], shift[key], altgr[key], altgrshift[key] = chars options[key] = res.group(2) # print key, chars # print altgr["AD09"] # sys.exit() tmplValues = {} chars = set() tmplValues.update(normal) for k, v in normal.iteritems(): V = v
composeDeadKeys = {} # parse compose to find the chars not supported xkb with the dead keys fCompose = file(defaults.composeFile) for l in fCompose: if not l.startswith("XCOMM") and not l.startswith( "##" ) and "<Multi_key>" not in l and len( l.strip() ) != 0: # and "<KP_" not in l and "<underbar>" not in l and "<rightcaret>" not in l and "<leftshoe>" not in l and "<leftcaret>" not in l and "<rightshoe>" not in l and "<U223C>" not in l: seq = re.findall('<([^ ]+)>', l.split(":")[0]) seq = [compose.upperUnicode(s) for s in seq] if compose.areSupportedChars(seq): c = l.split(":")[1].split()[1] k = tuple(compose.char(n) for n in seq) composeDeadKeys[k] = compose.char(c) # print composeDeadKeys f = file(sys.argv[2], "w") for m in sorted([m for m in dead_keys.dmm if len(m) == 1]): if m[0] in dks: comm = u"" else: comm = u"#" deadName = "dead_" + m[0].replace("ringabove", "abovering") print >> f, "# %s" % deadName print >> f for k, mods in sorted(dead_keys.dc): if mods == m and dead_keys.dc.has_key((k, ())):