| 3344 | |
| 3345 | |
| 3346 | class LoadRCinTable(threading.Thread): |
| 3347 | def __init__(self, cbTS, RCinTable): |
| 3348 | threading.Thread.__init__(self) |
| 3349 | self.cbTS = cbTS |
| 3350 | self.RCinTable = RCinTable |
| 3351 | self.rcinFileList = ([ |
| 3352 | "checj.json", "mscj3.json", "mscj3-ext.json", "cj-ext.json", "cnscj.json", "thcj.json", "newcj3.json", "cj5.json", "newcj.json", "scj6.json", "cj-fast.json", |
| 3353 | "thphonetic.json", "CnsPhonetic.json", "bpmf.json", |
| 3354 | "tharray.json", "array30.json", "ar30-big.json", "array40.json", |
| 3355 | "thdayi.json", "dayi4.json", "dayi3.json", |
| 3356 | "ez.json", "ezsmall.json", "ezmid.json", "ezbig.json", |
| 3357 | "thpinyin.json", "pinyin.json", "roman.json", |
| 3358 | "simplecj.json", "simplex.json", "simplex5.json", |
| 3359 | "liu.json" |
| 3360 | ]) |
| 3361 | |
| 3362 | def run(self): |
| 3363 | if DEBUG_MODE: |
| 3364 | self.cbTS.debug.setStartTimer("LoadRCinTable") |
| 3365 | |
| 3366 | self.RCinTable.loading = True |
| 3367 | selCinFile = self.rcinFileList[self.cbTS.cfg.selRCinType] |
| 3368 | jsonPath = os.path.join(self.cbTS.jsondir, selCinFile) |
| 3369 | |
| 3370 | if self.RCinTable.cin is not None and hasattr(self.RCinTable.cin, '__del__'): |
| 3371 | self.RCinTable.cin.__del__() |
| 3372 | |
| 3373 | self.RCinTable.cin = None |
| 3374 | |
| 3375 | if os.path.exists(jsonPath): |
| 3376 | self.cbTS.RCinFileNotExist = False |
| 3377 | with io.open(jsonPath, 'r', encoding='utf8') as fs: |
| 3378 | self.RCinTable.cin = RCin(fs, self.cbTS.imeDirName) |
| 3379 | else: |
| 3380 | self.cbTS.RCinFileNotExist = True |
| 3381 | |
| 3382 | self.RCinTable.curCinType = self.cbTS.cfg.selRCinType |
| 3383 | self.RCinTable.loading = False |
| 3384 | |
| 3385 | if DEBUG_MODE: |
| 3386 | self.cbTS.debug.setEndTimer("LoadRCinTable") |
| 3387 | self.cbTS.debugLog[time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + " [R]"] = self.cbTS.debug.info['brand'] + ":「" + self.cbTS.debug.jsonNameDict[selCinFile] + "」反查碼表載入時間約為 " + self.cbTS.debug.getDurationTime("LoadRCinTable") + " 秒" |
| 3388 | |
| 3389 | |
| 3390 | class LoadHCinTable(threading.Thread): |