config

Module Contents

Theme

Theme enumeration

ConfigValidator

Config validator

RangeValidator

Range validator

OptionsValidator

Options validator

BoolValidator

Boolean validator

FolderValidator

Folder validator

FolderListValidator

Folder list validator

ColorValidator

RGB color validator

ConfigSerializer

Config serializer

EnumSerializer

enumeration class serializer

ColorSerializer

QColor serializer

ConfigItem

Config item

RangeConfigItem

Config item of range

OptionsConfigItem

Config item with options

ColorConfigItem

Color config item

QConfig

Config of app

isDarkTheme()

whether the theme is dark mode

theme()

get theme mode

ALERT = Multiline-String
Show Value
"""
📢 Tips: QFluentWidgets Pro is now released. Click https://qfluentwidgets.com/pages/pro to learn more about it.
"""
class Theme

Bases: enum.Enum

Theme enumeration

LIGHT = 'Light'
DARK = 'Dark'
AUTO = 'Auto'
class ConfigValidator

Config validator

validate(value)

Verify whether the value is legal

correct(value)

correct illegal value

class RangeValidator(min, max)

Bases: ConfigValidator

Range validator

validate(value)

Verify whether the value is legal

correct(value)

correct illegal value

class OptionsValidator(options)

Bases: ConfigValidator

Options validator

validate(value)

Verify whether the value is legal

correct(value)

correct illegal value

class BoolValidator

Bases: OptionsValidator

Boolean validator

class FolderValidator

Bases: ConfigValidator

Folder validator

validate(value)

Verify whether the value is legal

correct(value)

correct illegal value

class FolderListValidator

Bases: ConfigValidator

Folder list validator

validate(value)

Verify whether the value is legal

correct(value: List[str])

correct illegal value

class ColorValidator(default)

Bases: ConfigValidator

RGB color validator

validate(color)

Verify whether the value is legal

correct(value)

correct illegal value

class ConfigSerializer

Config serializer

serialize(value)

serialize config value

deserialize(value)

deserialize config from config file’s value

class EnumSerializer(enumClass)

Bases: ConfigSerializer

enumeration class serializer

serialize(value)

serialize config value

deserialize(value)

deserialize config from config file’s value

class ColorSerializer

Bases: ConfigSerializer

QColor serializer

serialize(value: PyQt5.QtGui.QColor)

serialize config value

deserialize(value)

deserialize config from config file’s value

class ConfigItem(group, name, default, validator=None, serializer=None, restart=False)

Bases: PyQt5.QtCore.QObject

Config item

property value

get the value of config item

property key

get the config key separated by .

valueChanged
__str__()
serialize()
deserializeFrom(value)
class RangeConfigItem(group, name, default, validator=None, serializer=None, restart=False)

Bases: ConfigItem

Config item of range

property range

get the available range of config

__str__()
class OptionsConfigItem(group, name, default, validator=None, serializer=None, restart=False)

Bases: ConfigItem

Config item with options

property options
__str__()
class ColorConfigItem(group, name, default, restart=False)

Bases: ConfigItem

Color config item

__str__()
class QConfig

Bases: PyQt5.QtCore.QObject

Config of app

property theme

get theme mode, can be Theme.Light or Theme.Dark

appRestartSig
themeChanged
themeChangedFinished
themeColorChanged
themeMode
themeColor
get(item)

get the value of config item

set(item, value, save=True, copy=True)

set the value of config item

Parameters

item: ConfigItem

config item

value:

the new value of config item

save: bool

whether to save the change to config file

copy: bool

whether to deep copy the new value

toDict(serialize=True)

convert config items to dict

save()

save config

load(file=None, config=None)

load config

Parameters

file: str or Path

the path of json config file

config: Config

config object to be initialized

qconfig
isDarkTheme()

whether the theme is dark mode

theme()

get theme mode