Пример #1
0
    def setup(self):
        config = {
            "input-method": "telex",
            "output-charset": "utf-8",
            "skip-non-vietnamese": True,
            "auto-capitalize-abbreviations": False,
            "input-method-definition": {
                "a": "a^",
                "o": "o^",
                "e": "e^",
                "w": ["u*", "o*", "a+", "<ư"],
                "d": "d-",
                "f": "\\",
                "s": "/",
                "r": "?",
                "x": "~",
                "j": ".",
                "]": "<ư",
                "[": "<ơ",
                "}": "<Ư",
                "{": "<Ơ"
            },
        }

        self.eng = BaseBackend(
            config=config,
            abbr_expander=AbbreviationExpander(config),
            auto_corrector=None)
Пример #2
0
    def __init__(self, exec_by_ibus):
        engine_name = "bogo"
        long_engine_name = "BoGo"
        author = "BoGo Development Team <*****@*****.**>"
        description = "ibus-bogo for IBus"
        version = "0.4"
        license = "GPLv3"

        self.component = \
            IBus.Component.new("org.freedesktop.IBus.BoGo",
                               description,
                               version,
                               license,
                               author,
                               "https://github.com/BoGoEngine/ibus-bogo",
                               "/usr/bin/exec",
                               "ibus-bogo")

        engine = IBus.EngineDesc(
            name=engine_name,
            longname=long_engine_name,
            description=description,
            language="vi",
            license=license,
            author=author,
            icon=current_path + "/data/ibus-bogo-dev.svg",
            # icon = "ibus-bogo",
            layout="default")

        self.component.add_engine(engine)
        self.mainloop = GObject.MainLoop()
        self.bus = IBus.Bus()
        self.bus.connect("disconnected", self.bus_disconnected_cb)

        self.engine_count = 0
        self.factory = IBus.Factory.new(self.bus.get_connection())
        self.factory.connect("create-engine", self.create_engine)

        CONFIG_DIR = os.path.expanduser("~/.config/ibus-bogo/")
        self.config = Config()
        self.abbr_expander = AbbreviationExpander(config=self.config)
        self.abbr_expander.watch_file(CONFIG_DIR + "/abbr_rules.json")

        if exec_by_ibus:
            self.bus.request_name("org.freedesktop.IBus.BoGo", 0)
        else:
            self.bus.register_component(self.component)
            self.bus.set_global_engine_async("bogo", -1, None, None, None)
        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')

        self.auto_corrector = AutoCorrector(self.config, spellchecker,
                                            english_spellchecker)
Пример #3
0
    def __init__(self, exec_by_ibus):
        engine_name = "bogo"
        long_engine_name = "BoGo"
        author = "BoGo Development Team <*****@*****.**>"
        description = "ibus-bogo for IBus"
        version = "0.4"
        license = "GPLv3"

        self.component = \
            IBus.Component.new("org.freedesktop.IBus.BoGo",
                               description,
                               version,
                               license,
                               author,
                               "https://github.com/BoGoEngine/ibus-bogo",
                               "/usr/bin/exec",
                               "ibus-bogo")

        engine = IBus.EngineDesc(name=engine_name,
                                 longname=long_engine_name,
                                 description=description,
                                 language="vi",
                                 license=license,
                                 author=author,
                                 icon=current_path + "/data/ibus-bogo-dev.svg",
                                 # icon = "ibus-bogo",
                                 layout="default")

        self.component.add_engine(engine)
        self.mainloop = GObject.MainLoop()
        self.bus = IBus.Bus()
        self.bus.connect("disconnected", self.bus_disconnected_cb)

        self.engine_count = 0
        self.factory = IBus.Factory.new(self.bus.get_connection())
        self.factory.connect("create-engine", self.create_engine)

        CONFIG_DIR = os.path.expanduser("~/.config/ibus-bogo/")
        self.config = Config()
        self.abbr_expander = AbbreviationExpander(config=self.config)
        self.abbr_expander.watch_file(CONFIG_DIR + "/abbr_rules.json")
        self.icon = TrayIcon()

        if exec_by_ibus:
            self.bus.request_name("org.freedesktop.IBus.BoGo", 0)
        else:
            self.bus.register_component(self.component)
            self.bus.set_global_engine_async(
                "bogo", -1, None, None, None)
Пример #4
0
 def setup(self):
     self.config = {"auto-capitalize-expansion": False}
     self.abbr = AbbreviationExpander(config=self.config)