summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2019-04-12 19:41:09 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2019-04-12 19:41:09 +0900
commit3a3135b1608652ab8db34d499a6baa52601981cc (patch)
treec1949b69f9e93bd8609c595d99f5727611456169 /engine
parentda71a2e69726815a561f0f8dc6ade572d08a037c (diff)
downloadibus-anthy-3a3135b1608652ab8db34d499a6baa52601981cc.tar.gz
Enable to link anthy-unicode
https://github.com/fujiwarat/anthy-unicode
Diffstat (limited to 'engine')
-rw-r--r--engine/python2/Makefile.am3
-rw-r--r--engine/python2/_config.py.in3
-rw-r--r--engine/python2/engine.py19
-rw-r--r--engine/python3/Makefile.am3
-rw-r--r--engine/python3/_config.py.in3
-rw-r--r--engine/python3/engine.py19
6 files changed, 30 insertions, 20 deletions
diff --git a/engine/python2/Makefile.am b/engine/python2/Makefile.am
index ec9cdd6..3aeef80 100644
--- a/engine/python2/Makefile.am
+++ b/engine/python2/Makefile.am
@@ -3,7 +3,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -99,6 +99,7 @@ _config.py: _config.py.in
sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
-e "s|\@libexecdir\@|$(libexecdir)|g" \
-e "s|\@datadir\@|$(datadir)|g" \
+ -e "s|\@ANTHY_PC\@|$(ANTHY_PC)|g" \
-e "s|\@LAYOUT\@|$(LAYOUT)|g" \
-e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
-e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
diff --git a/engine/python2/_config.py.in b/engine/python2/_config.py.in
index f7eff10..5038572 100644
--- a/engine/python2/_config.py.in
+++ b/engine/python2/_config.py.in
@@ -4,7 +4,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ANTHY_PC= '@ANTHY_PC@'
PKGDATADIR = '@pkgdatadir@'
LIBEXECDIR = '@libexecdir@'
LOCALEDIR = '@datadir@/locale'
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index 733382a..27b9e90 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -4,7 +4,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2018 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -63,6 +63,9 @@ UN = lambda a : unicode(a, 'utf-8')
printerr = AnthyPrefs.printerr
+ANTHY_CONFIG_PATH = get_userhome() + '/.anthy' if config.ANTHY_PC == 'anthy' \
+ else GLib.get_user_config_dir() + '/anthy';
+
INPUT_MODE_HIRAGANA, \
INPUT_MODE_KATAKANA, \
INPUT_MODE_HALF_WIDTH_KATAKANA, \
@@ -190,7 +193,7 @@ class Engine(IBus.EngineSimple):
# http://en.sourceforge.jp/ticket/browse.php?group_id=14&tid=33075
def __verify_anthy_journal_file(self):
- journal = get_userhome() + '/.anthy/last-record2_default.utf8'
+ journal = ANTHY_CONFIG_PATH + '/last-record2_default.utf8'
try:
f = io.open(file=journal, mode='rb')
except IOError:
@@ -203,10 +206,10 @@ class Engine(IBus.EngineSimple):
from gi.repository import Gtk
message= N_("Could not enable Anthy.\n" \
"The end of the content of the file " \
- ".anthy/last-record2_default.utf8 in your home " \
+ "%s/last-record2_default.utf8 in your home " \
"directory is not '\\n'. I.e. not correct text format.\n" \
"Please fix the file or remove it by manual and " \
- "restart IBus.")
+ "restart IBus.") % ANTHY_CONFIG_PATH
printerr(message)
dlg = Gtk.MessageDialog(parent=None,
flags=Gtk.DialogFlags.MODAL,
@@ -2013,10 +2016,10 @@ class Engine(IBus.EngineSimple):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
- directory = get_userhome() + '/.anthy/' + IMPORTED_EMBEDDED_DICT_DIR
+ directory = ANTHY_CONFIG_PATH + '/' + IMPORTED_EMBEDDED_DICT_DIR
name = IMPORTED_EMBEDDED_DICT_PREFIX + id
elif link_mode == LINK_DICT_SINGLE:
- directory = get_userhome() + '/.anthy'
+ directory = ANTHY_CONFIG_PATH
name = IMPORTED_SINGLE_DICT_PREFIX + id
else:
return
@@ -2044,10 +2047,10 @@ class Engine(IBus.EngineSimple):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
- directory = get_userhome() + '/.anthy/' + IMPORTED_EMBEDDED_DICT_DIR
+ directory = ANTHY_CONFIG_PATH + '/' + IMPORTED_EMBEDDED_DICT_DIR
name = IMPORTED_EMBEDDED_DICT_PREFIX + id
elif link_mode == LINK_DICT_SINGLE:
- directory = get_userhome() + '/.anthy'
+ directory = ANTHY_CONFIG_PATH
name = IMPORTED_SINGLE_DICT_PREFIX + id
else:
return
diff --git a/engine/python3/Makefile.am b/engine/python3/Makefile.am
index ec9cdd6..3aeef80 100644
--- a/engine/python3/Makefile.am
+++ b/engine/python3/Makefile.am
@@ -3,7 +3,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -99,6 +99,7 @@ _config.py: _config.py.in
sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
-e "s|\@libexecdir\@|$(libexecdir)|g" \
-e "s|\@datadir\@|$(datadir)|g" \
+ -e "s|\@ANTHY_PC\@|$(ANTHY_PC)|g" \
-e "s|\@LAYOUT\@|$(LAYOUT)|g" \
-e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
-e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
diff --git a/engine/python3/_config.py.in b/engine/python3/_config.py.in
index a27f082..a751103 100644
--- a/engine/python3/_config.py.in
+++ b/engine/python3/_config.py.in
@@ -4,7 +4,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ANTHY_PC= '@ANTHY_PC@'
PKGDATADIR = '@pkgdatadir@'
LIBEXECDIR = '@libexecdir@'
LOCALEDIR = '@datadir@/locale'
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index 1779e3f..6041860 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -4,7 +4,7 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2018 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -64,6 +64,9 @@ UN = lambda a : unicode(a, 'utf-8')
printerr = AnthyPrefs.printerr
+ANTHY_CONFIG_PATH = get_userhome() + '/.anthy' if config.ANTHY_PC == 'anthy' \
+ else GLib.get_user_config_dir() + '/anthy';
+
INPUT_MODE_HIRAGANA, \
INPUT_MODE_KATAKANA, \
INPUT_MODE_HALF_WIDTH_KATAKANA, \
@@ -191,7 +194,7 @@ class Engine(IBus.EngineSimple):
# http://en.sourceforge.jp/ticket/browse.php?group_id=14&tid=33075
def __verify_anthy_journal_file(self):
- journal = get_userhome() + '/.anthy/last-record2_default.utf8'
+ journal = ANTHY_CONFIG_PATH + '/last-record2_default.utf8'
try:
f = io.open(file=journal, mode='rb')
except IOError:
@@ -204,10 +207,10 @@ class Engine(IBus.EngineSimple):
from gi.repository import Gtk
message= N_("Could not enable Anthy.\n" \
"The end of the content of the file " \
- ".anthy/last-record2_default.utf8 in your home " \
+ "%s/last-record2_default.utf8 in your home " \
"directory is not '\\n'. I.e. not correct text format.\n" \
"Please fix the file or remove it by manual and " \
- "restart IBus.")
+ "restart IBus.") % ANTHY_CONFIG_PATH
printerr(message)
dlg = Gtk.MessageDialog(parent=None,
flags=Gtk.DialogFlags.MODAL,
@@ -2007,10 +2010,10 @@ class Engine(IBus.EngineSimple):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
- directory = get_userhome() + '/.anthy/' + IMPORTED_EMBEDDED_DICT_DIR
+ directory = ANTHY_CONFIG_PATH + '/' + IMPORTED_EMBEDDED_DICT_DIR
name = IMPORTED_EMBEDDED_DICT_PREFIX + id
elif link_mode == LINK_DICT_SINGLE:
- directory = get_userhome() + '/.anthy'
+ directory = ANTHY_CONFIG_PATH
name = IMPORTED_SINGLE_DICT_PREFIX + id
else:
return
@@ -2038,10 +2041,10 @@ class Engine(IBus.EngineSimple):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
- directory = get_userhome() + '/.anthy/' + IMPORTED_EMBEDDED_DICT_DIR
+ directory = ANTHY_CONFIG_PATH + '/' + IMPORTED_EMBEDDED_DICT_DIR
name = IMPORTED_EMBEDDED_DICT_PREFIX + id
elif link_mode == LINK_DICT_SINGLE:
- directory = get_userhome() + '/.anthy'
+ directory = ANTHY_CONFIG_PATH
name = IMPORTED_SINGLE_DICT_PREFIX + id
else:
return