From b512009d51575fa189ef46eaf21b36ea951d492a Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Sun, 24 Aug 2008 08:54:42 +0800 Subject: Add custom_font and auto_hide configure items. --- setup/main.py | 42 +++++++++++++ setup/setup.glade | 181 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 154 insertions(+), 69 deletions(-) (limited to 'setup') diff --git a/setup/main.py b/setup/main.py index b4eeb74..b7bead3 100644 --- a/setup/main.py +++ b/setup/main.py @@ -58,6 +58,9 @@ N_ = lambda a : a CONFIG_GENERAL_SHORTCUT = "/general/keyboard_shortcut_%s" CONFIG_PRELOAD_ENGINES = "/general/preload_engines" CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION = "/panel/lookup_table_orientation" +CONFIG_PANEL_AUTO_HIDE = "/panel/auto_hide" +CONFIG_PANEL_USE_CUSTOM_FONT = "/panel/use_custom_font" +CONFIG_PANEL_CUSTOM_FONT = "/panel/custom_font" class Setup(object): def __flush_gtk_events(self): @@ -103,6 +106,28 @@ class Setup(object): self.__combobox_lookup_table_orientation.connect("changed", self.__combobox_lookup_table_orientation_changed_cb) + # auto hide + self.__checkbutton_auto_hide = self.__xml.get_widget("checkbutton_auto_hide") + self.__checkbutton_auto_hide.set_active( + self.__bus.config_get_value(CONFIG_PANEL_AUTO_HIDE, False)) + self.__checkbutton_auto_hide.connect("toggled", self.__checkbutton_auto_hide_toggled_cb) + + # custom font + self.__checkbutton_custom_font = self.__xml.get_widget("checkbutton_custom_font") + self.__checkbutton_custom_font.set_active( + self.__bus.config_get_value(CONFIG_PANEL_USE_CUSTOM_FONT, False)) + self.__checkbutton_custom_font.connect("toggled", self.__checkbutton_custom_font_toggled_cb) + + self.__fontbutton_custom_font = self.__xml.get_widget("fontbutton_custom_font") + if self.__bus.config_get_value(CONFIG_PANEL_USE_CUSTOM_FONT, False): + self.__fontbutton_custom_font.set_sensitive(True) + else: + self.__fontbutton_custom_font.set_sensitive(False) + font_name = gtk.settings_get_default().get_property("gtk-font-name") + font_name = self.__bus.config_get_value(CONFIG_PANEL_CUSTOM_FONT, font_name) + self.__fontbutton_custom_font.connect("notify::font-name", self.__fontbutton_custom_font_notify_cb) + self.__fontbutton_custom_font.set_font_name(font_name) + self.__init_engine_view() def __init_bus(self): @@ -371,6 +396,23 @@ class Setup(object): CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION, self.__combobox_lookup_table_orientation.get_active()) + def __checkbutton_auto_hide_toggled_cb(self, button): + self.__bus.config_set_value( + CONFIG_PANEL_AUTO_HIDE, + self.__checkbutton_auto_hide.get_active()) + + def __checkbutton_custom_font_toggled_cb(self, button): + if self.__checkbutton_custom_font.get_active(): + self.__fontbutton_custom_font.set_sensitive(True) + self.__bus.config_set_value(CONFIG_PANEL_USE_CUSTOM_FONT, True) + else: + self.__fontbutton_custom_font.set_sensitive(False) + self.__bus.config_set_value(CONFIG_PANEL_USE_CUSTOM_FONT, False) + + def __fontbutton_custom_font_notify_cb(self, button, arg): + font_name = self.__fontbutton_custom_font.get_font_name() + self.__bus.config_set_value(CONFIG_PANEL_CUSTOM_FONT, font_name) + def __config_value_changed_cb(self, bus, key, value): if key == CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION: item = self.__bus.config_get_value(CONFIG_PANEL_LOOKUP_TABLE_ORIENTATION, 0) diff --git a/setup/setup.glade b/setup/setup.glade index 25e2c6b..96f8d6a 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -1,6 +1,6 @@ - + 5 @@ -44,19 +44,26 @@ True 12 + 4 True 3 3 - + True - 1 - Trigger: - GTK_JUSTIFY_RIGHT + False + True + True + ... + 0 + 2 + 3 + 2 + 3 GTK_FILL GTK_FILL 4 @@ -64,46 +71,51 @@ - + True True - False + True + ... + 0 - 1 - 2 + 2 + 3 + 1 + 2 + GTK_FILL GTK_FILL 4 4 - + True - 1 - Next engine: - GTK_JUSTIFY_RIGHT + True + False - 1 - 2 - GTK_FILL + 1 + 2 + 2 + 3 GTK_FILL 4 4 - + True - 1 - Previous engine: - GTK_JUSTIFY_RIGHT + True + False - 2 - 3 - GTK_FILL + 1 + 2 + 1 + 2 GTK_FILL 4 4 @@ -127,70 +139,59 @@ - + True - True - False + 1 + Previous engine: + GTK_JUSTIFY_RIGHT - 1 - 2 - 1 - 2 + 2 + 3 + GTK_FILL GTK_FILL 4 4 - + True - True - False + 1 + Next engine: + GTK_JUSTIFY_RIGHT - 1 - 2 - 2 - 3 + 1 + 2 + GTK_FILL GTK_FILL 4 4 - + True True - True - ... - 0 + False - 2 - 3 - 1 - 2 - GTK_FILL + 1 + 2 GTK_FILL 4 4 - + True - False - True - True - ... - 0 + 1 + Trigger: + GTK_JUSTIFY_RIGHT - 2 - 3 - 2 - 3 GTK_FILL GTK_FILL 4 @@ -226,30 +227,72 @@ True 12 + 4 - + True + 2 - + True - 1 - Lookup table orientation: - GTK_JUSTIFY_RIGHT + + + True + 1 + Lookup table orientation: + GTK_JUSTIFY_RIGHT + + + False + 4 + + + + + True + 0 + Horizontal +Vertical + + + 1 + + + + + + + True + True + Auto hide language bar + 0 + True - False - 4 + 1 - + True - 0 - Horizontal -Vertical + True + Use custom font + 0 + True - 1 + 2 + + + + + True + True + True + 0 + + + 3 @@ -259,7 +302,7 @@ Vertical True - Panel + UI True -- cgit