From feef446a21ea0e701de13d301dbe64877a91e79c Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Thu, 21 Aug 2008 07:19:36 +0800 Subject: [PATCH] WIP. --- setup/main.py | 50 ++++--- setup/setup.glade | 433 ++++++++++++++++++++++++++---------------------------- 2 files changed, 241 insertions(+), 242 deletions(-) diff --git a/setup/main.py b/setup/main.py index 12e358f..9e7f4e2 100644 --- a/setup/main.py +++ b/setup/main.py @@ -67,6 +67,34 @@ class Setup(object): glade_file = path.join(path.dirname(__file__), "./setup.glade") self.__xml = glade.XML(glade_file) self.__bus = None + self.__init_bus() + self.__init_ui() + + def __init_ui(self): + # add icon search path + icon_theme = gtk.icon_theme_get_default() + dir = path.dirname(__file__) + icondir = path.join(dir, "..", "icons") + icon_theme.prepend_search_path(icondir) + + + 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) + + self.__init_engine_view() + + def __init_bus(self): try: self.__bus = ibus.Bus() self.__bus.connect("config-value-changed", self.__config_value_changed_cb) @@ -104,27 +132,7 @@ class Setup(object): dlg.destroy() self.__flush_gtk_events() - # add icon search path - icon_theme = gtk.icon_theme_get_default() - dir = path.dirname(__file__) - icondir = path.join(dir, "..", "icons") - icon_theme.prepend_search_path(icondir) - - - 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) - + def __init_engine_view(self): # engines tree self.__tree = self.__xml.get_widget("treeview_engines") self.__preload_engines = set(self.__bus.config_get_value(CONFIG_PRELOAD_ENGINES, [])) diff --git a/setup/setup.glade b/setup/setup.glade index cf18acb..1744a5d 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -1,6 +1,6 @@ - + 5 @@ -31,161 +31,240 @@ False False + 4 - + True - 3 - 3 + 0 + GTK_SHADOW_IN - + True - True - True - ... - 0 - - - 2 - 3 - 2 - 3 - GTK_FILL - GTK_FILL - 4 - 4 - - - - - True - True - True - ... - 0 - - - 2 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - 4 - 4 - - - - - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - 4 - 4 - - - - - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - 4 - 4 - - - - - True - True - True - ... - 0 - - - 2 - 3 - GTK_FILL - GTK_FILL - 4 - 4 - - - - - True - 1 - Previous engine: - GTK_JUSTIFY_RIGHT + 12 + + + True + 3 + 3 + + + True + 1 + Trigger: + GTK_JUSTIFY_RIGHT + + + GTK_FILL + GTK_FILL + 4 + 4 + + + + + True + True + + + 1 + 2 + GTK_FILL + 4 + 4 + + + + + True + 1 + Next engine: + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL + GTK_FILL + 4 + 4 + + + + + True + 1 + Previous engine: + GTK_JUSTIFY_RIGHT + + + 2 + 3 + GTK_FILL + GTK_FILL + 4 + 4 + + + + + True + True + True + ... + 0 + + + 2 + 3 + GTK_FILL + GTK_FILL + 4 + 4 + + + + + True + True + + + 1 + 2 + 1 + 2 + GTK_FILL + 4 + 4 + + + + + True + True + + + 1 + 2 + 2 + 3 + GTK_FILL + 4 + 4 + + + + + True + True + True + ... + 0 + + + 2 + 3 + 1 + 2 + GTK_FILL + GTK_FILL + 4 + 4 + + + + + True + True + True + ... + 0 + + + 2 + 3 + 2 + 3 + GTK_FILL + GTK_FILL + 4 + 4 + + + + - - 2 - 3 - GTK_FILL - GTK_FILL - 4 - 4 - - + True - 1 - Next engine: - GTK_JUSTIFY_RIGHT + Keyboard shortcuts + True - 1 - 2 - GTK_FILL - GTK_FILL - 4 - 4 + label_item + + + False + 1 + + + + + True + 0 + GTK_SHADOW_IN - + True - True + 12 + + + True + + + True + 1 + Lookup table orientation: + GTK_JUSTIFY_RIGHT + + + False + 4 + + + + + True + 0 + Horizontal +Vertical + + + 1 + + + + - - 1 - 2 - GTK_FILL - 4 - 4 - - + True - 1 - Trigger: - GTK_JUSTIFY_RIGHT + Panel + True - GTK_FILL - GTK_FILL - 4 - 4 + label_item False - 1 + 2 @@ -204,94 +283,6 @@ - - True - 9 - 2 - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - Lookup table orientation - - - - - True - 0 - Horizontal -Vertical - - - 1 - 2 - - - - - 1 - - - - - True - Panel - - - tab - 1 - False - - - True @@ -316,7 +307,7 @@ Vertical - 2 + 1 @@ -326,7 +317,7 @@ Vertical tab - 2 + 1 False @@ -344,7 +335,7 @@ Author: Huang Peng <shawn.p.huang@gmail.com> GTK_JUSTIFY_CENTER - 3 + 2 @@ -354,7 +345,7 @@ Author: Huang Peng <shawn.p.huang@gmail.com> tab - 3 + 2 False -- 2.7.4