from icon import load_icon
+from gettext import dgettext
+_ = lambda a : dgettext("ibus", a)
+N_ = lambda a : a
+
class EngineTreeView(gtk.TreeView):
__gsignals__ = {
'changed' : (
super(EngineTreeView, self).__init__()
self.__engines = set([])
-
self.__changed = False
+ self.set_headers_visible(True)
+ self.set_reorderable(True)
+
self.__model = gtk.ListStore(gobject.TYPE_PYOBJECT)
self.set_model(self.__model)
self.__model.connect("row-changed", self.__emit_changed_delay_cb, "row-changed")
self.__model.connect("row-inserted", self.__emit_changed_delay_cb, "row-inserted")
self.__model.connect("rows-reordered", self.__emit_changed_delay_cb, "rows-reordered")
- self.set_headers_visible(False)
-
- column = gtk.TreeViewColumn()
+ # create im name & icon column
+ column = gtk.TreeViewColumn(_("Input Method"))
+ column.set_min_width(200)
renderer = gtk.CellRendererPixbuf()
renderer.set_property("xalign", 0)
renderer = gtk.CellRendererText()
renderer.set_property("xalign", 0)
+ renderer.set_property("ellipsize", pango.ELLIPSIZE_END)
column.pack_start(renderer, True)
column.set_cell_data_func(renderer, self.__name_cell_data_cb)
- self.append_column (column)
+ self.append_column(column)
- self.set_reorderable(True)
+ # create im keyboard layout column
+ renderer = gtk.CellRendererCombo()
+ renderer.set_property("xalign", 0)
+
+ column = gtk.TreeViewColumn(_("KBL"))
+ column.set_expand(False)
+ column.set_fixed_width(32)
+ column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ column.pack_start(renderer, False)
+ column.set_cell_data_func(renderer, self.__layout_cell_data_cb)
+ self.append_column (column)
self.set_engines(engines)
renderer.set_property("sensitive", True)
language = ibus.get_language_name(engine.language)
renderer.set_property("text", "%s - %s" % (language, engine.longname))
+ if self.__model.get_path(iter)[0] == 0:
+ # default engine
+ renderer.set_property("weight", pango.WEIGHT_BOLD)
+ else:
+ renderer.set_property("weight", pango.WEIGHT_NORMAL)
+
+ def __layout_cell_data_cb(self, celllayout, renderer, model, iter):
+ engine = self.__model.get_value(iter, 0)
+ renderer.set_property("sensitive", True)
+ language = ibus.get_language_name(engine.language)
+ renderer.set_property("text", engine.layout)
if self.__model.get_path(iter)[0] == 0:
#default engine
renderer.set_property("weight", pango.WEIGHT_BOLD)
button = self.__xml.get_widget("button_trigger")
entry = self.__xml.get_widget("entry_trigger")
- entry.set_text("; ".join(shortcuts))
+ text = "; ".join(shortcuts)
+ entry.set_text(text)
+ entry.set_tooltip_text(text)
button.connect("clicked", self.__shortcut_button_clicked_cb,
N_("trigger"), "general/hotkey", "trigger", entry)
ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
button = self.__xml.get_widget("button_next_engine")
entry = self.__xml.get_widget("entry_next_engine")
- entry.set_text("; ".join(shortcuts))
+ text = "; ".join(shortcuts)
+ entry.set_text(text)
+ entry.set_tooltip_text(text)
button.connect("clicked", self.__shortcut_button_clicked_cb,
N_("next input method"), "general/hotkey", "next_engine", entry)
ibus.CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT)
button = self.__xml.get_widget("button_prev_engine")
entry = self.__xml.get_widget("entry_prev_engine")
- entry.set_text("; ".join(shortcuts))
+ text = "; ".join(shortcuts)
+ entry.set_text(text)
+ entry.set_tooltip_text(text)
button.connect("clicked", self.__shortcut_button_clicked_cb,
N_("previous input method"), "general/hotkey", "prev_engine", entry)
def __button_engine_about_cb(self, button):
engine = self.__treeview.get_select_engine()
- about = EngineAbout(engine)
- about.run()
- about.destroy()
+ if engine:
+ about = EngineAbout(engine)
+ about.run()
+ about.destroy()
def __treeview_changed_cb(self, treeview):
engines = self.__treeview.get_engines()
if id != gtk.RESPONSE_OK:
return
self.__config.set_list(section, _name, shortcuts, "s")
- entry.set_text("; ".join(shortcuts))
+ text = "; ".join(shortcuts)
+ entry.set_text(text)
+ entry.set_tooltip_text(text)
def __item_started_column_toggled_cb(self, cell, path_str, model):
"heading", "left_margin_16")
text_buffer.insert_with_tags_by_name(iter, _("Language: %s\n") % ibus.get_language_name(self.__engine_desc.language),
"small", "bold", "left_margin_16")
+ text_buffer.insert_with_tags_by_name(iter, _("Kayboard layout: %s\n") % self.__engine_desc.layout,
+ "small", "bold", "left_margin_16")
text_buffer.insert_with_tags_by_name(iter, _("Author: %s\n") % self.__engine_desc.author,
"small", "bold", "left_margin_16")
text_buffer.insert_with_tags_by_name(iter, _("Description:\n"),