Commit 5df8dc21 authored by Yan's avatar Yan
Browse files

DRL - select all button in daughter table

parent 7202be0d
......@@ -312,9 +312,12 @@ def add_line(ds, drls, drlspectrum):
corr_changed(x, ds, drls, drlspectrum)), cors))
ptable_changed(newrow, 1, ds, drls, drlspectrum)
select_all_btn_up(ds, drls, drlspectrum)
checkbox.stateChanged.connect(lambda: update_drlspectrum(
ds, drls, drlspectrum))
checkbox.stateChanged.connect(lambda: select_all_btn_up(
ds, drls, drlspectrum))
def iontable(labels):
......@@ -548,6 +551,25 @@ def key_pressed(event, ds, drls, drlspectrum):
and event.modifiers().__int__() == QtCore.Qt.ControlModifier:
paste_clip(ds, drls, drlspectrum)
def select_all_btn_up(ds, drls, drlspectrum, state=None):
logger.info('''Change of the select-all button detected''')
if state == None:
btns = []
for row in range(drls['dt'].rowCount()):
btns.append(drls['dt'].cellWidget(row, 0).checkState())
if any(btns):
drls['checkAll'].setCheckState(1)
elif all(btns):
drls['checkAll'].setCheckState(2)
else:
drls['checkAll'].setCheckState(0)
if state in (0, 2):
for row in range(drls['dt'].rowCount()):
drls['dt'].cellWidget(row, 0).blockSignals(True)
drls['dt'].cellWidget(row, 0).setCheckState(state)
drls['dt'].cellWidget(row, 0).blockSignals(False)
update_drlspectrum(ds, drls, drlspectrum)
def main_window(parent, ds, filename, cache):
"""constructs a dialog window"""
......@@ -557,7 +579,8 @@ def main_window(parent, ds, filename, cache):
# pt = parenttable
# dt = daughtertable
drls = dict(pt=None, dt=None, tshift=None, cors=3, rel=None)
drls = dict(pt=None, dt=None, tshift=None, cors=3, rel=None,
checkAll=None)
window = QtWidgets.QMainWindow(
parent, windowTitle='Delayed reactant labelling')
......@@ -585,6 +608,8 @@ def main_window(parent, ds, filename, cache):
drls['rel'] = QtWidgets.QCheckBox("Steady state approximation")
drls['checkAll'] = QtWidgets.QCheckBox("Select all")
drl_load = QtWidgets.QPushButton("&Load")
drl_save = QtWidgets.QPushButton("&Save")
drl_export = QtWidgets.QPushButton("&Export")
......@@ -640,6 +665,9 @@ def main_window(parent, ds, filename, cache):
drls['rel'].stateChanged.connect(lambda: update_drlspectrum(
ds, drls, chromplot))
drls['checkAll'].stateChanged.connect(lambda state:
select_all_btn_up(ds, drls, chromplot, state))
main_layout = QtWidgets.QVBoxLayout(main_widget)
sub_layout = QtWidgets.QHBoxLayout()
graph_layout = QtWidgets.QVBoxLayout()
......@@ -677,6 +705,7 @@ def main_window(parent, ds, filename, cache):
tablelayout.addWidget(drls['pt'])
tablelayout.addLayout(pt_butlayout)
tablelayout.addWidget(QtWidgets.QLabel("Corrected ions table:"))
tablelayout.addWidget(drls['checkAll'])
tablelayout.addWidget(drls['dt'])
window.show()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment