Commit 7f3f1b7f authored by Yan's avatar Yan
Browse files

PEP8, renamed objects for higher clarity

parent 29366687
......@@ -38,8 +38,7 @@ def main():
logging.basicConfig()
p_logger.setLevel("WARN")
graph = Figure(figsize=(5, 4), dpi=100)
graph.patch.set_facecolor("None")
graph = Figure(figsize=(5, 4), dpi=100, facecolor="None")
chromatogram = graph.add_subplot(211, facecolor=(1, 1, 1, 0.8))
spectrum = graph.add_subplot(212, facecolor=(1, 1, 1, 0.8))
......@@ -66,8 +65,7 @@ def main():
alpha=0.15, facecolor='purple'), button=3)
app = QtWidgets.QApplication(sys.argv)
main_window = QtWidgets.QMainWindow()
main_window.setWindowTitle("Prasopes")
main_window = QtWidgets.QMainWindow(windowTitle="Prasopes")
file_menu = QtWidgets.QMenu('&File', main_window)
main_window.menuBar().addMenu(file_menu)
......
......@@ -10,6 +10,7 @@ import matplotlib
import numpy as np
matplotlib.use("Qt5Agg")
class HBar(QtWidgets.QFrame):
def __init__(self):
super(HBar, self).__init__()
......@@ -18,62 +19,64 @@ class HBar(QtWidgets.QFrame):
def dialog(parent, ds, filename):
dial_widget = QtWidgets.QDialog(parent)
dial_widget.setWindowTitle('Delayed reactant labelling')
dial_widget = QtWidgets.QDialog(
parent, windowTitle='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))
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
chromplot = 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())
main_layout = QtWidgets.QVBoxLayout(dial_widget)
sub_layout = QtWidgets.QHBoxLayout()
main_layout.addLayout(sub_layout)
main_layout.addWidget(HBar())
drl_tablelayout = QtWidgets.QVBoxLayout()
drl_butlayout = QtWidgets.QHBoxLayout()
tablelayout = QtWidgets.QVBoxLayout()
main_butlayout = QtWidgets.QHBoxLayout()
drl_load = QtWidgets.QPushButton("Load")
drl_save = QtWidgets.QPushButton("Save")
drl_export = QtWidgets.QPushButton("Export")
drl_cancel = QtWidgets.QPushButton("Cancel")
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)
main_layout.addLayout(main_butlayout)
main_butlayout.addWidget(drl_load)
main_butlayout.addWidget(drl_save)
main_butlayout.addStretch(1)
main_butlayout.addWidget(drl_export)
main_butlayout.addWidget(cancel)
#pt = parenttable
pt = QtWidgets.QTableWidget()
pt.setSizePolicy(QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding)
# pt = parenttable
pt = QtWidgets.QTableWidget(columnCount=3)
pt.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Expanding)
pt.setRowCount(5)
pt.setColumnCount(3)
pt.setHorizontalHeaderLabels(["Name", "start (m/z)", "end (m/z)", "intensity"])
pt.setHorizontalHeaderLabels(
["Name", "start (m/z)", "end (m/z)", "intensity"])
ptx = pt.verticalHeader().width() + pt.verticalScrollBar().height()
for n in range(pt.columnCount()):
ptx = ptx + pt.columnWidth(n)
pt.setMinimumSize(ptx,0)
pt.horizontalHeader().setSectionResizeMode(2,QtWidgets.QHeaderView.Stretch)
pt.setMinimumSize(ptx, 0)
pt.horizontalHeader().setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)
pt.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
pt_butlayout = QtWidgets.QHBoxLayout()
pt_add = QtWidgets.QPushButton("Add")
pt_rem = QtWidgets.QPushButton("Remove")
#dt = daughtertable
dt = QtWidgets.QTableWidget()
dt.setSizePolicy(QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding)
dt.setColumnCount(4)
# dt = daughtertable
dt = QtWidgets.QTableWidget(columnCount=4)
dt.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
dt.setRowCount(3)
dt.setHorizontalHeaderLabels(["Name", "start (m/z)", "end (m/z)", "corr to"])
dt.setHorizontalHeaderLabels(
["Name", "start (m/z)", "end (m/z)", "corr to"])
dtx = pt.verticalHeader().width() + pt.verticalScrollBar().height()
for n in range(dt.columnCount()):
dtx = dtx + dt.columnWidth(n)
dt.setMinimumSize(dtx,0)
dt.horizontalHeader().setSectionResizeMode(dt.columnCount()-1,QtWidgets.QHeaderView.Stretch)
dt.setMinimumSize(dtx, 0)
dt.horizontalHeader().setSectionResizeMode(
dt.columnCount()-1, QtWidgets.QHeaderView.Stretch)
dt.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
dt_butlayout = QtWidgets.QHBoxLayout()
dt_add = QtWidgets.QPushButton("Add")
......@@ -81,24 +84,23 @@ def dialog(parent, ds, filename):
add_corr_widget = QtWidgets.QDialog(dial_widget)
dt_addcorr = QtWidgets.QPushButton("Add correction")
dt_addcorr.clicked.connect(add_corr_widget.show)
add_corr = QtWidgets.QPushButton("Add correction")
add_corr.clicked.connect(add_corr_widget.show)
drl_sublayout.addWidget(graph_canvas)
drl_sublayout.addLayout(drl_tablelayout)
drl_tablelayout.addWidget(QtWidgets.QLabel("Raw ions table:"))
drl_tablelayout.addWidget(pt)
drl_tablelayout.addLayout(pt_butlayout)
sub_layout.addWidget(graph_canvas)
sub_layout.addLayout(tablelayout)
tablelayout.addWidget(QtWidgets.QLabel("Raw ions table:"))
tablelayout.addWidget(pt)
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(dt)
drl_tablelayout.addLayout(dt_butlayout)
tablelayout.addWidget(HBar())
tablelayout.addWidget(QtWidgets.QLabel("Corrected ions table:"))
tablelayout.addWidget(dt)
tablelayout.addLayout(dt_butlayout)
dt_butlayout.addWidget(dt_add)
dt_butlayout.addWidget(dt_rem)
dt_butlayout.addStretch(1)
dt_butlayout.addWidget(dt_addcorr)
dt_butlayout.addWidget(add_corr)
dial_widget.show()
......@@ -109,11 +109,10 @@ def dialog(parent, ds, filename):
xlabel="", ylabel="ion count gradient", gmax=None,
fwhm_x=None, fwhm_y=None, fwhm=None)
dial_widget = QtWidgets.QDialog(parent)
dial_widget.setWindowTitle('TSQ zero collision energy calculator')
dial_widget = QtWidgets.QDialog(
parent, windowTitle='TSQ zero collision energy calculator')
dial_graph = Figure(figsize=(5, 2), dpi=100)
dial_graph.patch.set_facecolor("None")
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
coffspect = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
coffspect_grad = coffspect.twinx()
graph_canvas = FigureCanvas(dial_graph)
......
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