diff options
| author | Huang Peng <shawn.p.huang@gmail.com> | 2008-08-24 08:54:42 +0800 |
|---|---|---|
| committer | Huang Peng <shawn.p.huang@gmail.com> | 2008-08-24 08:54:42 +0800 |
| commit | b512009d51575fa189ef46eaf21b36ea951d492a (patch) | |
| tree | 30386b6bbcb04dd52239c2e7ea367afedbc27d5a /setup | |
| parent | ce853e02294d8d432187c2e989e165fe043e1818 (diff) | |
| download | ibus-b512009d51575fa189ef46eaf21b36ea951d492a.tar.gz ibus-b512009d51575fa189ef46eaf21b36ea951d492a.tar.xz ibus-b512009d51575fa189ef46eaf21b36ea951d492a.zip | |
Add custom_font and auto_hide configure items.
Diffstat (limited to 'setup')
| -rw-r--r-- | setup/main.py | 42 | ||||
| -rw-r--r-- | setup/setup.glade | 181 |
2 files changed, 154 insertions, 69 deletions
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 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.4 on Fri Aug 22 11:28:43 2008 --> +<!--Generated with glade3 3.4.4 on Sun Aug 24 08:30:51 2008 --> <glade-interface> <widget class="GtkDialog" id="dialog_setup"> <property name="border_width">5</property> @@ -44,19 +44,26 @@ <widget class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="left_padding">12</property> + <property name="right_padding">4</property> <child> <widget class="GtkTable" id="table3"> <property name="visible">True</property> <property name="n_rows">3</property> <property name="n_columns">3</property> <child> - <widget class="GtkLabel" id="label7"> + <widget class="GtkButton" id="button_prev_engine"> <property name="visible">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Trigger:</property> - <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="label" translatable="yes">...</property> + <property name="response_id">0</property> </widget> <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> @@ -64,46 +71,51 @@ </packing> </child> <child> - <widget class="GtkEntry" id="entry_trigger"> + <widget class="GtkButton" id="button_next_engine"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="editable">False</property> + <property name="receives_default">True</property> + <property name="label" translatable="yes">...</property> + <property name="response_id">0</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> </packing> </child> <child> - <widget class="GtkLabel" id="label8"> + <widget class="GtkEntry" id="entry_prev_engine"> <property name="visible">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Next engine:</property> - <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="can_focus">True</property> + <property name="editable">False</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> </packing> </child> <child> - <widget class="GtkLabel" id="label9"> + <widget class="GtkEntry" id="entry_next_engine"> <property name="visible">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Previous engine:</property> - <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="can_focus">True</property> + <property name="editable">False</property> </widget> <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> @@ -127,70 +139,59 @@ </packing> </child> <child> - <widget class="GtkEntry" id="entry_next_engine"> + <widget class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Previous engine:</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> </packing> </child> <child> - <widget class="GtkEntry" id="entry_prev_engine"> + <widget class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Next engine:</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> </packing> </child> <child> - <widget class="GtkButton" id="button_next_engine"> + <widget class="GtkEntry" id="entry_trigger"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="label" translatable="yes">...</property> - <property name="response_id">0</property> + <property name="editable">False</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> <property name="y_padding">4</property> </packing> </child> <child> - <widget class="GtkButton" id="button_prev_engine"> + <widget class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="label" translatable="yes">...</property> - <property name="response_id">0</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Trigger:</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="x_padding">4</property> @@ -226,30 +227,72 @@ <widget class="GtkAlignment" id="alignment2"> <property name="visible">True</property> <property name="left_padding">12</property> + <property name="right_padding">4</property> <child> - <widget class="GtkHBox" id="hbox1"> + <widget class="GtkVBox" id="vbox3"> <property name="visible">True</property> + <property name="spacing">2</property> <child> - <widget class="GtkLabel" id="label6"> + <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Lookup table orientation:</property> - <property name="justify">GTK_JUSTIFY_RIGHT</property> + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Lookup table orientation:</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="padding">4</property> + </packing> + </child> + <child> + <widget class="GtkComboBox" id="combobox_lookup_table_orientation"> + <property name="visible">True</property> + <property name="active">0</property> + <property name="items" translatable="yes">Horizontal +Vertical</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + <child> + <widget class="GtkCheckButton" id="checkbutton_auto_hide"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Auto hide language bar</property> + <property name="response_id">0</property> + <property name="draw_indicator">True</property> </widget> <packing> - <property name="expand">False</property> - <property name="padding">4</property> + <property name="position">1</property> </packing> </child> <child> - <widget class="GtkComboBox" id="combobox_lookup_table_orientation"> + <widget class="GtkCheckButton" id="checkbutton_custom_font"> <property name="visible">True</property> - <property name="active">0</property> - <property name="items" translatable="yes">Horizontal -Vertical</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Use custom font</property> + <property name="response_id">0</property> + <property name="draw_indicator">True</property> </widget> <packing> - <property name="position">1</property> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkFontButton" id="fontbutton_custom_font"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="response_id">0</property> + </widget> + <packing> + <property name="position">3</property> </packing> </child> </widget> @@ -259,7 +302,7 @@ Vertical</property> <child> <widget class="GtkLabel" id="label11"> <property name="visible">True</property> - <property name="label" translatable="yes">Panel</property> + <property name="label" translatable="yes">UI</property> <property name="use_markup">True</property> </widget> <packing> |
