Source code for prsctrl_gui.gui.widgets.settings.app_settings

"""`.AppSettings`: Application settings widget for prsctrl_gui"""
from ....utility.config import AppConfig
from devctrl.gui.widgets.settings import SettingsWidget, StyleInfo
from PyQt6.QtWidgets import QLabel, QWidget, QVBoxLayout, QSizePolicy



[docs] class AppSettings(QWidget): """Application settings for prsctrl_gui. Internally uses a :class:`.SettingsWidget` showing the :class:`.AppConfig` dataclass."""
[docs] def __init__(self): super().__init__() self.l_main = QVBoxLayout() self.setLayout(self.l_main) self.l_header = QLabel(self.tr("The following two variables can be used with placeholders in a path, e.g. <tt>&#3C;CONFIG_DIR&#3E;/some-file.yaml</tt>. <tt>CONFIG_DIR</tt> and <tt>CACHE_DIR</tt> must be set with environment variables <tt>PRSCTRL_GUI_CONFIG</tt> and <tt>PRSCTRL_GUI_CACHE</tt>.")) self.l_header.setWordWrap(True) self.l_CONFIG_DIR = QLabel(f"CONFIG_DIR: {AppConfig.CONFIG_DIR}") self.l_CACHE_DIR = QLabel(f"CACHE_DIR: {AppConfig.CACHE_DIR}") self.l_main.addWidget(self.l_header, 0) self.l_main.addWidget(self.l_CONFIG_DIR, 0) self.l_main.addWidget(self.l_CACHE_DIR, 0) info = StyleInfo(nest_level=1) # disables the scrollbar self.w_form = SettingsWidget(AppConfig.MAIN_CFG, style_info=info) self.l_main.addWidget(self.w_form, 1) self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)