MCPcopy Create free account
hub / github.com/PyQt5/PyQtClient / loadTheme

Method loadTheme

Utils/ThemeManager.py:276–295  ·  view source on GitHub ↗

根据配置加载主题 :param cls: :param parent:

(cls)

Source from the content-addressed store, hash-verified

274
275 @classmethod
276 def loadTheme(cls):
277 """根据配置加载主题
278 :param cls:
279 :param parent:
280 """
281 ThemeManager.ThemeName = Setting.value('theme', 'Default', str)
282 # 加载主题中的字体
283 path = cls.fontPath()
284 AppLog.info('fontPath: {}'.format(path))
285 if os.path.isfile(path):
286 QFontDatabase.addApplicationFont(path)
287 # 加载主题取样式
288 path = cls.stylePath()
289 AppLog.info('stylePath: {}'.format(path))
290 try:
291 QApplication.instance().setStyleSheet(
292 open(path, 'rb').read().decode('utf-8', errors='ignore'))
293 return 1
294 except Exception as e:
295 AppLog.exception(e)
296
297 @classmethod
298 def loadFont(cls):

Callers 6

loadUserThemeMethod · 0.80
_initUiMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
TestSkinDialog.pyFile · 0.80

Calls 3

fontPathMethod · 0.80
stylePathMethod · 0.80
valueMethod · 0.45

Tested by 2

__init__Method · 0.64
__init__Method · 0.64