summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-02-17 13:39:57 +0800
committerPeng Wu <alexepico@gmail.com>2013-02-17 13:39:57 +0800
commit9f63583210bb383ab97c803fd57ede8c6d866bf0 (patch)
tree523ba51e2dc771a4eecfd4871096fe5d2ff11a74
parent7ada59965b475434c5a5e6f62d13cabfde278fc8 (diff)
downloadibus-libpinyin-9f63583210bb383ab97c803fd57ede8c6d866bf0.tar.gz
ibus-libpinyin-9f63583210bb383ab97c803fd57ede8c6d866bf0.tar.xz
ibus-libpinyin-9f63583210bb383ab97c803fd57ede8c6d866bf0.zip
add edit user lua to main2.py
-rw-r--r--setup/main2.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/setup/main2.py b/setup/main2.py
index b9173fc..24c210a 100644
--- a/setup/main2.py
+++ b/setup/main2.py
@@ -363,6 +363,9 @@ class PreferencesDialog:
if not os.access(path, os.R_OK):
self.__frame_lua_script.hide()
+ self.__edit_lua = self.__builder.get_object("EditLua")
+ self.__edit_lua.connect("clicked", self.__edit_lua_cb)
+
self.__import_dictionary = self.__builder.get_object("ImportDictionary")
self.__import_dictionary.connect("clicked", self.__import_dictionary_cb)
@@ -371,6 +374,16 @@ class PreferencesDialog:
self.__clear_all_data = self.__builder.get_object("ClearAllData")
self.__clear_all_data.connect("clicked", self.__clear_user_data_cb, "all")
+ def __edit_lua_cb(self, widget):
+ import shutil
+ path = os.path.join(BaseDirectory.xdg_config_home, "ibus", "libpinyin")
+ os.path.exists(path) or os.makedirs(path)
+ path = os.path.join(path, "user.lua")
+ if not os.path.exists(path):
+ src = os.path.join(config.get_data_dir(), "user.lua")
+ shutil.copyfile(src, path)
+ os.system("xdg-open %s" % path)
+
def __import_dictionary_cb(self, widget):
dialog = Gtk.FileChooserDialog \
(_("Please choose a file"), None,