summaryrefslogtreecommitdiffstats
path: root/xkb.py
blob: b70c09517b4a678c20117051999bfb36c04c5940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import _xkb
import tree
import string

class XKB:
    def __init__ (self):
        self.rules = _xkb.list_rules ()

    def getRules (self):
        return self.rules

    def getModels (self):
        return self.rules[0]

    def getLayouts (self):
        return self.rules[1]

    def getVariants (self):
        return self.rules[2]

    def getOptions (self):
        keys = self.rules[3].keys (); keys.sort ()
        groups = ()
        for x in keys:
            groups = tree.merge (groups, string.split (x, ":"))
        return (groups, self.rules[3])