5 # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
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.
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.
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
22 from ibus
import interface
25 FACTORY_PATH
= "/com/redhat/IBus/engines/Demo/Factory"
26 ENGINE_PATH
= "/com/redhat/IBus/engines/Demo/Engine/%d"
28 class DemoEngineFactory (interface
.IEngineFactory
):
32 AUTHORS
= "Huang Peng <shawn.p.huang@gmail.com>"
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
49 def CreateEngine (self
):
50 engine_path
= ENGINE_PATH
% self
._max
_engine
_id
51 self
._max
_engine
_id
+= 1
52 return engine
.DemoEngine (self
._dbusconn
, engine_path
)