根据配置加载主题 :param cls: :param parent:
(cls)
| 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): |