ca89fc59d783a6ac3268e1fc72eef5b5efe315d2
[platform/upstream/ibus.git] / engine / anthy / factory.py
1 # vim:set noet ts=4:
2 #
3 # ibus - The Input Bus
4 #
5 # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 # Boston, MA  02111-1307  USA
21
22 from ibus import interface
23 import engine
24
25 FACTORY_PATH = "/com/redhat/IBus/engines/Anthy/Factory"
26 ENGINE_PATH = "/com/redhat/IBus/engines/Anthy/Engine/%d"
27
28 class DemoEngineFactory (interface.IEngineFactory):
29         NAME = "Anthy"
30         LANG = "ja"
31         ICON = "ibus-anthy"
32         AUTHORS = "Huang Peng <shawn.p.huang@gmail.com>"
33         CREDITS = "GPLv2"
34
35         def __init__ (self, dbusconn):
36                 interface.IEngineFactory.__init__ (self, dbusconn, object_path = FACTORY_PATH)
37                 self._dbusconn = dbusconn
38                 self._max_engine_id = 1
39         
40         def GetInfo (self):
41                 return [
42                         self.NAME,
43                         self.LANG,
44                         self.ICON,
45                         self.AUTHORS,
46                         self.CREDITS
47                         ]
48
49         def CreateEngine (self):
50                 engine_path = ENGINE_PATH % self._max_engine_id
51                 self._max_engine_id += 1
52                 return engine.Engine (self._dbusconn, engine_path)
53
54