chiark / gitweb /
624c5179fa02f5b9b07dce38e595263ad4d4dd14
[elogind.git] / src / locale / generate-kbd-model-map
1 #!/usr/bin/python
2
3 import sys
4 import system_config_keyboard.keyboard_models
5
6 def strdash(s):
7         return s.strip() or '-'
8
9 def tab_extend(s, n=1):
10         s = strdash(s)
11         k = len(s) // 8
12
13         if k >= n:
14                 f = 1
15         else:
16                 f = n - k
17
18         return s + '\t'*f
19
20
21 models = system_config_keyboard.keyboard_models.KeyboardModels().get_models()
22
23 print "# Generated from system-config-keyboard's model list"
24 print "# consolelayout\t\txlayout\txmodel\t\txvariant\txoptions"
25
26 for key, value in reversed(models.items()):
27         options = "terminate:ctrl_alt_bksp"
28         if value[4]:
29                 options += ',' + value[4]
30
31         print ''.join((tab_extend(key, 3), tab_extend(value[1]),
32                        tab_extend(value[2], 2), tab_extend(value[3], 2),
33                        options))