in scripts/ui/common.py [0:0]
def update_buttons(parent, gb, ignore=None):
"""Enables buttons and dropdowns according to whether or not data is present on the specified tab.
Args:
parent (App(QDialog)): Object corresponding to the parent UI element.
gb (QtWidgets.QGroupBox): Group box for the tab.
ignore (list[QtWidgets.QGroupBox], optional): Buttons to not update.
Returns:
tuple[bool, bool, bool]: Whether or not the UI is currently running a process and if it
has all its dropdowns.
"""
if not ignore:
ignore = []
has_all_dropdowns = True
for dd in gb.findChildren(QtWidgets.QComboBox):
if not dd.currentText() and dd not in ignore:
has_all_dropdowns = False
break
has_all_values = True
for v in gb.findChildren(QtWidgets.QLineEdit):
if v.objectName() and not v.text() and v not in ignore:
has_all_values = False
break
is_running = parent.log_reader.is_running()
for btn in gb.findChildren(QtWidgets.QPushButton):
btn_name = btn.objectName()
if btn in ignore:
continue
if btn_name.endswith("_run"):
btn.setEnabled(not is_running and has_all_dropdowns and has_all_values)
elif btn_name.endswith("_cancel"):
btn.setEnabled(is_running)
elif btn_name.endswith("_threshs"):
btn.setEnabled(not is_running and has_all_dropdowns)
elif btn_name.endswith("_view"):
btn.setEnabled(not is_running)
elif btn_name.endswith("_download_meshes"):
btn.setEnabled(not is_running)
return is_running, has_all_dropdowns, is_running