self.__fontbutton_custom_font.connect("notify::font-name", self.__fontbutton_custom_font_notify_cb)
self.__fontbutton_custom_font.set_font_name(font_name)
+ # show ime name
+ self.__checkbutton_show_im_name = self.__xml.get_widget("checkbutton_show_im_name")
+ self.__checkbutton_show_im_name.set_active(
+ self.__config.get_value("panel", "show_im_name", False))
+ self.__checkbutton_show_im_name.connect("toggled", self.__checkbutton_show_im_name_toggled_cb)
+
# init engine page
self.__engines = self.__bus.list_engines()
self.__combobox = EngineComboBox(self.__engines)
font_name = unicode(font_name, "utf-8")
self.__config.set_value("panel", "custom_font", font_name)
+ def __checkbutton_show_im_name_toggled_cb(self, button):
+ value = self.__checkbutton_show_im_name.get_active()
+ self.__config.set_value("panel", "show_im_name", value)
+
def __config_value_changed_cb(self, bus, section, name, value):
pass
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_show_im_name">
+ <property name="label" translatable="yes">Show input method name on language bar</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
<child>
<widget class="GtkCheckButton" id="checkbutton_custom_font">
<property name="label" translatable="yes">Use custom font</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
</child>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</widget>
import gtk.gdk as gdk
import gobject
import ibus
+import icon
from handle import Handle
from menu import menu_position
from engineabout import EngineAbout
self.__show = 1
self.__enabled = False
self.__has_focus = False
- self.set_style(gtk.TOOLBAR_ICONS)
+ self.__show_im_name = False
+ self.__im_name = None
+ self.set_style(gtk.TOOLBAR_BOTH_HORIZ)
self.set_show_arrow(False)
self.set_property("icon-size", ICON_SIZE)
self.__create_ui()
handle.connect("move-end", self.__handle_move_end_cb)
# create input methods menu
- prop = ibus.Property(key = "", type = ibus.PROP_TYPE_TOGGLE, icon = "ibus", tooltip = _("Switch input method"))
- self.__im_menu = ToggleToolButton(prop)
+ # prop = ibus.Property(key = "", type = ibus.PROP_TYPE_TOGGLE, icon = "ibus", tooltip = _("Switch input method"))
+ self.__im_menu = gtk.ToggleToolButton()
self.__im_menu.set_homogeneous(False)
self.__im_menu.connect("toggled", self.__im_menu_toggled_cb)
self.insert(self.__im_menu, -1)
self.__toplevel.resize(1, 1)
def set_im_icon(self, icon_name):
- self.__im_menu.set_icon_name(icon_name)
+ widget = icon.IconWidget(icon_name, 18)
+ self.__im_menu.set_icon_widget(widget)
+
+ def set_show_im_name(self, show):
+ self.__show_im_name = show
+ self.set_im_name(self.__im_name)
+ self.__im_menu.set_is_important(show)
+
+ def set_im_name(self, text):
+ self.__im_name = text
+ if text:
+ self.__im_menu.set_tooltip_text(text)
+ self.__im_menu.set_label(text)
+ else:
+ self.__im_menu.set_tooltip_text(_("Switch input method"))
+ self.__im_menu.set_label("")
def reset(self):
self.__remove_properties()
self.__config_load_lookup_table_orientation()
self.__config_load_show()
self.__config_load_custom_font()
+ self.__config_load_show_im_name()
# self.__bus.request_name(ibus.panel.IBUS_SERVICE_PANEL, 0)
def set_cursor_location(self, x, y, w, h):
else:
self.__status_icon.set_from_icon_name(icon_name)
+ def __set_im_name(self, name):
+ self.__language_bar.set_im_name(name)
+
def focus_in(self, ic):
self.reset()
self.__focus_ic = ibus.InputContext(self.__bus, ic)
if not enabled:
self.__set_im_icon(self.__ibus_icon)
+ self.__set_im_name(None)
else:
engine = self.__focus_ic.get_engine()
if engine:
self.__set_im_icon(engine.icon)
+ self.__set_im_name(engine.longname)
else:
self.__set_im_icon(self.__ibus_icon)
+ self.__set_im_name(None)
self.__language_bar.focus_in()
def focus_out(self, ic):
self.__language_bar.set_enabled(False)
self.__language_bar.focus_out()
self.__set_im_icon(self.__ibus_icon)
+ self.__set_im_name(None)
def state_changed(self):
if not self.__focus_ic:
if enabled == False:
self.reset()
self.__set_im_icon(self.__ibus_icon)
+ self.__set_im_name(None)
else:
engine = self.__focus_ic.get_engine()
if engine:
self.__set_im_icon(engine.icon)
+ self.__set_im_name(engine.longname)
else:
self.__set_im_icon(self.__ibus_icon)
+ self.__set_im_name(None)
def reset(self):
settings = gtk.settings_get_default()
gtk.rc_reset_styles(settings)
+ def __config_load_show_im_name(self):
+ value = self.__config.get_value("panel", "show_im_name", False)
+ self.__language_bar.set_show_im_name(value)
+
def __config_value_changed_cb(self, bus, section, name, value):
if section != "panel":
return
self.__config_load_show()
elif name == "use_custom_font" or name == "custom_font":
self.__config_load_custom_font()
+ elif name == "show_im_name":
+ self.__config_load_show_im_name()
+ else:
+ print >> sys.stderr, "Unknown config item [%s]" % name
def __config_reloaded_cb(self, bus):
pass