Commit e3e3a6c7 authored by Yan's avatar Yan
Browse files

inital DRL commit - GUI layout

parent 9b136e52
......@@ -9,6 +9,7 @@ from rawprasslib import load_raw
import prasopes.graphtools as gt
import prasopes.filetools as ft
import prasopes.zcetools as zce
import prasopes.drltools as drl
import sys
import matplotlib
import logging
......@@ -82,6 +83,8 @@ def main():
main_window.menuBar().addMenu(tools_menu)
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(
main_window, ds, filename), QtCore.Qt.CTRL + QtCore.Qt.Key_D)
main_widget = QtWidgets.QWidget(main_window)
main_window.setCentralWidget(main_widget)
......
#!/usr/bin/env python3
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.widgets import SpanSelector
from PyQt5 import QtCore
from PyQt5 import QtWidgets
import sys
import matplotlib
import numpy as np
matplotlib.use("Qt5Agg")
class HBar(QtWidgets.QFrame):
def __init__(self):
super(HBar, self).__init__()
self._main = QtWidgets.QWidget()
self.setFrameShape(QtWidgets.QFrame.HLine)
def dialog(parent, ds, filename):
dial_widget = QtWidgets.QDialog(parent)
dial_widget.setWindowTitle('Delayed reactant labelling')
dial_graph = Figure(figsize=(5,2),dpi=100)
dial_graph.patch.set_facecolor("None")
chromatogram = 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)
drl_layout = QtWidgets.QVBoxLayout(dial_widget)
drl_sublayout = QtWidgets.QHBoxLayout()
drl_layout.addLayout(drl_sublayout)
drl_layout.addWidget(HBar())
drl_tablelayout = QtWidgets.QVBoxLayout()
drl_butlayout = QtWidgets.QHBoxLayout()
drl_load = QtWidgets.QPushButton("Load")
drl_save = QtWidgets.QPushButton("Save")
drl_export = QtWidgets.QPushButton("Export")
drl_cancel = QtWidgets.QPushButton("Cancel")
drl_layout.addLayout(drl_butlayout)
drl_butlayout.addWidget(drl_load)
drl_butlayout.addWidget(drl_save)
drl_butlayout.addStretch(1)
drl_butlayout.addWidget(drl_export)
drl_butlayout.addWidget(drl_cancel)
parenttable = QtWidgets.QTableWidget()
parenttable.setSizePolicy(QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding)
parenttable.setRowCount(5)
parenttable.setColumnCount(3)
parenttable.setHorizontalHeaderLabels(["start (m/z)", "end (m/z)", "intensity"])
cw = parenttable.columnWidth(0)+parenttable.columnWidth(1)+parenttable.columnWidth(2)\
+parenttable.verticalHeader().width() + parenttable.verticalScrollBar().height()
parenttable.setMinimumSize(cw,0)
parenttable.horizontalHeader().setSectionResizeMode(2,QtWidgets.QHeaderView.Stretch)
parenttable.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
parenttable.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
pt_butlayout = QtWidgets.QHBoxLayout()
pt_add = QtWidgets.QPushButton("Add")
pt_rem = QtWidgets.QPushButton("Remove")
daughtertable = QtWidgets.QTableWidget()
dt_butlayout = QtWidgets.QHBoxLayout()
dt_add = QtWidgets.QPushButton("Add")
dt_rem = QtWidgets.QPushButton("Remove")
drl_sublayout.addWidget(graph_canvas)
drl_sublayout.addLayout(drl_tablelayout)
drl_tablelayout.addWidget(QtWidgets.QLabel("Raw ions table:"))
drl_tablelayout.addWidget(parenttable)
drl_tablelayout.addLayout(pt_butlayout)
pt_butlayout.addWidget(pt_add)
pt_butlayout.addWidget(pt_rem)
pt_butlayout.addStretch(1)
drl_tablelayout.addWidget(HBar())
drl_tablelayout.addWidget(QtWidgets.QLabel("Corrected ions table:"))
drl_tablelayout.addWidget(daughtertable)
drl_tablelayout.addLayout(dt_butlayout)
dt_butlayout.addWidget(dt_add)
dt_butlayout.addWidget(dt_rem)
dt_butlayout.addStretch(1)
dial_widget.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