Commit 36070663 authored by Yan's avatar Yan
Browse files

tofTools - initial commit

* tofTools GUI - 1st part
parent 7fe44ffa
......@@ -25,6 +25,7 @@ import prasopes.imagetools as imgt
import prasopes.zcetools as zce
import prasopes.docks as docks
import prasopes.datasets as datasets
import prasopes.toftools as tt
import prasopes.tangoicons
import sys
import logging
......@@ -347,6 +348,11 @@ def main():
drlact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_D)
drlact.triggered.connect(lambda: drlgui.main_window(
main_window, augCanvas, update))
tofact = QtWidgets.QAction(QtGui.QIcon.fromTheme(
"applications-utilities"), "TO&F...", None)
tofact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_F)
tofact.triggered.connect(lambda: tt.main_window(
main_window, augCanvas, update))
aboutact = QtWidgets.QAction("&About Prasopes", None)
aboutact.triggered.connect(lambda: about(main_window))
autozoomy = QtWidgets.QAction(QtGui.QIcon.fromTheme(
......@@ -399,6 +405,7 @@ def main():
main_window.menuBar().addMenu(tools_menu)
tools_menu.addAction(zceact)
tools_menu.addAction(drlact)
tools_menu.addAction(tofact)
tools_menu.addSeparator()
view_menu = QtWidgets.QMenu('&View', main_window)
[view_menu.addAction(i.action) for i in
......@@ -427,6 +434,7 @@ def main():
toolBar.addSeparator()
toolBar.addAction(zceact)
toolBar.addAction(drlact)
toolBar.addAction(tofact)
toolBar.addSeparator()
toolBar.addAction(autozoomy)
......
......@@ -34,6 +34,7 @@ class AugFigureCanvas(FigureCanvas):
name="Chromatogram", xlabel="time(min)", ylabel="total ion count",
timesarg=[])
self.drlcache = [None, None]
self.tofcache = [None, None]
grid = self.figure.add_gridspec(2, 1)
self.chromplot = self.figure.add_subplot(grid[0, 0],
facecolor=(1, 1, 1, 0.8))
......
#!/usr/bin/env python3
from matplotlib.backends.backend_qt5agg import\
FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
import matplotlib
import numpy as np
import prasopes.datatools as dt
import prasopes.graphtools as gt
import prasopes.filetools as ft
import prasopes.config as cf
import prasopes.drltools as drl
import prasopes.imagetools as imgt
import os.path
import logging
matplotlib.use("Qt5Agg")
logger = logging.getLogger('tofLogger')
settings = cf.settings()
def main_window(parent, augCanvas, update_signal):
reactlabels = dict(name="", xlabel="$time (??seconds??)\ \\it→$",
ylabel="$Intensity\ \\it→$")
cache = augCanvas.tofcache
def onclose(widget, event, ionstable, canvas, cache, update_fnc):
logger.debug("custom close routine called")
cache[0], cache[1] = ionstable, canvas
update_signal.signal.disconnect(update_fnc)
QtWidgets.QDialog.closeEvent(widget, event)
def update_fnc():
pop_dial(augCanvas, drls, dialspect, reactlabels, parselect)
dial_widget = QtWidgets.QDialog(
parent, windowTitle='Mobilogram')
dial_widget.closeEvent = lambda event: onclose(
dial_widget, event, update_fnc)
update_signal.signal.connect(update_fnc)
if cache == [None, None]:
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None",
constrained_layout=True)
dialspect = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
graph_canvas = FigureCanvas(dial_graph)
graph_canvas.setStyleSheet("background-color:transparent;")
graph_canvas.setAutoFillBackground(False)
gt.zoom_factory(dialspect, 1.15, reactlabels)
gt.pan_factory(dialspect, reactlabels)
ionstable = dt.table(["Name", "Start time (min)", "End time (min)",
"Mass (m/z)", "Peak width", "Profile"])
else:
ionstable = cache[0]
grpah_canvas = cache[1]
dialspect = graph_canvas.figure.axes[0]
pushbtn = QtWidgets.QPushButton("Update")
#pushbtn.clicked.connect(lambda: update_fnc())
expbtn = QtWidgets.QPushButton("Export")
"""expbtn.clicked.connect(lambda: export_dial(
augCanvas, drls, dialspect, reactlabels, parselect))"""
buttlayout = QtWidgets.QHBoxLayout()
buttlayout.addWidget(pushbtn)
buttlayout.addStretch()
buttlayout.addWidget(expbtn)
#layouts.append(buttlayout)
dial_layout = QtWidgets.QVBoxLayout(dial_widget)
dial_layout.addWidget(graph_canvas, stretch=1)
dial_layout.addWidget(ionstable)
dial_layout.addLayout(buttlayout)
#[dial_layout.addLayout(i) for i in layouts]
dial_widget.setFocus()
dial_widget.show()
#update_fnc()
Markdown is supported
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