Esempio n. 1
0
    def __init__(self, client):
        TextService.__init__(self, client)

        # 輸入法模組自訂區域
        self.imeDirName = "checj"
        self.maxCharLength = 5  # 輸入法最大編碼字元數量
        self.cinFileList = [
            "checj.cin", "mscj3.cin", "mscj3-ext.cin", "cj-ext.cin",
            "cnscj.cin", "thcj.cin", "newcj3.cin", "cj5.cin", "newcj.cin",
            "scj6.cin"
        ]

        self.cinbase = CinBase
        self.curdir = os.path.abspath(os.path.dirname(__file__))

        # 初始化輸入行為設定
        self.cinbase.initTextService(self, TextService)

        # 載入用戶設定值
        CinBaseConfig.__init__()
        self.configVersion = CinBaseConfig.getVersion()
        self.cfg = copy.deepcopy(CinBaseConfig)
        self.cfg.imeDirName = self.imeDirName
        self.cfg.cinFileList = self.cinFileList
        self.cfg.load()

        # 載入輸入法碼表
        self.cindir = self.cfg.getCinDir()
        if not CinTable.curCinType == self.cfg.selCinType and not CinTable.loading:
            loadCinFile = LoadCinTable(self, CinTable)
            loadCinFile.start()
        else:
            while CinTable.loading:
                continue
            self.cin = CinTable.cin

        # 反查輸入法字根
        if self.cfg.imeReverseLookup:
            self.imeReverseLookup = self.cfg.imeReverseLookup
            self.rcinFileList = self.cfg.rcinFileList
            self.selRCinType = self.cfg.selRCinType
            if not self.rcinFileList:
                self.cinbase.updateRcinFileList(self)

            if not RCinTable.curCinType == self.cfg.selRCinType and not RCinTable.loading:
                loadRCinFile = LoadRCinTable(self, RCinTable)
                loadRCinFile.start()
            else:
                while RCinTable.loading:
                    continue
                self.rcin = RCinTable.cin
Esempio n. 2
0
    def __init__(self, client):
        TextService.__init__(self, client)

        # 輸入法模組自訂區域
        self.imeDirName = "chephonetic"
        self.maxCharLength = 4  # 輸入法最大編碼字元數量
        self.cinFileList = ["thphonetic.cin", "CnsPhonetic.cin", "bpmf.cin"]

        self.cinbase = CinBase
        self.curdir = os.path.abspath(os.path.dirname(__file__))

        # 初始化輸入行為設定
        self.cinbase.initTextService(self, TextService)

        # 載入用戶設定值
        CinBaseConfig.__init__()
        self.configVersion = CinBaseConfig.getVersion()
        self.cfg = copy.deepcopy(CinBaseConfig)
        self.cfg.imeDirName = self.imeDirName
        self.cfg.cinFileList = self.cinFileList
        self.cfg.load()

        self.keyboardLayout = self.cfg.keyboardLayout
        self.kbtypelist = [
            "1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/-7634",  # standard kb
            "bpmfdtnlvkhg7c,./j;'sexuaorwiqzy890-=1234",  # ET
            "1234567890-qwertyuiopasdfghjkl;zxcvbn/m,.",  # IBM
            "2wsx3edcrfvtgb6yhnujm8ik,9ol.0p;/-['=1qaz"  # Gin-yieh
        ]

        self.zhuintab = [
            "1qaz2wsxedcrfv5tgbyhn",  # ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙ
            "ujm",  # ㄧㄨㄩ
            "8ik,9ol.0p;/-",  # ㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦ
            "7634"  # ˙ˊˇˋ
        ]

        # 載入輸入法碼表
        self.cindir = self.cfg.getCinDir()
        if not CinTable.curCinType == self.cfg.selCinType and not CinTable.loading:
            loadCinFile = LoadCinTable(self, CinTable)
            loadCinFile.start()
        else:
            while CinTable.loading:
                continue
            self.cin = CinTable.cin

        # 反查輸入法字根
        if self.cfg.imeReverseLookup:
            self.imeReverseLookup = self.cfg.imeReverseLookup
            self.rcinFileList = self.cfg.rcinFileList
            self.selRCinType = self.cfg.selRCinType
            if not self.rcinFileList:
                self.cinbase.updateRcinFileList(self)

            if not RCinTable.curCinType == self.cfg.selRCinType and not RCinTable.loading:
                loadRCinFile = LoadRCinTable(self, RCinTable)
                loadRCinFile.start()
            else:
                while RCinTable.loading:
                    continue
                self.rcin = RCinTable.cin

        self.useEndKey = True
        self.autoShowCandWhenMaxChar = True

        self.endKeyList = []
        self.endKey = self.kbtypelist[self.keyboardLayout][-4:]

        for key in self.endKey:
            self.endKeyList.append(key)