summaryrefslogtreecommitdiff
path: root/caribou/antler/main.py
blob: 24b842a478869b0b84513bb8655245935cd99c8c (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
28
29
30
31
32
33
34
from gi.repository import Caribou, GObject
from window import AntlerWindowEntry
from keyboard_view import AntlerKeyboardView
import sys

class AntlerKeyboardService(Caribou.KeyboardService):
    def __init__(self):
        GObject.GObject.__init__(self)
        self.register_keyboard("Antler")
        self.window = AntlerWindowEntry(AntlerKeyboardView)

    def run(self):
        loop = GObject.MainLoop()
        loop.run()

    def do_show(self, timestamp):
        self.window.show_all()

    def do_hide(self, timestamp):
        self.window.hide()

    def do_set_cursor_location (self, x, y, w, h):
        self.window.set_cursor_location(x, y, w, h)

    def do_set_entry_location (self, x, y, w, h):
        self.window.set_entry_location(x, y, w, h)

    def do_name_lost (self, name):
        sys.stderr.write("Another service acquired %s, quitting..\n" % name)
        sys.exit(0)

if __name__ == "__main__":
    antler_keyboard_service = AntlerKeyboardService()
    antler_keyboard_service.run()