diff options
author | Huang Peng <shawn.p.huang@gmail.com> | 2009-02-05 10:39:56 +0800 |
---|---|---|
committer | Huang Peng <shawn.p.huang@gmail.com> | 2009-02-05 10:39:56 +0800 |
commit | aedad1ea0a7fef604aa27f4b58433fd8f2ece29e (patch) | |
tree | ffcb531d8474bde18b90341bcd4eb639edd74525 /ui | |
parent | 41ad46305a88637dd99f00a2d2a3f455505d357b (diff) | |
download | ibus-aedad1ea0a7fef604aa27f4b58433fd8f2ece29e.tar.gz ibus-aedad1ea0a7fef604aa27f4b58433fd8f2ece29e.tar.xz ibus-aedad1ea0a7fef604aa27f4b58433fd8f2ece29e.zip |
re-implement ibus in c language.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/.gitignore | 1 | ||||
-rw-r--r-- | ui/gtk/Makefile.am | 12 | ||||
-rw-r--r-- | ui/gtk/candidatepanel.py | 47 | ||||
-rw-r--r-- | ui/gtk/gtkpanel.xml.in | 12 | ||||
-rw-r--r-- | ui/gtk/icon.py | 3 | ||||
-rw-r--r-- | ui/gtk/languagebar.py | 4 | ||||
-rw-r--r-- | ui/gtk/main.py | 11 | ||||
-rw-r--r-- | ui/gtk/menu.py | 8 | ||||
-rw-r--r-- | ui/gtk/notifications.py | 14 | ||||
-rw-r--r-- | ui/gtk/panel.py | 116 | ||||
-rw-r--r-- | ui/gtk/propitem.py | 2 | ||||
-rw-r--r-- | ui/gtk/toolitem.py | 14 |
12 files changed, 131 insertions, 113 deletions
diff --git a/ui/gtk/.gitignore b/ui/gtk/.gitignore index 17bbd09..abac3c8 100644 --- a/ui/gtk/.gitignore +++ b/ui/gtk/.gitignore @@ -1 +1,2 @@ ibus-ui-gtk +gtkpanel.xml diff --git a/ui/gtk/Makefile.am b/ui/gtk/Makefile.am index 18f773e..e80cf96 100644 --- a/ui/gtk/Makefile.am +++ b/ui/gtk/Makefile.am @@ -31,10 +31,16 @@ ui_gtk_PYTHON = \ propitem.py \ toolitem.py \ $(NULL) - ui_gtkdir = $(pkgdatadir)/ui/gtk -bin_SCRIPTS = ibus-ui-gtk +libexec_SCRIPTS = \ + ibus-ui-gtk \ + $(NULL) + +component_DATA = \ + gtkpanel.xml \ + $(NULL) +componentdir = $(pkgdatadir)/component CLEANFILES = \ *.pyc \ @@ -42,9 +48,11 @@ CLEANFILES = \ EXTRA_DIST = \ ibus-ui-gtk.in \ + gtkpanel.xml.in \ $(NULL) test: $(ENV) DBUS_DEBUG=true \ + IBUS_PREFIX=@prefix@ \ PYTHONPATH=$(top_srcdir) \ $(PYTHON) $(srcdir)/main.py diff --git a/ui/gtk/candidatepanel.py b/ui/gtk/candidatepanel.py index 528c7e7..db02163 100644 --- a/ui/gtk/candidatepanel.py +++ b/ui/gtk/candidatepanel.py @@ -24,7 +24,7 @@ import gtk.gdk as gdk import gobject import pango import ibus -from ibus.gtk import PangoAttrList +from ibus._gtk import PangoAttrList class Label(gtk.Label): pass gobject.type_register(Label, "IBusPanelLabel") @@ -260,58 +260,53 @@ class CandidatePanel(gtk.VBox): # self.hide_all() # self.show_all() - def show_preedit(self): + def show_preedit_text(self): self.__preedit_visible = True self.__preedit_label.show() self.__check_show_states() - def hide_preedit(self): + def hide_preedit_text(self): self.__preedit_visible = False self.__preedit_label.hide() self.__check_show_states() - def update_preedit(self, text, attrs, cursor_pos, visible): - if attrs: - attrs = PangoAttrList(attrs, text) + def update_preedit_text(self, text, cursor_pos, visible): + attrs = PangoAttrList(text.attributes, text.text) if visible: - self.show_preedit() + self.show_preedit_text() else: - self.hide_preedit() - self.__preedit_string = text - self.__preedit_label.set_text(text) - if attrs == None: - attrs = pango.AttrList() + self.hide_preedit_text() + self.__preedit_stribg = text.text + self.__preedit_label.set_text(text.text) self.__preedit_attrs = attrs self.__preedit_label.set_attributes(attrs) - def show_aux_string(self): + def show_auxiliary_text(self): self.__aux_string_visible = True self.__aux_label.show() self.__check_show_states() - def hide_aux_string(self): + def hide_auxiliary_text(self): self.__aux_string_visible = False self.__aux_label.hide() self.__check_show_states() - def update_aux_string(self, text, attrs, show): - attrs = PangoAttrList(attrs, text) + def update_auxiliary_text(self, text, show): + attrs = PangoAttrList(text.attributes, text.text) if show: - self.show_aux_string() + self.show_auxiliary_text() else: - self.hide_aux_string() + self.hide_auxiliary_text() - self.__aux_string = text - self.__aux_label.set_text(text) - if attrs == None: - attrs = pango.AttrList() + self.__aux_string = text.text + self.__aux_label.set_text(text.text) self.__aux_attrs = attrs self.__aux_label.set_attributes(attrs) def __refresh_candidates(self): - candidates = self.__lookup_table.get_canidates_in_current_page() - candidates = map(lambda x: (x[0], PangoAttrList(x[1], x[0]) if x[1] else None), candidates) + candidates = self.__lookup_table.get_candidates_in_current_page() + candidates = map(lambda x: (x.text, PangoAttrList(x.attributes, x.text)), candidates) self.__candidate_area.set_candidates(candidates, self.__lookup_table.get_cursor_pos_in_current_page(), self.__lookup_table.is_cursor_visible() @@ -372,8 +367,8 @@ class CandidatePanel(gtk.VBox): self.emit("hide") def reset(self): - self.update_preedit("", None, 0, False) - self.update_aux_string("", None, False) + self.update_preedit_text(ibus.Text(""), 0, False) + self.update_auxiliary_text(ibus.Text(""), False) self.update_lookup_table(None, False) self.hide() diff --git a/ui/gtk/gtkpanel.xml.in b/ui/gtk/gtkpanel.xml.in new file mode 100644 index 0000000..961dc5a --- /dev/null +++ b/ui/gtk/gtkpanel.xml.in @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- filename: pinyin.xml --> +<component> + <name>org.freedesktop.IBus.Panel</name> + <description>Gtk Panel Component</description> + <exec>@prefix@/libexec/ibus-ui-gtk</exec> + <version>@VERSION@</version> + <author>Peng Huang <shawn.p.huang@gmail.com></author> + <license>GPL</license> + <homepage>http://code.google.com/p/ibus</homepage> + <textdomain>ibus</textdomain> +</component> diff --git a/ui/gtk/icon.py b/ui/gtk/icon.py index 4a373a9..077848d 100644 --- a/ui/gtk/icon.py +++ b/ui/gtk/icon.py @@ -33,9 +33,6 @@ class IconWidget(gtk.Image): theme = gtk.icon_theme_get_default() pixbuf = theme.load_icon(icon, size, 0) except: - pass - - if pixbuf == None: theme = gtk.icon_theme_get_default() pixbuf = theme.load_icon(gtk.STOCK_MISSING_IMAGE, size, 0) diff --git a/ui/gtk/languagebar.py b/ui/gtk/languagebar.py index 65eb2e5..7a8a106 100644 --- a/ui/gtk/languagebar.py +++ b/ui/gtk/languagebar.py @@ -78,7 +78,7 @@ class LanguageBar(gtk.Toolbar): self.insert(self.__handle, -1) # create input methods menu - prop = ibus.Property(name = "", type = ibus.PROP_TYPE_TOGGLE, icon = "ibus", tooltip = _("Switch engine")) + prop = ibus.Property(key = "", type = ibus.PROP_TYPE_TOGGLE, icon = "ibus", tooltip = _("Switch engine")) self.__im_menu = ToggleToolButton(prop) self.__im_menu.set_homogeneous(False) self.__im_menu.connect("toggled", self.__im_menu_toggled_cb) @@ -192,6 +192,8 @@ class LanguageBar(gtk.Toolbar): self.__im_menu.set_sensitive(False) if self.__auto_hide: self.hide_all() + else: + self.show_all() gobject.type_register(LanguageBar, "IBusLanguageBar") diff --git a/ui/gtk/main.py b/ui/gtk/main.py index 489f96a..f9f9ff6 100644 --- a/ui/gtk/main.py +++ b/ui/gtk/main.py @@ -31,19 +31,16 @@ import notifications class UIApplication: def __init__ (self): self.__bus = ibus.Bus() - self.__bus.connect("destroy", self.__bus_destroy_cb) + self.__bus.connect("disconnected", gtk.main_quit) self.__panel = panel.Panel(self.__bus) - self.__notify = notifications.Notifications(self.__bus) - self.__notify.set_status_icon(self.__panel.get_status_icon()) + self.__bus.request_name(ibus.IBUS_SERVICE_PANEL, 0) + # self.__notify = notifications.Notifications(self.__bus) + # self.__notify.set_status_icon(self.__panel.get_status_icon()) def run(self): gtk.main() - def __bus_destroy_cb(self, _ibus): - gtk.main_quit() - - def launch_panel(): # gtk.settings_get_default().props.gtk_theme_name = "/home/phuang/.themes/aud-Default/gtk-2.0/gtkrc" # gtk.rc_parse("./themes/default/gtkrc") diff --git a/ui/gtk/menu.py b/ui/gtk/menu.py index 19911e8..9a3b30a 100644 --- a/ui/gtk/menu.py +++ b/ui/gtk/menu.py @@ -107,7 +107,7 @@ class ImageMenuItem (gtk.ImageMenuItem, PropItem): self.hide_all () def do_activate (self): - self.emit ("property-activate", self._prop.name, self._prop.state) + self.emit ("property-activate", self._prop.key, self._prop.state) def property_changed (self): self.set_sensitive (self._prop.sensitive) @@ -145,7 +145,7 @@ class CheckMenuItem (gtk.CheckMenuItem, PropItem): self._prop.state = ibus.PROP_STATE_CHECKED else: self._prop.state = ibus.PROP_STATE_UNCHECKED - self.emit ("property-activate", self._prop.name, self._prop.state) + self.emit ("property-activate", self._prop.key, self._prop.state) def property_changed (self): self.set_active (self._prop.state == ibus.PROP_STATE_CHECKED) @@ -167,7 +167,7 @@ class RadioMenuItem (gtk.RadioMenuItem, PropItem): } def __init__ (self, group, prop): - gtk.RadioMenuItem.__init__ (self, group, label = prop.label) + gtk.RadioMenuItem.__init__ (self, group, label = prop.label.text) PropItem.__init__ (self, prop) self.set_active (self._prop.state == ibus.PROP_STATE_CHECKED) @@ -194,7 +194,7 @@ class RadioMenuItem (gtk.RadioMenuItem, PropItem): self._prop.state = ibus.PROP_STATE_CHECKED else: self._prop.state = ibus.PROP_STATE_UNCHECKED - self.emit ("property-activate", self._prop.name, self._prop.state) + self.emit ("property-activate", self._prop.key, self._prop.state) class SeparatorMenuItem (gtk.SeparatorMenuItem, PropItem): __gsignals__ = { diff --git a/ui/gtk/notifications.py b/ui/gtk/notifications.py index cebedf5..1e990f3 100644 --- a/ui/gtk/notifications.py +++ b/ui/gtk/notifications.py @@ -34,17 +34,13 @@ from gettext import dgettext _ = lambda a : dgettext("ibus", a) N_ = lambda a : a -BUS_NOTIFICATIONS_NAME = "org.freedesktop.Notifications" -BUS_NOTIFICATIONS_PATH = "/org/freedesktop/Notifications" -BUS_NOTIFICATIONS_IFACE = "org.freedesktop.Notifications" - class Notifications(ibus.NotificationsBase): def __init__ (self, bus): super(Notifications, self).__init__(bus) self.__bus = bus try: self.__dbus = dbus.SessionBus() - self.__dbus.watch_name_owner(BUS_NOTIFICATIONS_NAME, + self.__dbus.watch_name_owner(ibus.IBUS_SERVICE_NOTIFICATIONS, self.__notifications_name_owner_changed_cb) except: self.__dbus = None @@ -52,7 +48,7 @@ class Notifications(ibus.NotificationsBase): self.__ids = set([]) self.__init_notifications() self.__status_icons = None - self.__bus.request_name(ibus.IBUS_NOTIFICATIONS_NAME, 0) + self.__bus.request_name(ibus.IBUS_SERVICE_NOTIFICATIONS, 0) def __notifications_name_owner_changed_cb(self, unique_name): if unique_name: @@ -66,13 +62,13 @@ class Notifications(ibus.NotificationsBase): try: self.__notifications = self.__dbus.get_object( - BUS_NOTIFICATIONS_NAME, BUS_NOTIFICATIONS_PATH) + ibus.IBUS_SERVICE_NOTIFICATIONS, ibus.IBUS_PATH_NOTIFICATIONS) self.__notifications.connect_to_signal("NotificationClosed", self.__notification_closed_cb, - dbus_interface=BUS_NOTIFICATIONS_IFACE) + dbus_interface=ibus.IBUS_IFACE_NOTIFICATIONS) self.__notifications.connect_to_signal("ActionInvoked", self.__action_invoked_cb, - dbus_interface=BUS_NOTIFICATIONS_IFACE) + dbus_interface=ibus.IBUS_IFACE_NOTIFICATIONS) self.__ids = set([]) except: self.__notifications = None diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py index 1456cc4..284dbb6 100644 --- a/ui/gtk/panel.py +++ b/ui/gtk/panel.py @@ -55,6 +55,7 @@ class Panel(ibus.PanelBase): def __init__ (self, bus): super(Panel, self).__init__(bus) self.__bus = bus + self.__config = self.__bus.get_config() self.__focus_ic = None self.__setup_pid = 0 self.__prefix = os.getenv("IBUS_PREFIX") @@ -67,9 +68,9 @@ class Panel(ibus.PanelBase): signal.signal(signal.SIGCHLD, self.__sigchld_cb) # connect bus signal - self.__bus.connect("config-value-changed", self.__config_value_changed_cb) - self.__bus.connect("config-reloaded", self.__config_reloaded_cb) - self.__bus.config_add_watch("panel") + self.__config.connect("value-changed", self.__config_value_changed_cb) + self.__config.connect("reloaded", self.__config_reloaded_cb) + # self.__bus.config_add_watch("panel") # add icon search path icon_theme = gtk.icon_theme_get_default() @@ -101,28 +102,28 @@ class Panel(ibus.PanelBase): self.__config_load_lookup_table_orientation() self.__config_load_auto_hide() self.__config_load_custom_font() - self.__bus.request_name(ibus.panel.IBUS_PANEL_NAME, 0) + # self.__bus.request_name(ibus.panel.IBUS_SERVICE_PANEL, 0) def set_cursor_location(self, x, y, w, h): self.__candidate_panel.set_cursor_location(x + w, y + h) - def update_preedit(self, text, attrs, cursor_pos, visible): - self.__candidate_panel.update_preedit(text, attrs, cursor_pos, visible) + def update_preedit_text(self, text, cursor_pos, visible): + self.__candidate_panel.update_preedit_text(text, cursor_pos, visible) - def show_preedit(self): - self.__candidate_panel.show_preedit() + def show_preedit_text(self): + self.__candidate_panel.show_preedit_text() - def hide_preedit(self): - self.__candidate_panel.hide_preedit() + def hide_preedit_text(self): + self.__candidate_panel.hide_preedit_text() - def update_aux_string(self, text, attrs, visible): - self.__candidate_panel.update_aux_string(text, attrs, visible) + def update_auxiliary_text(self, text, visible): + self.__candidate_panel.update_auxiliary_text(text, visible) - def show_aux_string(self): - self.__candidate_panel.show_aux_string() + def show_auxiliary_text(self): + self.__candidate_panel.show_auxiliary_text() - def hide_aux_string(self): - self.__candidate_panel.hide_aux_string() + def hide_auxiliary_text(self): + self.__candidate_panel.hide_auxiliary_text() def update_lookup_table(self, lookup_table, visible): self.__candidate_panel.update_lookup_table(lookup_table, visible) @@ -175,35 +176,43 @@ class Panel(ibus.PanelBase): def focus_in(self, ic): self.reset() - self.__focus_ic = ic - - factory, enabled = self.__bus.get_input_context_states(ic) + self.__focus_ic = ibus.InputContext(self.__bus, ic) + enabled = self.__focus_ic.is_enabled() self.__language_bar.set_enabled(enabled) - if factory == "" or not enabled: + if not enabled: self.__set_im_icon(self.__ibus_icon) else: - name, lang, icon, authors, credits = self.__bus.get_factory_info(factory) - self.__set_im_icon(icon) + engine = self.__focus_ic.get_engine() + if engine: + self.__set_im_icon(engine.icon) + else: + self.__set_im_icon(self.__ibus_icon) self.__language_bar.focus_in() def focus_out(self, ic): self.reset() - if self.__focus_ic == ic: - self.__focus_ic = None - self.__language_bar.focus_out() - self.__set_im_icon(self.__ibus_icon) + self.__focus_ic = None + self.__language_bar.focus_out() + self.__set_im_icon(self.__ibus_icon) - def states_changed(self): + def state_changed(self): if not self.__focus_ic: return - factory, enabled = self.__bus.get_input_context_states(self.__focus_ic) + + enabled = self.__focus_ic.is_enabled() self.__language_bar.set_enabled(enabled) - if enabled == False or not factory: + + if enabled == False: + self.reset() self.__set_im_icon(self.__ibus_icon) else: - name, lang, icon, authors, credits = self.__bus.get_factory_info(factory) - self.__set_im_icon(icon) + engine = self.__focus_ic.get_engine() + if engine: + self.__set_im_icon(engine.icon) + else: + self.__set_im_icon(self.__ibus_icon) + def reset(self): self.__candidate_panel.reset() @@ -216,7 +225,7 @@ class Panel(ibus.PanelBase): gtk.main_quit() def __config_load_lookup_table_orientation(self): - value = self.__bus.config_get_value("panel", "lookup_table_orientation", 0) + value = self.__config.get_value("panel", "lookup_table_orientation", 0) if value != 0 and value != 1: value = 0 if value == 0: @@ -225,14 +234,14 @@ class Panel(ibus.PanelBase): self.__candidate_panel.set_orientation(gtk.ORIENTATION_VERTICAL) def __config_load_auto_hide(self): - auto_hide = self.__bus.config_get_value("panel", "auto_hide", False) + auto_hide = self.__config.get_value("panel", "auto_hide", False) self.__language_bar.set_auto_hide(auto_hide) def __config_load_custom_font(self): - use_custom_font = self.__bus.config_get_value("panel", "use_custom_font", False) + use_custom_font = self.__config.get_value("panel", "use_custom_font", False) font_name = gtk.settings_get_default().get_property("gtk-font-name") font_name = unicode(font_name, "utf-8") - custom_font = self.__bus.config_get_value("panel", "custom_font", font_name) + custom_font = self.__config.get_value("panel", "custom_font", font_name) style_string = 'style "custom-font" { font_name="%s" }\n' \ 'class "IBusPanelLabel" style "custom-font"\n' if use_custom_font: @@ -246,6 +255,8 @@ class Panel(ibus.PanelBase): gtk.rc_reset_styles(settings) def __config_value_changed_cb(self, bus, section, name, value): + if section != "panel": + return if name == "lookup_table_orientation": self.__config_load_lookup_table_orientation() elif name == "auto_hide": @@ -278,45 +289,44 @@ class Panel(ibus.PanelBase): def __create_im_menu(self): menu = gtk.Menu() - factories = self.__bus.get_factories() + engines = self.__bus.list_active_engines() - if not factories: + if not engines: item = gtk.MenuItem(label = "no engine") item.set_sensitive(False) menu.add(item) else: tmp = {} - for factory in factories: - name, lang, icon, authors, credits = self.__bus.get_factory_info(factory) - lang = ibus.get_language_name(lang) - if not icon: - icon = "engine-default" + for engine in engines: + lang = ibus.get_language_name(engine.language) if lang not in tmp: tmp[lang] = [] - tmp[lang].append((name, lang, icon, authors, credits, factory)) + tmp[lang].append(engine) + langs = tmp.keys() other = tmp.get(_("Other"), []) if _("Other") in tmp: langs.remove(_("Other")) langs.append(_("Other")) + for lang in langs: if len(tmp[lang]) == 1: - name, lang, icon, authors, credits, factory = tmp[lang][0] - item = gtk.ImageMenuItem("%s - %s" % (lang, name)) + engine = tmp[lang][0] + item = gtk.ImageMenuItem("%s - %s" % (lang, engine.longname)) size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) - item.set_image (_icon.IconWidget(icon, size[0])) - item.connect("activate", self.__im_menu_item_activate_cb, factory) + item.set_image (_icon.IconWidget(engine.icon, size[0])) + item.connect("activate", self.__im_menu_item_activate_cb, engine) menu.add(item) else: item = gtk.MenuItem(lang) menu.add(item) submenu = gtk.Menu() item.set_submenu(submenu) - for name, __lang, icon, authors, credits, factory in tmp[lang]: - item = gtk.ImageMenuItem(name) + for engine in tmp[lang]: + item = gtk.ImageMenuItem(engine.longname) size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) - item.set_image (_icon.IconWidget(icon, size[0])) - item.connect("activate", self.__im_menu_item_activate_cb, factory) + item.set_image (_icon.IconWidget(engine.icon, size[0])) + item.connect("activate", self.__im_menu_item_activate_cb, engine) submenu.add(item) menu.show_all() @@ -345,8 +355,8 @@ class Panel(ibus.PanelBase): gtk.get_current_event_time(), self.__status_icon) - def __im_menu_item_activate_cb(self, item, factory): - self.__bus.set_factory(factory) + def __im_menu_item_activate_cb(self, item, engine): + self.__focus_ic.set_engine(engine) def __sys_menu_item_activate_cb(self, item, command): if command == gtk.STOCK_PREFERENCES: diff --git a/ui/gtk/propitem.py b/ui/gtk/propitem.py index 3d363ed..bb66174 100644 --- a/ui/gtk/propitem.py +++ b/ui/gtk/propitem.py @@ -30,7 +30,7 @@ class PropItem: retval = False - if self._prop.name == prop.name and self._prop.type == prop.type: + if self._prop.key == prop.key and self._prop.type == prop.type: self._prop = prop self.property_changed () retval = True diff --git a/ui/gtk/toolitem.py b/ui/gtk/toolitem.py index 48147a7..0e4e4ad 100644 --- a/ui/gtk/toolitem.py +++ b/ui/gtk/toolitem.py @@ -36,7 +36,7 @@ class ToolButton(gtk.ToolButton, PropItem): } def __init__(self, prop): - gtk.ToolButton.__init__ (self, label = prop.label) + gtk.ToolButton.__init__ (self, label = prop.label.text) self.set_homogeneous(False) PropItem.__init__ (self, prop) self.property_changed() @@ -58,14 +58,14 @@ class ToolButton(gtk.ToolButton, PropItem): def set_tooltip_text(self, text): if text: - gtk.ToolButton.set_tooltip_text(self, text) + gtk.ToolButton.set_tooltip_text(self, text.text) else: gtk.ToolButton.set_tooltip_text(self, None) self._prop.tooltip = text def property_changed(self): - self.set_label(self._prop.label) + self.set_label(self._prop.label.text) self.set_tooltip_text(self._prop.tooltip) self.set_sensitive(self._prop.sensitive) self.set_icon_name(self._prop.icon) @@ -78,7 +78,7 @@ class ToolButton(gtk.ToolButton, PropItem): self.hide_all() def do_clicked(self): - self.emit("property-activate", self._prop.name, self._prop.state) + self.emit("property-activate", self._prop.key, self._prop.state) class ToggleToolButton(gtk.ToggleToolButton, PropItem): @@ -112,7 +112,7 @@ class ToggleToolButton(gtk.ToggleToolButton, PropItem): def set_tooltip_text(self, text): if text: - gtk.ToggleToolButton.set_tooltip_text(self, text) + gtk.ToggleToolButton.set_tooltip_text(self, text.text) else: gtk.ToggleToolButton.set_tooltip_text(self, None) @@ -120,7 +120,7 @@ class ToggleToolButton(gtk.ToggleToolButton, PropItem): def property_changed(self): self.set_tooltip_text(self._prop.tooltip) - self.set_label(self._prop.label) + self.set_label(self._prop.label.text) self.set_icon_name(self._prop.icon) self.set_active(self._prop.state == ibus.PROP_STATE_CHECKED) self.set_sensitive(self._prop.sensitive) @@ -136,7 +136,7 @@ class ToggleToolButton(gtk.ToggleToolButton, PropItem): self._prop.state = ibus.PROP_STATE_CHECKED else: self._prop.state = ibus.PROP_STATE_UNCHECKED - self.emit("property-activate", self._prop.name, self._prop.state) + self.emit("property-activate", self._prop.key, self._prop.state) class SeparatorToolItem(gtk.SeparatorToolItem, PropItem): def __init__ (self, prop): |