Commit 8f724d6a authored by Yan's avatar Yan
Browse files

Update of daughter windows when file is opened

* incorporate through pyqt signals
* ZCE dialog has its own logger now
parent 207a1188
......@@ -22,8 +22,12 @@ import os.path
class update_signal(QtCore.QObject):
signal = QtCore.pyqtSignal()
def load_file(parent, chrom_plot, spc, d_set, ms_s, fn, chrom_s,
settings, filename=None):
update, settings, filename=None):
"""populates dataset and plots it"""
if fn[0] is not None:
......@@ -49,6 +53,7 @@ def load_file(parent, chrom_plot, spc, d_set, ms_s, fn, chrom_s,
fn[0] = filename
parent.setWindowTitle("Prasopes - {}".format(
def update_spectrum(event, chromatogram, spect, ds,
......@@ -95,15 +100,18 @@ def main():
ylabel="total ion count", timesarg=None)
filename = [None]
drlcache = [None, None]
update = update_signal()
config = cf.settings()
p_logger = logging.getLogger('parseLogger')
drl_logger = logging.getLogger('drlLogger')
zce_logger = logging.getLogger('zceLogger')
graph = Figure(figsize=(5, 4), dpi=100, facecolor="None")
grid = graph.add_gridspec(2, 1)
......@@ -142,7 +150,7 @@ def main():
openact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_O)
openact.triggered.connect(lambda: load_file(
main_window, chromatogram, spectrum, ds, ms, filename, chrom,
update, config))
exportact = QtWidgets.QAction(QtGui.QIcon.fromTheme(
"document-save-as"), "&Export...", None)
exportact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
......@@ -159,12 +167,12 @@ def main():
"applications-utilities"), "&TSQ zce...", None)
zceact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_T)
zceact.triggered.connect(lambda: zce.dialog(
main_window, ds, filename))
main_window, ds, filename, update))
drlact = QtWidgets.QAction(QtGui.QIcon.fromTheme(
"applications-utilities"), "&DRL...", None)
drlact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_D)
drlact.triggered.connect(lambda: drl.main_window(
main_window, ds, filename, drlcache))
main_window, ds, filename, drlcache, update))
aboutact = QtWidgets.QAction("&About Prasopes", None)
aboutact.triggered.connect(lambda: about(main_window))
autozoomy = QtWidgets.QAction(QtGui.QIcon.fromTheme(
......@@ -638,12 +638,16 @@ def select_all_btn_up(ds, drls, drlspectrum, state=None):
def main_window(parent, ds, filename, cache):
def main_window(parent, ds, filename, cache, update_signal):
"""constructs a dialog window"""
def saveonclose(widget, event, buffer, drls, canvas):
def onclose(widget, event, buffer, drls, canvas, update_fnc):
buffer[0], buffer[1] = drls, canvas
QtWidgets.QMainWindow.closeEvent(widget, event)
def update_fnc():
update_drlspectrum(ds, drls, chromplot)
# pt = parenttable
# dt = daughtertable
drls = dict(pt=None, dt=None, tshift=None, cutoff=None, cors=None,
......@@ -654,8 +658,8 @@ def main_window(parent, ds, filename, cache):
main_widget = QtWidgets.QWidget(window)
window.closeEvent = lambda event: saveonclose(
window, event, cache, drls, graph_canvas)
window.closeEvent = lambda event: onclose(
window, event, cache, drls, graph_canvas, update_fnc)
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
chromplot = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
......@@ -727,16 +731,14 @@ def main_window(parent, ds, filename, cache):
item.row(), item.column(), ds, drls, chromplot))
drls['dt'].itemChanged.connect(lambda item: dtable_changed(
item.row(), item.column(), ds, drls, chromplot))
drls['tshift'].valueChanged.connect(lambda: update_drlspectrum(
ds, drls, chromplot))
drls['cutoff'].valueChanged.connect(lambda: update_drlspectrum(
ds, drls, chromplot))
drls['cors'].valueChanged.connect(lambda: corcount_changed(
ds, drls, chromplot))
drls['rel'].stateChanged.connect(lambda: update_drlspectrum(
ds, drls, chromplot))
drls['checkAll'].stateChanged.connect(lambda state:
select_all_btn_up(ds, drls, chromplot, state))
actionBar = QtWidgets.QToolBar(window)
window.addToolBar(QtCore.Qt.BottomToolBarArea, actionBar)
......@@ -8,10 +8,15 @@ import prasopes.graphtools as gt
import prasopes.filetools as ft
import os.path
import pkg_resources
import logging
logger = logging.getLogger('zceLogger')
def pop_dial(zcespec, gradspect, data_set, coff_d, grad_d,
textfield, fn, parent):
logger.debug("populating ZCE dialog")
if fn[0] is None:
parent, "ZCE calculation",
......@@ -111,15 +116,27 @@ def print_graph(ds, coff, coffgrad, filename):
def dialog(parent, ds, filename):
def dialog(parent, ds, filename, update_signal):
coff = dict(x=[0], y=[0], line=None, name="",
xlabel="Voltage (V)", ylabel="ion count")
coffgrad = dict(x=[0], y=[0], c_ymin=-0.1, line=None, name="",
xlabel="", ylabel="ion count gradient", gmax=None,
fwhm_x=None, fwhm_y=None, fwhm=None)
def onclose(widget, event, update_fnc):
logger.debug("ZCE window custom close routine called")
QtWidgets.QDialog.closeEvent(widget, event)
def update_fnc():
pop_dial(coffspect, coffspect_grad, ds, coff, coffgrad,
textfield, filename, parent)
dial_widget = QtWidgets.QDialog(
parent, windowTitle='TSQ zero collision energy calculator')
dial_widget.closeEvent = lambda event: onclose(
dial_widget, event, update_fnc)
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
coffspect = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
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