diff options
Diffstat (limited to 'engine/python3')
-rw-r--r-- | engine/python3/Makefile.am | 3 | ||||
-rw-r--r-- | engine/python3/_config.py.in | 3 | ||||
-rw-r--r-- | engine/python3/engine.py | 19 |
3 files changed, 15 insertions, 10 deletions
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 |