This commit is contained in:
恍兮惚兮 2024-07-17 16:10:17 +08:00
parent 3ccebc1ddd
commit 805d67b185
2 changed files with 12 additions and 9 deletions

View File

@ -23,6 +23,7 @@ from myutils.utils import (
find_or_create_uid, find_or_create_uid,
checkpostusing, checkpostusing,
stringfyerror, stringfyerror,
targetmod,
) )
from myutils.wrapper import threader from myutils.wrapper import threader
from gui.showword import searchwordW from gui.showword import searchwordW
@ -119,7 +120,7 @@ class MAINUI:
class klass(kls): class klass(kls):
@property @property
def using(self): def using(self):
if 'using_X' in dir(self): if "using_X" in dir(self):
try: try:
return self.using_X return self.using_X
except: except:
@ -1188,7 +1189,7 @@ class MAINUI:
def parsedefaultfont(self): def parsedefaultfont(self):
for k in ["fonttype", "fonttype2", "settingfonttype"]: for k in ["fonttype", "fonttype2", "settingfonttype"]:
if globalconfig[k] == "": if globalconfig[k] == "":
l = "ja" if k=="fonttype" else getlanguse() l = "ja" if k == "fonttype" else getlanguse()
set_font_default(l, k) set_font_default(l, k)
# globalconfig[k] = QFontDatabase.systemFont( # globalconfig[k] = QFontDatabase.systemFont(
# QFontDatabase.SystemFont.GeneralFont # QFontDatabase.SystemFont.GeneralFont
@ -1197,6 +1198,7 @@ class MAINUI:
def loadui(self): def loadui(self):
self.installeventfillter() self.installeventfillter()
self.parsedefaultfont() self.parsedefaultfont()
self.loadmetadatas()
self.translation_ui = QUnFrameWindow() self.translation_ui = QUnFrameWindow()
self.translation_ui.show() self.translation_ui.show()
self.translation_ui.aftershowdosomething() self.translation_ui.aftershowdosomething()
@ -1256,6 +1258,14 @@ class MAINUI:
self.__filter = WindowEventFilter() # keep ref self.__filter = WindowEventFilter() # keep ref
QApplication.instance().installEventFilter(self.__filter) QApplication.instance().installEventFilter(self.__filter)
def loadmetadatas(self):
for k in globalconfig["metadata"]:
try:
targetmod[k] = importlib.import_module(f"metadata.{k}").searcher(k)
except:
print_exc()
def checklang(self): def checklang(self):
if globalconfig["language_setted_2.4.5"] == False: if globalconfig["language_setted_2.4.5"] == False:

View File

@ -655,13 +655,6 @@ class LRUCache:
self.put(key) self.put(key)
return _ return _
for k in globalconfig["metadata"]:
try:
targetmod[k] = importlib.import_module(f"metadata.{k}").searcher(k)
except:
print_exc()
globalcachedmodule = {} globalcachedmodule = {}