MCPcopy Create free account
hub / github.com/EasyIME/PIME / checkConfigChange

Method checkConfigChange

python/cinbase/__init__.py:3187–3261  ·  view source on GitHub ↗
(self, cbTS, CinTable, RCinTable, HCinTable)

Source from the content-addressed store, hash-verified

3185
3186 # 檢查設定檔是否有被更改,是否需要套用新設定
3187 def checkConfigChange(self, cbTS, CinTable, RCinTable, HCinTable):
3188 cfg = cbTS.cfg # 所有 TextService 共享一份設定物件
3189 cfg.update() # 更新設定檔狀態
3190 reLoadCinTable = False
3191 updateExtendTable = False
3192
3193 if hasattr(cbTS, 'cin'):
3194 if hasattr(cbTS.cin, 'cincount'):
3195 if not os.path.exists(cbTS.cin.getCountFile()):
3196 cbTS.cin.saveCountFile()
3197
3198 # 如果有更換輸入法碼表,就重新載入碼表資料
3199 if not CinTable.loading:
3200 if not CinTable.curCinType == cfg.selCinType:
3201 reLoadCinTable = True
3202
3203 if not CinTable.ignorePrivateUseArea == cfg.ignorePrivateUseArea:
3204 reLoadCinTable = True
3205
3206 if cfg.reLoadTable:
3207 updateExtendTable = True
3208 reLoadCinTable = True
3209 cfg.reLoadTable = False
3210 cfg.save()
3211
3212 if not CinTable.userExtendTable == cfg.userExtendTable:
3213 updateExtendTable = True
3214 reLoadCinTable = True
3215
3216 if not CinTable.priorityExtendTable == cfg.priorityExtendTable:
3217 if cfg.userExtendTable:
3218 reLoadCinTable = True
3219
3220 if cfg.imeReverseLookup or cbTS.imeReverseLookup:
3221 # 載入反查輸入法碼表
3222 if not RCinTable.loading and not CinTable.loading:
3223 if not RCinTable.curCinType == cfg.selRCinType or RCinTable.cin is None:
3224 loadRCinFile = LoadRCinTable(cbTS, RCinTable)
3225 loadRCinFile.start()
3226
3227 if cfg.homophoneQuery or cbTS.homophoneQuery:
3228 # 載入同音字碼表
3229 if not HCinTable.loading and not CinTable.loading:
3230 if not HCinTable.curCinType == cfg.selHCinType or HCinTable.cin is None:
3231 loadHCinFile = LoadHCinTable(cbTS, HCinTable)
3232 loadHCinFile.start()
3233
3234 # 比較我們先前存的版本號碼,和目前設定檔的版本號
3235 if cfg.isFullReloadNeeded(cbTS.configVersion):
3236 # 資料改變需整個 reload,重建一個新的 checj context
3237 self.initCinBaseContext(cbTS)
3238 elif cfg.isConfigChanged(cbTS.configVersion):
3239 # 只有偵測到設定檔變更,需要套用新設定
3240 self.applyConfig(cbTS)
3241
3242 if reLoadCinTable or updateExtendTable:
3243 datadirs = (cfg.getConfigDir(), cfg.getDataDir())
3244 if updateExtendTable:

Callers

nothing calls this directly

Calls 15

initCinBaseContextMethod · 0.95
applyConfigMethod · 0.95
extendtableClass · 0.90
LoadRCinTableClass · 0.85
LoadHCinTableClass · 0.85
LoadCinTableClass · 0.85
getCountFileMethod · 0.80
saveCountFileMethod · 0.80
saveDebugLogMethod · 0.80
updateMethod · 0.45
saveMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected