/[rdesktop]/sourceforge.net/trunk/rdpproxy/keymap.py
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /sourceforge.net/trunk/rdpproxy/keymap.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 430 - (hide annotations)
Mon Jun 30 08:59:07 2003 UTC (21 years ago) by forsberg
File MIME type: text/x-python
File size: 1252 byte(s)
This commit was generated by cvs2svn to compensate for changes in r428,
which included commits to RCS files with non-trunk default branches.

1 forsberg 429 #!/usr/bin/python
2    
3     import os
4     import string
5     import re
6    
7     class keymap:
8     mapfind = re.compile("([a-zA-Z0-9])*? 0x([0-9a-z]{1,2})(.*)")
9    
10     def read_keymap(self, path, name):
11     keys = {}
12     km = open(os.path.join(path, name), 'r')
13     for line in km.xreadlines():
14     if '#' == line[0] or '\n' == line[0]:
15     continue
16    
17     line = line.strip()
18    
19     if "include " == line[:8]:
20     keys.update(self.read_keymap(path, line[8:].strip()))
21     continue
22     elif "map " == line[:4]:
23     self.map = string.atol(line[4:], 16)
24     continue
25    
26     elif "enable_compose" == line[:15]:
27     self.enable_compose = 1
28     continue
29     else:
30     mo = self.mapfind.search(line)
31     (key, code, rest) = mo.groups()
32    
33     keys[string.atoi(code, 16)] = "%s / %s" % (key, rest)
34    
35     return keys
36    
37    
38     def __init__(self, path, name="common"):
39     self.path = path
40     self.name = name
41     self.map = 0x407
42     self.enable_compose = 0
43     self.keys = self.read_keymap(path, name)
44    
45     def __getitem__(self, key):
46     return self.keys.get(key, "Unknown")

  ViewVC Help
Powered by ViewVC 1.1.26