51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
from PyQt5 import QtWidgets, QtGui
|
|
from PyQt5.QtWidgets import QWidget, QSizePolicy, QVBoxLayout, QDoubleSpinBox, QMessageBox
|
|
|
|
from app_config import AppCfg #option, toggle_option
|
|
|
|
|
|
def toggle_warn(key):
|
|
toggle_option(key)
|
|
m = f"Option {key} => {option(key)}"
|
|
QMessageBox.warning(None, m, m)
|
|
|
|
def horiz_spacer():
|
|
spacer = QWidget()
|
|
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|
return spacer
|
|
|
|
|
|
def toggle_visibility(widget, state):
|
|
if state:
|
|
widget.show()
|
|
else:
|
|
widget.hide()
|
|
|
|
|
|
def get_sep_line():
|
|
line = QtWidgets.QFrame()
|
|
line.setFixedHeight(2)
|
|
line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
return line
|
|
|
|
|
|
def check_font_by_id(id):
|
|
for family in QtGui.QFontDatabase.applicationFontFamilies(id):
|
|
print(family)
|
|
|
|
|
|
def toggle_groupbox(gbox, state):
|
|
widget = gbox.layout().itemAt(0).widget()
|
|
widget.setVisible(state)
|
|
|
|
def add_item_to_toolbox(toolbox, label, widget_list=[]):
|
|
block = QWidget()
|
|
block.setAccessibleName(label)
|
|
block.setContentsMargins(0, 0, 0, 0)
|
|
block.setLayout(QVBoxLayout())
|
|
for w in widget_list:
|
|
block.layout().addWidget(w)
|
|
block.layout().addStretch()
|
|
item = toolbox.addItem(block, label)
|
|
return item |