~ubuntu-branches/ubuntu/trusty/ibus-cangjie/trusty

« back to all changes in this revision

Viewing changes to scripts/ibus-engine-cangjie.in

  • Committer: Package Import Robot
  • Author(s): Anthony Wong
  • Date: 2013-03-14 02:55:52 UTC
  • Revision ID: package-import@ubuntu.com-20130314025552-u537ju4e2ommsegf
Tags: upstream-0.0.1~git20130325
ImportĀ upstreamĀ versionĀ 0.0.1~git20130325

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@PYTHON_PATH@
 
2
#
 
3
# Copyright (c) 2012 - The IBus Cangjie authors
 
4
#
 
5
# This file is part of ibus-cangjie, the IBus Cangjie input method engine.
 
6
#
 
7
# ibus-cangjie is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU Lesser General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# ibus-cangjie 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 General Public License
 
18
# along with ibus-cangjie.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
import argparse
 
21
import locale
 
22
import os
 
23
import sys
 
24
 
 
25
from gi.repository import IBus
 
26
 
 
27
from ibus_cangjie import IMApp
 
28
 
 
29
 
 
30
componentdir = "@COMPONENTDIR@"
 
31
 
 
32
try:
 
33
    locale.setlocale(locale.LC_ALL, "")
 
34
except:
 
35
    pass
 
36
 
 
37
parser = argparse.ArgumentParser(description="Cangjie input method engine")
 
38
parser.add_argument("--ibus", "-i", action="store_true",
 
39
                    help="let the engine know it is executed by IBus")
 
40
parser.add_argument("--daemonize", "-d", action="store_true",
 
41
                    help="daemonize the engine")
 
42
parser.add_argument("engine", choices=("cangjie", "quick"),
 
43
                    help="Input method engine to use")
 
44
args = parser.parse_args()
 
45
 
 
46
if args.daemonize:
 
47
    if os.fork():
 
48
        sys.exit()
 
49
 
 
50
IBus.init()
 
51
IMApp(args.ibus, args.engine, componentdir).run()