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

File name now appears in the window title

parent d359695d
......@@ -20,8 +20,8 @@ import os.path
matplotlib.use("Qt5Agg")
def load_file(chrom_plot, spc, d_set, ms_s, fn, chrom_s, settings,
filename=None):
def load_file(parent, chrom_plot, spc, d_set, ms_s, fn, chrom_s,
settings, filename=None):
"""populates dataset and plots it"""
directory=settings.value("open_folder")
if fn[0] is not None:
......@@ -36,6 +36,8 @@ def load_file(chrom_plot, spc, d_set, ms_s, fn, chrom_s, settings,
= load_raw(filename, settings.value("tmp_location"))
gt.populate(chrom_plot, spc, d_set, ms_s, chrom_s)
fn[0] = filename
parent.setWindowTitle("Prasopes - {}".format(
os.path.basename(filename)))
def update_spectrum(event, chromatogram, spect, ds,
......@@ -50,11 +52,11 @@ def update_spectrum(event, chromatogram, spect, ds,
spect.get_figure().canvas.draw()
def dropped(event, chromatogram, spectrum, ds, ms, filename, chrom,
config):
def dropped(event, parent, chromatogram, spectrum, ds, ms, filename,
chrom, config):
dropurl = event.mimeData().urls()[0].path()
load_file(chromatogram, spectrum, ds, ms, filename, chrom,
config, filename=dropurl)
load_file(parent, chromatogram, spectrum, ds, ms, filename,
chrom, config, filename=dropurl)
def drag_entered(event):
......@@ -118,7 +120,8 @@ def main():
"document-open"), "&Open...")
openact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_O)
openact.triggered.connect(lambda: load_file(
chromatogram, spectrum, ds, ms, filename, chrom, config))
main_window, chromatogram, spectrum, ds, ms, filename, chrom,
config))
exportact = QtWidgets.QAction(QtGui.QIcon.fromTheme(
"document-save-as"), "&Export...")
exportact.setShortcut(QtCore.Qt.CTRL + QtCore.Qt.Key_E)
......@@ -188,13 +191,13 @@ def main():
filename, chrom, config))
main_window.dragEnterEvent = lambda event: drag_entered(event)
main_window.dropEvent = lambda event: dropped(
event, chromatogram, spectrum, ds, ms, filename, chrom,
config)
event, main_window, chromatogram, spectrum, ds, ms, filename,
chrom, config)
main_window.setAcceptDrops(True)
if len(sys.argv) == 2:
load_file(chromatogram, spectrum, ds, ms, filename, chrom,
config, filename=sys.argv[1])
load_file(main_window, chromatogram, spectrum, ds, ms,
filename, chrom, config, filename=sys.argv[1])
else:
gt.pop_plot(spectrum, ms)
gt.pop_plot(chromatogram, chrom)
......
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