31 lines
960 B
Python
31 lines
960 B
Python
#!/usr/bin/python3
|
|
|
|
from PyQt6.QtCore import Qt
|
|
from PyQt6.QtGui import QFont
|
|
from PyQt6.QtWidgets import QLabel, QSizePolicy, QFormLayout
|
|
|
|
from ..custom_widgets import GroupBox
|
|
|
|
|
|
class SubCategory(GroupBox):
|
|
description_font = QFont()
|
|
description_font.setPointSize(8)
|
|
|
|
def __init__(self, title: str, description: str=None, parent=None):
|
|
super().__init__(title, parent)
|
|
|
|
self.layout = QFormLayout()
|
|
self.setLayout(self.layout)
|
|
|
|
if description is not None:
|
|
self.description = QLabel(description + "\n", self)
|
|
self.layout.addRow(self.description)
|
|
|
|
def add_setting(self, text: str, setting, description: str=None):
|
|
self.layout.addRow(text, setting)
|
|
|
|
if description is not None:
|
|
description_label = QLabel(" " + description.replace("\n", "\n "))
|
|
description_label.setFont(self.description_font)
|
|
self.layout.addRow(description_label)
|
|
|