Commit 3f0a9cc4 authored by Yan's avatar Yan
Browse files

Changed DRL window type to main window

* solves the annoying default button Qt5 feature
parent 00b658c2
......@@ -83,7 +83,7 @@ def main():
tools_menu.addAction('&TSQ zce', lambda: zce.dialog(
main_window, ds, filename), QtCore.Qt.CTRL + QtCore.Qt.Key_T)
tools_menu.addAction('&DRL..', lambda: drl.dialog(
tools_menu.addAction('&DRL..', lambda: drl.main_window(
main_window, ds, filename, drlcache),
QtCore.Qt.CTRL + QtCore.Qt.Key_D)
......@@ -325,14 +325,19 @@ def export_drlspectrum(parent, fn, ptable, dtable, ds):
def dialog(parent, ds, filename, cache):
def main_window(parent, ds, filename, cache):
"""constructs a dialog window"""
def savecache(cache,pt,dt,canvas):
def saveonclose(window, event, cache,pt,dt,canvas):
cache[0], cache[1], cache[2] = pt, dt, canvas
QtWidgets.QMainWindow.closeEvent(window, event)
dial_widget = QtWidgets.QDialog(
main_window = QtWidgets.QMainWindow(
parent, windowTitle='Delayed reactant labelling')
dial_widget = QtWidgets.QWidget(main_window)
main_window.closeEvent = lambda event: saveonclose(
main_window, event, cache, pt, dt, graph_canvas)
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
chromplot = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
......@@ -381,8 +386,7 @@ def dialog(parent, ds, filename, cache):
pt, dt, dial_widget))
drl_export.clicked.connect(lambda: export_drlspectrum(
dial_widget, filename, pt, dt, ds))
dial_widget.finished.connect(lambda: savecache(
cache, pt, dt, graph_canvas))
main_layout = QtWidgets.QVBoxLayout(dial_widget)
sub_layout = QtWidgets.QHBoxLayout()
......@@ -413,4 +417,4 @@ def dialog(parent, ds, filename, cache):
tablelayout.addWidget(QtWidgets.QLabel("Corrected ions table:"))
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