def __init_props(self): tutcode_props = ibus.PropList() input_mode_prop = ibus.Property(key=u"InputMode", type=ibus.PROP_TYPE_MENU, label=u"あ", tooltip=_(u"Switch input mode")) self.__prop_dict[u"InputMode"] = input_mode_prop props = ibus.PropList() props.append( ibus.Property(key=u"InputMode.Latin", type=ibus.PROP_TYPE_RADIO, label=_(u"Latin"))) props.append( ibus.Property(key=u"InputMode.Hiragana", type=ibus.PROP_TYPE_RADIO, label=_(u"Hiragana"))) props.append( ibus.Property(key=u"InputMode.Katakana", type=ibus.PROP_TYPE_RADIO, label=_(u"Katakana"))) for prop in props: self.__prop_dict[prop.key] = prop prop_name = self.__input_mode_prop_names[self.__tutcode.input_mode] self.__prop_dict[prop_name].set_state(ibus.PROP_STATE_CHECKED) input_mode_prop.set_sub_props(props) tutcode_props.append(input_mode_prop) return tutcode_props
def _init_props(self): xkbc_props = ibus.PropList() layout_switch_prop = ibus.Property( key=u"LayoutSwitch", type=ibus.PROP_TYPE_MENU, label=self.__target_layout_name.capitalize(), tooltip=u"Layout Switch") self.__prop_dict[u"LayoutSwitch"] = layout_switch_prop props = ibus.PropList() selected = layout_make_object_list(self.__user_layouts) id = 0 self.__layout_menu_items = [] for lo in selected: props.append( ibus.Property(key=CMD_LAYOUT_SWITCH + str(id), type=ibus.PROP_TYPE_RADIO, label=lo.get_desc())) self.__layout_menu_items.append(lo.get_name()) id += 1 props[self.__target_layout_id].set_state(ibus.PROP_STATE_CHECKED) for prop in props: self.__prop_dict[prop.key] = prop layout_switch_prop.set_sub_props(props) xkbc_props.append(layout_switch_prop) xkbc_props.append( ibus.Property(key=CMD_SETUP, tooltip=UI_TOOLTIP_SETUP)) return xkbc_props
def __init__(self, bus, object_path): super(Engine, self).__init__(bus, object_path) im_open_decoder() self.__is_invalidate = False self.__prepinyin_string = u"" self.__lookup_table = ibus.LookupTable() # 0 = english input mode # 1 = chinese input mode self.__mode = 1 self.__full_width_letter = [False, False] self.__full_width_punct = [False, True] self.__full_width_punct[1] = True #config.get_value("engine/PinYin/FullWidthPunct", True) self.__trad_chinese = [False, False] self.reset() # init properties self.__prop_list = ibus.PropList() self.__status_property = ibus.Property(u"status") self.__prop_list.append(self.__status_property) self.__letter_property = ibus.Property(u"full_letter") self.__prop_list.append(self.__letter_property) self.__punct_property = ibus.Property(u"full_punct") self.__prop_list.append(self.__punct_property) self.__trad_chinese_property = ibus.Property(u"_trad chinese") if globals().get('libopencc'): self.__prop_list.append(self.__trad_chinese_property) pass
def __init__(self, bus, object_path): super(Engine, self).__init__(bus, object_path) self.__is_invalidate = False self.__preedit_string = u"" self.__lookup_table = ibus.LookupTable() self.__prop_list = ibus.PropList() self.__prop_list.append(ibus.Property(u"test", icon=u"ibus-locale"))
def _init_properties(self): self.properties = ibus.PropList() self._status_property = ibus.Property(u'status') # if self.db._is_chinese: # self._cmode_property = ibus.Property(u'cmode') # self._letter_property = ibus.Property(u'letter') # self._punct_property = ibus.Property(u'punct') # self._py_property = ibus.Property(u'py_mode') # self._onechar_property = ibus.Property(u'onechar') # self._auto_commit_property = ibus.Property(u'acommit') # for prop in (self._status_property, # self._letter_property, # self._punct_property, # self._py_property, # self._onechar_property, # self._auto_commit_property #self._setup_property # ): # self.properties.append(prop) # if self.db._is_chinese: # self.properties.insert( 1, self._cmode_property ) self.properties.insert(1, self._status_property) self.register_properties(self.properties) # self.register_properties (self._status_property) self._refresh_properties()
def __init__(self, bus, object_path): super(SulekhaEngine, self).__init__(bus, object_path) self.__keymap = keymap.Keymap("swanalekha_ml_IN") self.__input_method="en_US" self.__autocomplete=autocomplete.Autocomplete() self.__is_invalidate = False self.__preedit_string = u"" self.__current_word = u"" self.__lookup_table = ibus.LookupTable() self.__prop_list = ibus.PropList() self.__prop_list.append(ibus.Property(u"test", icon = u"ibus-locale"))
def __init_props(self): #Create all of our properties in one go wz_props = ibus.PropList() # #Property 1: Output Encoding # enc_key = u"OutputEncoding" encoding_prop = ibus.Property( key = enc_key, type = ibus.PROP_TYPE_NORMAL, label = u"", tooltip = u"Switch Output Encoding", icon = PKG_DATA_DIR + u"/icons/input_uni.svg" ) self.__prop_dict[enc_key] = encoding_prop #List all properties in this menu props = ibus.PropList() props.append(ibus.Property( key = enc_key + "." + u"Unicode", type = ibus.PROP_TYPE_NORMAL, label = u"Unicode 5.1", icon = PKG_DATA_DIR + u"/icons/input_uni.svg")) props.append(ibus.Property( key = enc_key + "." + u"Zawgyi", type = ibus.PROP_TYPE_NORMAL, label = "Zawgyi-One", icon = PKG_DATA_DIR + u"/icons/input_zg.svg")) props.append(ibus.Property( key = enc_key + "." + u"WinInnwa", type = ibus.PROP_TYPE_NORMAL, label = "Win Innwa", icon = PKG_DATA_DIR + u"/icons/input_wi.svg")) #set the state, copy all values into the main dictionary, our main menu item, and the return value props[self.__encoding].set_state(ibus.PROP_STATE_CHECKED) for prop in props: self.__prop_dict[prop.key] = prop encoding_prop.set_sub_props(props) wz_props.append(encoding_prop) # #Property 2: Type Burmese Numerals # enc_key = u"TypeNumerals" encoding_prop = ibus.Property( key = enc_key, type = ibus.PROP_TYPE_NORMAL, label = u"", tooltip = "Type Burmese Numerals", icon = PKG_DATA_DIR + u"/icons/num_mm.svg" ) self.__prop_dict[enc_key] = encoding_prop #List all properties in this menu props = ibus.PropList() props.append(ibus.Property( key = enc_key + "." + u"Burmese", type = ibus.PROP_TYPE_NORMAL, label = "Burmese Numerals", icon = PKG_DATA_DIR + u"/icons/num_mm.svg")) props.append(ibus.Property( key = enc_key + "." + u"Arabic", type = ibus.PROP_TYPE_NORMAL, label = "Regular Numerals", icon = PKG_DATA_DIR + u"/icons/num_english.svg")) #set the state, copy all values into the main dictionary, our main menu item, and the return value props[self.__encoding].set_state(ibus.PROP_STATE_CHECKED) for prop in props: self.__prop_dict[prop.key] = prop encoding_prop.set_sub_props(props) wz_props.append(encoding_prop) # #Done # wz_props.append(ibus.Property(key=u"setup", tooltip="Configure WaitZar")) return wz_props
def create_im_menu(self, menu): if not self.__enabled: return if self.__show != 0: return if not menu: assert False props = self.__props if not props: return self.__remove_properties() item = SeparatorMenuItem() item.show() self.__properties.append(item) menu.insert(item, 0) about_label = _("About") + " - " + (self.__im_name or "") prop = ibus.Property(key=u"about", label=unicode(about_label), icon=unicode(gtk.STOCK_ABOUT), tooltip=unicode(_("About the Input Method"))) item = ImageMenuItem(prop=prop) item.set_property("always-show-image", True) item.set_no_show_all(True) item.show() self.__properties.append(item) menu.insert(item, 0) item.connect("property-activate", lambda w, n, s: self.emit("show-engine-about")) list = props.get_properties() list.reverse() radio_group = None for i, prop in enumerate(list): if prop.type == ibus.PROP_TYPE_NORMAL: item = ImageMenuItem(prop=prop) self.__set_item_icon(item, prop) elif prop.type == ibus.PROP_TYPE_TOGGLE: item = CheckMenuItem(prop=prop) elif prop.type == ibus.PROP_TYPE_RADIO: item = RadioMenuItem(radio_group, prop=prop) radio_group = item elif prop.type == ibus.PROP_TYPE_SEPARATOR: item = SeparatorMenuItem() radio_group = None elif prop.type == ibus.PROP_TYPE_MENU: item = ImageMenuItem(prop=prop) self.__set_item_icon(item, prop) submenu = Menu(prop) item.set_submenu(submenu) submenu.connect( "property-activate", lambda w, n, s: self.emit("property-activate", n, s)) else: raise IBusException("Unknown property type = %d" % prop.type) item.set_sensitive(prop.sensitive) item.set_no_show_all(True) if prop.visible: item.show() else: item.hide() self.__properties.append(item) menu.insert(item, 0) item.connect("property-activate", lambda w, n, s: self.emit("property-activate", n, s))