From 7b47c05b0b9cae55eb818a765dcd3aaee57d16e8 Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Sun, 17 Aug 2008 22:15:56 +0800 Subject: [PATCH] Add lookup table orientation configure item. --- setup/Makefile.am | 6 ++- setup/ibus-setup.in | 2 +- setup/main.py | 27 +++++++--- setup/setup.glade | 121 ++++++++++++++++++++++++++++++++++++++------ 4 files changed, 133 insertions(+), 23 deletions(-) diff --git a/setup/Makefile.am b/setup/Makefile.am index b8d54a6e..2c4946ea 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -46,4 +46,8 @@ EXTRA_DIST = \ $(NULL) test: - $(ENV) PYTHONPATH=$(top_srcdir) $(PYTHON) $(srcdir)/main.py + $(ENV) \ + PYTHONPATH=$(top_srcdir) \ + IBUS_PREFIX="/usr" \ + $(PYTHON) \ + $(srcdir)/main.py diff --git a/setup/ibus-setup.in b/setup/ibus-setup.in index d08e8b6d..1c05adb3 100644 --- a/setup/ibus-setup.in +++ b/setup/ibus-setup.in @@ -22,6 +22,6 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ export IBUS_PREFIX=@prefix@ -export IBUS_LIBEXECDIR=@libexecdir@ +export IBUS_DATAROOTDIR=@datarootdir@ exec python @prefix@/share/ibus/setup/main.py $@ diff --git a/setup/main.py b/setup/main.py index 5afa09ef..153de69d 100644 --- a/setup/main.py +++ b/setup/main.py @@ -54,6 +54,7 @@ N_ = lambda a : a ) = range(8) CONFIG_PRELOAD_ENGINES = "/general/preload_engines" +CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION = "/panel/lookup_table_orientation" class Setup(object): def __flush_gtk_events(self): @@ -107,15 +108,26 @@ class Setup(object): self.__dialog = self.__xml.get_widget("dialog_setup") + + # auto start ibus self.__checkbutton_auto_start = self.__xml.get_widget("checkbutton_auto_start") self.__checkbutton_auto_start.set_active(self.__is_auto_start()) self.__checkbutton_auto_start.connect("toggled", self.__checkbutton_auto_start_toggled_cb) + + # lookup table orientation + self.__combobox_lookup_table_orientation = self.__xml.get_widget("combobox_lookup_table_orientation") + self.__combobox_lookup_table_orientation.set_active( + self.__bus.config_get_value(CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION, 0)) + self.__combobox_lookup_table_orientation.connect("changed", + self.__combobox_lookup_table_orientation_changed_cb) + + # engines tree self.__tree = self.__xml.get_widget("treeview_engines") self.__preload_engines = set(self.__bus.config_get_value(CONFIG_PRELOAD_ENGINES, [])) model = self.__create_model() self.__tree.set_model(model) - # column for holiday names + # column for engine column = gtk.TreeViewColumn() column.set_title(_("Engine")) @@ -134,7 +146,7 @@ class Setup(object): self.__tree.append_column(column) - # column for started names + # column for started renderer = gtk.CellRendererToggle() renderer.set_data('column', COLUMN_ENABLE) renderer.set_property("xalign", 0.5) @@ -144,7 +156,7 @@ class Setup(object): column = gtk.TreeViewColumn(_("Started"), renderer, active = COLUMN_ENABLE, visible = COLUMN_VISIBLE) self.__tree.append_column(column) - # column for preload names + # column for preload renderer = gtk.CellRendererToggle() renderer.set_data('column', COLUMN_PRELOAD) renderer.set_property("xalign", 0.5) @@ -153,13 +165,11 @@ class Setup(object): column = gtk.TreeViewColumn(_("Preload"), renderer, active = COLUMN_PRELOAD, visible = COLUMN_VISIBLE) self.__tree.append_column(column) - renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("", renderer) self.__tree.append_column(column) - def __item_started_column_toggled_cb(self, cell, path_str, model): # get toggled iter @@ -290,7 +300,7 @@ class Setup(object): def __is_auto_start(self): link_file = path.join(BaseDirectory.xdg_config_home, "autostart/ibus.desktop") - ibus_desktop = path.join(os.getenv("IBUS_LIBEXECDIR"), "share/applications/ibus.desktop") + ibus_desktop = path.join(os.getenv("IBUS_PREFIX"), "share/applications/ibus.desktop") if not path.exists(link_file): return False @@ -311,6 +321,11 @@ class Setup(object): if self.__checkbutton_auto_start.get_active(): os.symlink(ibus_desktop, link_file) + def __combobox_lookup_table_orientation_changed_cb(self, combobox): + self.__bus.config_set_value( + CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION, + self.__combobox_lookup_table_orientation.get_active()) + def run(self): return self.__dialog.run() diff --git a/setup/setup.glade b/setup/setup.glade index ef05f3d6..fe5feb20 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -1,6 +1,6 @@ - + 5 @@ -51,6 +51,94 @@ False + + + True + 9 + 2 + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + 0 + Horizontal +Vertical + + + 1 + 2 + + + + + True + Lookup table orientation + + + + + 1 + + + + + True + Panel + + + tab + 1 + False + + True @@ -70,10 +158,13 @@ + + 2 + - 1 + 2 @@ -83,25 +174,25 @@ tab - 1 + 2 False - + True - - - - - - - - - + IBus + +Homepage: http://code.google.com/p/ibus +Author: Huang Peng <shawn.p.huang@gmail.com> + + + + + GTK_JUSTIFY_CENTER - 2 + 3 @@ -111,7 +202,7 @@ tab - 2 + 3 False -- 2.34.1