Added settings dialog with loglevel
This commit is contained in:
27
src/bedit_gui/services/application_settings.py
Normal file
27
src/bedit_gui/services/application_settings.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from PySide6.QtCore import QSettings
|
||||
|
||||
|
||||
class ApplicationSettings:
|
||||
"""Typed access to persistent BEdit application settings."""
|
||||
|
||||
LOG_LEVEL_KEY = "logging/level"
|
||||
DEFAULT_LOG_LEVEL = logging.INFO
|
||||
|
||||
def __init__(self, settings: QSettings | None = None) -> None:
|
||||
self._settings = settings if settings is not None else QSettings()
|
||||
|
||||
@property
|
||||
def log_level(self) -> int:
|
||||
return self._settings.value(
|
||||
self.LOG_LEVEL_KEY,
|
||||
self.DEFAULT_LOG_LEVEL,
|
||||
type=int,
|
||||
)
|
||||
|
||||
@log_level.setter
|
||||
def log_level(self, level: int) -> None:
|
||||
self._settings.setValue(self.LOG_LEVEL_KEY, level)
|
||||
Reference in New Issue
Block a user