Wed, 08 Dec 2021 19:52:00 +0100
Started implementing a manager for color themes.
# -*- coding: utf-8 -*- # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing a manager object for color themes. """ import re from PyQt6.QtCore import QObject import Preferences class ThemeManager(QObject): """ Class implementing a manager object for color themes. """ KeyPatternList = [ "Diff/.*Color", "Editor/Colour/", "IRC/.*Colou?r", "Project/Colour", "Scintilla/.*color", "Scintilla/.*paper", "WebBrowser/.*Colou?r", ] KeyList = [ "Debugger/BgColorChanged", "Debugger/BgColorNew", "UI/IconBarColor", "UI/LogStdErrColour", "UI/NotificationCriticalBackground", "UI/NotificationCriticalForeground", "UI/NotificationWarningBackground", "UI/NotificationWarningForeground", ] def __init__(self, parent=None): """ Constructor @param parent reference to the parent object (defaults to None) @type QObject (optional) """ super().__init__(parent) def importTheme(self): """ Public method to import a theme file and set the colors. """ # TODO: not yet implemented def exportTheme(self): """ Public method to export the current colors to a theme file. """ # TODO: not yet implemented settings = Preferences.getSettings() keyFilterRe = re.compile("|".join( ThemeManager.KeyPatternList + ThemeManager.KeyList)) keys = [k for k in settings.allKeys() if keyFilterRe.match(k)] themeDict = {} for key in keys: themeDict[key] = settings.value(key) # TODO: save to a json file *.ethj