def __init__(self, config, abbr_expander, icon): super().__init__() self.config = config self.icon = icon self.ui_delegate = UiDelegate(engine=self) self.preedit_backend = PreeditBackend(engine=self, config=config, abbr_expander=abbr_expander) self.surrounding_text_backend = SurroundingTextBackend( engine=self, config=config, abbr_expander=abbr_expander) self.backend = self.preedit_backend # Create a new thread to detect mouse clicks # mouse_detector = MouseDetector.get_instance() # mouse_detector.add_mouse_click_listener(self.reset) self.caps = 0 self.vietnameseMode = True self.reset()
def setup(self): self.engine = Mock() self.config = {"skip-non-vietnamese": True} self.abbr_expander = Mock() self.auto_corrector = Mock() self.backend = PreeditBackend(engine=self.engine, config=self.config, abbr_expander=self.abbr_expander, auto_corrector=self.auto_corrector)
def __init__(self, config, abbr_expander, auto_corrector): super().__init__() self.caps = 0 self.vietnameseMode = True self.config = config self.ui_delegate = UiDelegate(engine=self) self.preedit_backend = PreeditBackend(engine=self, config=config, abbr_expander=abbr_expander, auto_corrector=auto_corrector) self.surrounding_text_backend = SurroundingTextBackend( engine=self, config=config, abbr_expander=abbr_expander, auto_corrector=auto_corrector) # The preedit backend is the default self.backend = self.preedit_backend self.reset()
def __init__(self, config, abbr_expander): super().__init__() self.caps = 0 self.vietnameseMode = True self.config = config self.ui_delegate = UiDelegate(engine=self) custom_broker = enchant.Broker() custom_broker.set_param('enchant.myspell.dictionary.path', DICT_PATH) spellchecker = enchant.DictWithPWL('vi_VN_telex', pwl=PWL_PATH, broker=custom_broker) # FIXME: Catch enchant.errors.DictNotFoundError exception here. english_spellchecker = enchant.Dict('en_US') auto_corrector = AutoCorrector(config, spellchecker, english_spellchecker) self.preedit_backend = PreeditBackend(engine=self, config=config, abbr_expander=abbr_expander, auto_corrector=auto_corrector) self.surrounding_text_backend = SurroundingTextBackend( engine=self, config=config, abbr_expander=abbr_expander, auto_corrector=auto_corrector) # The preedit backend is the default self.backend = self.preedit_backend self.reset()