Commit 329c6d7d authored by Yan's avatar Yan
Browse files

Improved stability, changed plot layout

* loading of the incompatible file will not crush whole program
* moved to GridSpec layout - constrained layout preparation
parent f50986e6
......@@ -3,10 +3,12 @@
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.widgets import SpanSelector
from matplotlib.gridspec import GridSpec
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from rawprasslib import load_raw
from rawprasslib import rawprasslib
import prasopes.graphtools as gt
import prasopes.filetools as ft
import prasopes.zcetools as zce
......@@ -32,8 +34,17 @@ def load_file(parent, chrom_plot, spc, d_set, ms_s, fn, chrom_s,
directory=directory,
filter="Finnigan RAW files (*.raw, *.RAW)")[0]
if filename is not '':
d_set['chrom_dat'], d_set['masses'], d_set['matrix'] \
= load_raw(filename, settings.value("tmp_location"))
try:
d_set['chrom_dat'], d_set['masses'], d_set['matrix'] \
= load_raw(filename, settings.value("tmp_location"))
except rawprasslib.ParsingException as pex:
QtWidgets.QMessageBox.critical(
parent, "Opening of the file has failed!",
"File is incompatible with the rawprasslib, "
"canceling request!\n\n"
"Error message:\n{}".format(pex.args[0]))
return
gt.populate(chrom_plot, spc, d_set, ms_s, chrom_s)
fn[0] = filename
parent.setWindowTitle("Prasopes - {}".format(
......@@ -87,9 +98,10 @@ def main():
drl_logger.setLevel("DEBUG")
graph = Figure(figsize=(5, 4), dpi=100, facecolor="None")
grid = graph.add_gridspec(2, 1)
chromatogram = graph.add_subplot(211, facecolor=(1, 1, 1, 0.8))
spectrum = graph.add_subplot(212, facecolor=(1, 1, 1, 0.8))
chromatogram = graph.add_subplot(grid[0,0], facecolor=(1, 1, 1, 0.8))
spectrum = graph.add_subplot(grid[1,0], facecolor=(1, 1, 1, 0.8))
graph.tight_layout()
mpl_canvas = FigureCanvas(graph)
......
......@@ -25,7 +25,7 @@ setup(
'PyQt5-sip;platform_system=="Windows"',
'PyQt5;platform_system=="Darwin"',
'PyQt5-sip;platform_system=="Darwin"',
'matplotlib>=2.0.0',
'matplotlib>=3.0.0',
'rawprasslib'],
entry_points={
'console_scripts': [
......
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