add epics widgets, CustomROI

This commit is contained in:
2022-07-14 15:10:49 +02:00
parent 98297263bc
commit 7445a5aae6
8 changed files with 1694 additions and 0 deletions

51
qutilities.py Normal file
View File

@@ -0,0 +1,51 @@
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QWidget, QSizePolicy, QVBoxLayout, QDoubleSpinBox, QMessageBox
from app_config import 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