def __init_charset_prop_menu(self): charset_prop_list = IBus.PropList() for charset in self.__charset_list: charset_prop_list.append( IBus.Property(key=charset, prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(charset), icon='', tooltip=IBus.Text.new_from_string(charset), sensitive=True, visible=True, state=IBus.PropState.CHECKED if charset == "UTF8" else IBus.PropState.UNCHECKED, sub_props=None)) charset_prop_menu = IBus.Property( key="charset", prop_type=IBus.PropType.MENU, label=IBus.Text.new_from_string("Charset"), icon="gtk-preferences", tooltip=IBus.Text.new_from_string("Choose charset"), sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=charset_prop_list) return charset_prop_menu
def __init_charset_prop_menu(self): charset_prop_list = IBus.PropList() for charset in Config.charsets: charset_prop_list.append( IBus.Property( key=charset, prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string( Config.charsets[charset][0]), tooltip=IBus.Text.new_from_string( Config.charsets[charset][1]), sensitive=True, visible=True, state=IBus.PropState.CHECKED if Config.charsets[charset][2] == self.output_charset else IBus.PropState.UNCHECKED, sub_props=None)) self.__charset_prop_menu = IBus.Property( key="charset", prop_type=IBus.PropType.MENU, label=IBus.Text.new_from_string( Config.charsets['charset.' + self.output_charset][0]), icon=None, tooltip=IBus.Text.new_from_string("Choose charset"), sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=charset_prop_list) return self.__charset_prop_menu
def test_property(self): # construction with keyword args prop = IBus.Property(key='foo') self.assertEqual(prop.props.key, 'foo') # construction with non-keyword args prop = IBus.Property('bar') self.assertEqual(prop.props.key, 'bar')
def _init_props(self): self._prop_list = IBus.PropList() self._input_mode_prop = IBus.Property( key='InputMode', prop_type=IBus.PropType.NORMAL, symbol=IBus.Text.new_from_string(self._mode), label=IBus.Text.new_from_string(_("Input mode (%s)") % self._mode), icon=None, tooltip=None, sensitive=False, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self._prop_list.append(self._input_mode_prop) prop = IBus.Property(key='Setup', prop_type=IBus.PropType.NORMAL, label=IBus.Text.new_from_string(_("Setup")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self._prop_list.append(prop) prop = IBus.Property(key='About', prop_type=IBus.PropType.NORMAL, label=IBus.Text.new_from_string( _("About Hiragana IME...")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self._prop_list.append(prop)
def __init_method_prop_menu(self): method_prop_list = IBus.PropList() for method in Config.methods: method_prop_list.append( IBus.Property( key=method, prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(Config.methods[method][0]), icon=None, tooltip=IBus.Text.new_from_string( Config.methods[method][1]), sensitive=True, visible=True, state=IBus.PropState.CHECKED if method == self.input_method else IBus.PropState.UNCHECKED, sub_props=None)) self.__method_prop_menu = IBus.Property( key="method", prop_type=IBus.PropType.MENU, label=IBus.Text.new_from_string( Config.methods['im.' + self.input_method][0]), icon=None, tooltip=IBus.Text.new_from_string("Choose typing method"), sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=method_prop_list) return self.__method_prop_menu
def _init_input_mode_props(self): props = IBus.PropList() props.append(IBus.Property(key='InputMode.Alphanumeric', prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(_("Alphanumeric (A)")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.CHECKED, sub_props=None)) props.append(IBus.Property(key='InputMode.Hiragana', prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(_("Hiragana (あ)")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None)) props.append(IBus.Property(key='InputMode.Katakana', prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(_("Katakana (ア)")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None)) props.append(IBus.Property(key='InputMode.WideAlphanumeric', prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(_("Wide Alphanumeric (A)")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None)) props.append(IBus.Property(key='InputMode.HalfWidthKatakana', prop_type=IBus.PropType.RADIO, label=IBus.Text.new_from_string(_("Halfwidth Katakana (ア)")), icon=None, tooltip=None, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None)) return props
def __init__(self): """initialize the newly created engine """ self.properties = IBus.PropList() # self.properties.append(IBus.Property( # key='source', # type=IBus.PropType.NORMAL, # label='Microphone', # tooltip='ALSA device such as hw:0,0 or hw:1,0 (see arecord -l for ids)', # visible=True, # )) self.properties.append( IBus.Property( key='listening', type=IBus.PropType.TOGGLE, label='DeepSpeech', tooltip='Toggle whether the engine is currently listening', visible=True, )) # self.lookup_table = IBus.LookupTable.new( # 5, 0, True, True, # size # index, # cursor visible # round # ) # self.lookup_table_content = [] # self.interpreter_rules, self.rule_set = interpreter.load_rules( # interpreter.good_commands, # ) # self.lookup_table.ref_sink() super(ListenerEngine, self).__init__()
def init_properties(self): self.prop_list = IBus.PropList() for (key, label) in (("halfwidth-chars", _("Half-Width Characters")), ): stored_value = self.settings.get_boolean(key) state = IBus.PropState.CHECKED if stored_value else IBus.PropState.UNCHECKED try: # Try the new constructor from IBus >= 1.5 prop = IBus.Property(key=key, prop_type=IBus.PropType.TOGGLE, label=label, icon='', sensitive=True, visible=True, state=state, sub_props=None) except TypeError: # IBus 1.4.x didn't have the GI overrides for the nice # constructor, so let's do it the old, non-pythonic way. # IBus.Property.new(key, type, label, icon, tooltip, # sensitive, visible, state, sub_props) prop = IBus.Property.new(key, IBus.PropType.TOGGLE, IBus.Text.new_from_string(label), '', IBus.Text.new_from_string(''), True, True, state, None) self.prop_list.append(prop)
def __init__(self): super(EngineEnchant, self).__init__() self.__is_invalidate = False self.__preedit_string = "" self.__lookup_table = IBus.LookupTable.new(10, 0, True, True) self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="test", icon="ibus-local")) print("Create EngineEnchant OK")
def __init__(self): super(EngineAbalone, self).__init__() self.recording = False self.__is_invalidate = False self.__preedit_string = "" self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="toggle-recording", icon="audio-input-microphone", type=IBus.PropType.TOGGLE, state=0, tooltip="Toggle speech recognition")) self.pipeline = Gst.parse_launch("pulsesrc ! audioconvert ! audiorate ! audioresample ! deepspeech silence-threshold=0.3 silence-length=20 ! fakesink") self.bus = self.pipeline.get_bus() self.bus.add_signal_watch() self.bus.connect ("message", self.bus_message)
def __init__(self): super(EngineUnicodeDb, self).__init__() self.__is_invalidate = False self.__preedit_string = u"" self.__lookup_table = IBus.LookupTable.new(10, 0, True, True) self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="test", icon="ibus-local")) self.__lookup_table.set_orientation(IBus.Orientation.VERTICAL) # initialize mmap self.__data = DataParse() print "Create EngineUnicodeDb OK"
def __init__(self) -> None: super(EngineDeepSpeech, self).__init__() self.recording = False self.worker_thread: Optional[DictationThread] = None self.__prop_list = IBus.PropList() self.__prop_list.append( IBus.Property( key="toggle-recording", icon="audio-input-microphone", type=IBus.PropType.TOGGLE, state=0, label="Toggle speech recognition", ) )
def __init_props(self): self.__prop_list = IBus.PropList() self.__input_mode_prop = IBus.Property( key='InputMode', prop_type=IBus.PropType.NORMAL, symbol=IBus.Text.new_from_string(self.__mode), label=IBus.Text.new_from_string('Input mode (%s)' % self.__mode), icon=None, tooltip=None, sensitive=False, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self.__prop_list.append(self.__input_mode_prop)
def __init__(self): super(LekhaneeEngine, self).__init__() #Transliterator np_base_keymap = base_keymap.base_keymap np_dictionary_file = "libLekhanee/dictionaries/ne_NP/ne_NP_plain.dic" self.__transliterator = Transliterator("ne_NP", np_base_keymap, np_dictionary_file) # self.__is_invalidate = False self.__preedit_string = u"" self.__lookup_table = IBus.LookupTable.new(10, 0, True, True) self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="test", icon="ibus-local")) print "Create Lekhanee OK"
def setup_tool_buttons(self): self.prop_list = IBus.PropList() pref_label = IBus.Text.new_from_string("Preferences") pref_tooltip = pref_label help_label = IBus.Text.new_from_string("Help") help_tooltip = help_label pref_button = IBus.Property.new(key="preferences", type=IBus.PropType.NORMAL, label=pref_label, icon="preferences-other", tooltip=pref_tooltip, sensitive=True, visible=True, state=0, prop_list=None) help_button = IBus.Property.new(key="help", type=IBus.PropType.NORMAL, label=help_label, icon="system-help", tooltip=help_tooltip, sensitive=True, visible=True, state=0, prop_list=None) mode_label = INPUT_MODE[self.engine.vietnameseMode]["label"] mode_symbol = INPUT_MODE[self.engine.vietnameseMode]["symbol"] mode_tooltip = IBus.Text.new_from_string("Switch input mode") self.input_mode_prop = IBus.Property(key='InputMode', prop_type=IBus.PropType.NORMAL, label=mode_label, symbol=mode_symbol, icon='', tooltip=mode_tooltip, sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self.prop_list.append(self.input_mode_prop) self.prop_list.append(pref_button) self.prop_list.append(help_button) self.engine.register_properties(self.prop_list)
def setup_tool_buttons(self): self.prop_list = IBus.PropList() pref_label = IBus.Text.new_from_string("Preferences") pref_tooltip = pref_label help_label = IBus.Text.new_from_string("Help") help_tooltip = help_label pref_button = IBus.Property.new(key="preferences", type=IBus.PropType.NORMAL, label=pref_label, icon="preferences-other", tooltip=pref_tooltip, sensitive=True, visible=True, state=0, prop_list=None) help_button = IBus.Property.new(key="help", type=IBus.PropType.NORMAL, label=help_label, icon="system-help", tooltip=help_tooltip, sensitive=True, visible=True, state=0, prop_list=None) self.input_mode_prop = IBus.Property( key='InputMode', prop_type=IBus.PropType.MENU, label=IBus.Text.new_from_string("BoGo"), symbol=IBus.Text.new_from_string("ấ"), icon='', tooltip=IBus.Text.new_from_string("Switch input mode"), sensitive=True, visible=True, state=IBus.PropState.UNCHECKED, sub_props=None) self.prop_list.append(self.input_mode_prop) self.prop_list.append(pref_button) self.prop_list.append(help_button)
def __init__(self): super(EngineSharadaBraille, self).__init__() self.pressed_keys = u"" Config = configparser.ConfigParser() if (Config.read("{}/isb.cfg".format(home_dir)) == []): self.checked_languages = ["english-en", "hindi-hi"] self.simple_mode = 0 self.keycode_map = { 33: "1", 32: "2", 31: "3", 36: "4", 37: "5", 38: "6", 30: "7", 34: "8", 35: "9", 39: "0" } self.key_to_switch_between_languages = 119 self.list_switch_key = 56 self.language_iter = 0 else: self.checked_languages = Config.get('cfg', "checked_languages").split(",") self.simple_mode = int(Config.get('cfg', "simple-mode")) self.keycode_map = {} for key, value in { "dot-1": "1", "dot-2": "2", "dot-3": "3", "dot-4": "4", "dot-5": "5", "dot-6": "6", "punctuation_key": "0", "capitol_switch_key": "8", "letter_deletion_key": "9", "abbreviation_key": "7" }.items(): self.keycode_map[int(Config.get('cfg', key))] = value self.key_to_switch_between_languages = int( Config.get('cfg', "switch_between_languages")) self.list_switch_key = int(Config.get('cfg', "list_switch_key")) self.language_iter = int(Config.get('cfg', "default-language")) #Braille Iter's self.braille_letter_map_pos = 0 #capital switch self.capital_switch = 0 self.capital = 0 self.__is_invalidate = False self.__preedit_string = "" self.__lookup_table = IBus.LookupTable.new(10, 0, True, True) self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="test", icon="ibus-local")) #Load the first language by default self.load_map(self.checked_languages[self.language_iter])
def __init__(self): super(EngineSharadaBraille, self).__init__() self.pressed_keys = u"" Config = configparser.ConfigParser() try: Config.read("{}/isb.cfg".format(home_dir)) self.checked_languages = Config.get('cfg', "checked_languages").split(",") self.simple_mode = int(Config.get('cfg', "simple-mode")) self.keycode_map = {} for key, value in { "dot-1": "1", "dot-2": "2", "dot-3": "3", "dot-4": "4", "dot-5": "5", "dot-6": "6", "dot-7": "7", "dot-8": "8", "punctuation_key": "0", "capitol_switch_key": "c", "letter_deletion_key": "9", "abbreviation_key": "a", "one_hand_skip_key": "o" }.items(): self.keycode_map[int(Config.get('cfg', key))] = value self.key_to_switch_between_languages = int( Config.get('cfg', "switch_between_languages")) self.list_switch_key = int(Config.get('cfg', "list_switch_key")) self.language_iter = int(Config.get('cfg', "default-language")) self.conventional_braille = int( Config.get('cfg', "conventional-braille")) self.liblouis_mode = int(Config.get('cfg', "liblouis-mode")) self.one_hand_mode = int(Config.get('cfg', "one-hand-mode")) self.one_hand_conversion_delay = int( Config.get('cfg', "one-hand-conversion-delay")) * 1 / 1000 self.liblouis_table_list = Config.get( 'cfg', "liblouis-table-list").split(",") except: self.checked_languages = ["english-en", "hindi-hi"] self.simple_mode = 0 self.keycode_map = { 33: "1", 32: "2", 31: "3", 36: "4", 37: "5", 38: "6", 44: "7", 52: "8", 30: "a", 34: "c", 35: "9", 39: "0" } self.key_to_switch_between_languages = 119 self.list_switch_key = 56 self.language_iter = 0 self.conventional_braille = False self.one_hand_mode = False self.one_hand_conversion_delay = 0.5 self.liblouis_mode = False self.liblouis_table_list = ['unicode.dis', 'en-us-g2.ctb'] self.conventional_braille_dot_4 = False self.conventional_braille_dot_4_pass = False self.conventional_braille_dot_3 = False #Three dot braille self.three_dot_pos = 1 #Braille Iter's self.braille_letter_map_pos = 0 #capital switch self.capital_switch = 0 self.capital = 0 self.__is_invalidate = False self.__preedit_string = "" self.__lookup_table = IBus.LookupTable.new(10, 0, True, True) self.__prop_list = IBus.PropList() self.__prop_list.append(IBus.Property(key="test", icon="ibus-local")) #Load the first language by default self.load_map(self.checked_languages[self.language_iter])