Exemplo n.º 1
0
# the dictionnary which associate the char, case, and modifiers to an unicode
# character
# key: ( ( name, case), (mod1, mod2, ...) )
# value: an unicode char
dc = {}

# the set of modifiers used
dm = set()

# the set of sets of modifiers
dmm = set()

for name, C in unicode_dict.iteritems():
  # to register the name in compose
  compose.name(C)
  # split the name and the modifiers
  ns = name.split(' WITH ')
  n = ns[0]
  ms = ' AND '.join(ns[1:])
  modifiers = ms.split(' AND ')
  # some chars have a WITH to describe something which is not a modifier
  for m in ['SMALL LETTER J', 'SMALL LETTER Z', 'STRIKETHROUGH']:
    if m in modifiers :
      n = n + ' WITH ' + m
      modifiers.remove(m)
  # translate the dotless modifier to dot above.
  if 'DOTLESS' in n:
    n = n.replace('DOTLESS ', '')
    modifiers.append('DOT ABOVE')
  # translate the middle dot modifier to dot above
Exemplo n.º 2
0
 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, ())):
     ck = (m[0], dead_keys.dc[k, ()])
     inCompose = composeDeadKeys.has_key(ck)
     if inCompose:
       tag = "L!"
       if composeDeadKeys[ck] != dead_keys.dc[k, mods]:
         print ck
     else:
       tag = ""
     print >> f, "%s%s%s\t%s\t%s" % (comm, tag, deadName, compose.name(dead_keys.dc[k, ()]), compose.name(dead_keys.dc[k, mods]))
   elif m[0] in mods:
     K = (k, tuple(a for a in mods if a != m[0]))
     if dead_keys.dc.has_key(K):
       ck = (m[0], dead_keys.dc[K])
       inCompose = composeDeadKeys.has_key(ck)
       if inCompose:
         tag = "L!"
         if composeDeadKeys[ck] != dead_keys.dc[k, mods]:
           print ck
       else:
         tag = ""
       print >> f, "%s%s%s\t%s\t%s" % (comm, tag, deadName, compose.name(dead_keys.dc[K]), compose.name(dead_keys.dc[k, mods]))
 
 # terminators
 if composeDeadKeys.has_key((m[0], m[0])):
Exemplo n.º 3
0
Arquivo: xkb.py Projeto: raifer/bepora
for k, v in altgr.iteritems():
    tmplValues[k + '_option'] = v
    chars.add(v)

    V = v
    if len(v) == 1:
        V = v.upper()
    tmplValues[k + '_option_capslock'] = V
    chars.add(V)

    V = terminators.get(v, v)
    tmplValues[k + '_option_command'] = V
    chars.add(V)

for k, v in altgrshift.iteritems():
    tmplValues[k + '_shift_option'] = v
    chars.add(v)

    V = v
    if len(v) == 1:
        V = v.lower()
    tmplValues[k + '_shift_option_capslock'] = V
    chars.add(V)

if '' in chars:
    chars.remove('')
actions = set([compose.name(c) for c in chars if c])

tmpl = codecs.open("bepo.tmpl", encoding='utf8').read()
Exemplo n.º 4
0
Arquivo: xkb.py Projeto: haseebq/bepo
  tmplValues[k+'_option'] = v
  chars.add(v)

  V = v
  if len(v) == 1:
    V = v.upper()
  tmplValues[k+'_option_capslock'] = V
  chars.add(V)

  V = terminators.get( v, v )
  tmplValues[k+'_option_command'] = V
  chars.add(V)


for k, v in altgrshift.iteritems():
  tmplValues[k+'_shift_option'] = v
  chars.add(v)

  V = v
  if len(v) == 1:
    V = v.lower()
  tmplValues[k+'_shift_option_capslock'] = V
  chars.add(V)
 
if '' in chars:
  chars.remove('')
actions = set( [compose.name(c) for c in chars if c] )

tmpl = codecs.open("bepo.tmpl", encoding='utf8').read()

Exemplo n.º 5
0
        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, ())):
            ck = (m[0], dead_keys.dc[k, ()])
            inCompose = composeDeadKeys.has_key(ck)
            if inCompose:
                tag = "L!"
                if composeDeadKeys[ck] != dead_keys.dc[k, mods]:
                    print ck
            else:
                tag = ""
            print >> f, "%s%s%s\t%s\t%s" % (
                comm, tag, deadName, compose.name(
                    dead_keys.dc[k, ()]), compose.name(dead_keys.dc[k, mods]))
        elif m[0] in mods:
            K = (k, tuple(a for a in mods if a != m[0]))
            if dead_keys.dc.has_key(K):
                ck = (m[0], dead_keys.dc[K])
                inCompose = composeDeadKeys.has_key(ck)
                if inCompose:
                    tag = "L!"
                    if composeDeadKeys[ck] != dead_keys.dc[k, mods]:
                        print ck
                else:
                    tag = ""
                print >> f, "%s%s%s\t%s\t%s" % (
                    comm, tag, deadName, compose.name(
                        dead_keys.dc[K]), compose.name(dead_keys.dc[k, mods]))
Exemplo n.º 6
0
# the dictionnary which associate the char, case, and modifiers to an unicode
# character
# key: ( ( name, case), (mod1, mod2, ...) )
# value: an unicode char
dc = {}

# the set of modifiers used
dm = set()

# the set of sets of modifiers
dmm = set()

for name, C in unicode_dict.iteritems():
    # to register the name in compose
    compose.name(C)
    # split the name and the modifiers
    ns = name.split(' WITH ')
    n = ns[0]
    ms = ' AND '.join(ns[1:])
    modifiers = ms.split(' AND ')
    # some chars have a WITH to describe something which is not a modifier
    for m in ['SMALL LETTER J', 'SMALL LETTER Z', 'STRIKETHROUGH']:
        if m in modifiers:
            n = n + ' WITH ' + m
            modifiers.remove(m)
    # translate the dotless modifier to dot above.
    if 'DOTLESS' in n:
        n = n.replace('DOTLESS ', '')
        modifiers.append('DOT ABOVE')
    # translate the middle dot modifier to dot above