Commit 14dcd27b authored by Yan's avatar Yan
Browse files

Dock fix

* loading files now working
parent b24052b8
...@@ -229,7 +229,7 @@ def main(): ...@@ -229,7 +229,7 @@ def main():
#drl_logger.setLevel("INFO") #drl_logger.setLevel("INFO")
drl_logger.setLevel("DEBUG") drl_logger.setLevel("DEBUG")
zce_logger.setLevel("DEBUG") zce_logger.setLevel("DEBUG")
params_logger.setLevel("DEBUG") #params_logger.setLevel("DEBUG")
p_logger.addHandler(barHandler) p_logger.addHandler(barHandler)
zce_logger.addHandler(barHandler) zce_logger.addHandler(barHandler)
params_logger.addHandler(barHandler) params_logger.addHandler(barHandler)
...@@ -245,7 +245,7 @@ def main(): ...@@ -245,7 +245,7 @@ def main():
mpl_canvas = FigureCanvas(graph) mpl_canvas = FigureCanvas(graph)
mpl_canvas.setStyleSheet("background-color:transparent;") mpl_canvas.setStyleSheet("background-color:transparent;")
mpl_canvas.setAutoFillBackground(False) mpl_canvas.setAutoFillBackground(False)
gt.pan_factory(chromatogram) gt.pan_factory(chromatogram)
gt.zoom_factory(chromatogram, 1.15) gt.zoom_factory(chromatogram, 1.15)
gt.pan_factory(spectrum, ms) gt.pan_factory(spectrum, ms)
...@@ -261,10 +261,13 @@ def main(): ...@@ -261,10 +261,13 @@ def main():
if QtGui.QIcon.themeName() is "": if QtGui.QIcon.themeName() is "":
QtGui.QIcon.setThemeName("TangoMFK") QtGui.QIcon.setThemeName("TangoMFK")
lfvars = (main_window, chromatogram, spectrum, ds, ms, filename, chrom,
update, config, loadthread)
consoledock = docks.consoleDockWidget( consoledock = docks.consoleDockWidget(
locals(), "&Console", "view/consolevisible") locals(), "&Console", "view/consolevisible")
treedock = docks.treeDockWidget( treedock = docks.treeDockWidget(
load_file, update, "&File browser", "view/filebrowservisible") update, "&File browser", "view/filebrowservisible", load_file, lfvars)
paramsdock = docks.augDock("Acquisition parameters", "&Acq parameters", paramsdock = docks.augDock("Acquisition parameters", "&Acq parameters",
"view/acqparvisible") "view/acqparvisible")
update.signal.connect(lambda: gt.update_paramstable(paramstable, ms, chrom)) update.signal.connect(lambda: gt.update_paramstable(paramstable, ms, chrom))
...@@ -355,6 +358,7 @@ def main(): ...@@ -355,6 +358,7 @@ def main():
main_window.setCentralWidget(mpl_canvas) main_window.setCentralWidget(mpl_canvas)
toolBar = QtWidgets.QToolBar(main_window) toolBar = QtWidgets.QToolBar(main_window)
toolBar.setAllowedAreas(QtCore.Qt.TopToolBarArea) toolBar.setAllowedAreas(QtCore.Qt.TopToolBarArea)
toolBar.setFloatable(False) toolBar.setFloatable(False)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from code import InteractiveConsole from code import InteractiveConsole
from io import StringIO from io import StringIO
import os
import contextlib import contextlib
import numpy as np import numpy as np
import prasopes.config as cf import prasopes.config as cf
...@@ -56,10 +57,7 @@ def consoleDockWidget(localvars, actionname, cfval): ...@@ -56,10 +57,7 @@ def consoleDockWidget(localvars, actionname, cfval):
return dock return dock
def treeDockWidget(load_file, update, actionname, cfval): def treeDockWidget(update, actionname, cfval, load_file, lfvars):
def scrolltoonce():
fileModel.directoryLoaded.disconnect(scrolltoonce)
treeview.scrollTo(fileModel.index(config.value("open_folder")), 1)
config = cf.settings() config = cf.settings()
fileModel = QtWidgets.QFileSystemModel() fileModel = QtWidgets.QFileSystemModel()
fileModel.setRootPath('') fileModel.setRootPath('')
...@@ -72,17 +70,18 @@ def treeDockWidget(load_file, update, actionname, cfval): ...@@ -72,17 +70,18 @@ def treeDockWidget(load_file, update, actionname, cfval):
dirview.setModel(fileModel) dirview.setModel(fileModel)
dock = augDock("Folder View", actionname, cfval) dock = augDock("Folder View", actionname, cfval)
[dock.layout.addWidget(i) for i in (treeview, dirview)] [dock.layout.addWidget(i) for i in (treeview, dirview)]
filename = lfvars[5]
fileModel.directoryLoaded.connect(scrolltoonce) def scrolltoonce():
fileModel.layoutChanged.disconnect(scrolltoonce)
treeview.scrollTo(fileModel.index(config.value("open_folder")), 1)
fileModel.directoryLoaded.connect( fileModel.directoryLoaded.connect(
lambda: treeview.resizeColumnToContents(0)) lambda: treeview.resizeColumnToContents(0))
update.signal.connect(lambda: treeview.setCurrentIndex(fileModel.index( update.signal.connect(lambda: treeview.setCurrentIndex(fileModel.index(
filename[0]))) filename[0])))
update.signal.connect(lambda: dirview.setRootIndex(fileModel.index( update.signal.connect(lambda: dirview.setRootIndex(fileModel.index(
os.path.dirname(os.path.realpath(filename[0]))))) os.path.dirname(os.path.realpath(filename[0])))))
clickload = lambda index: load_file( fileModel.layoutChanged.connect(scrolltoonce)
main_window, chromatogram, spectrum, ds, ms, filename, chrom, clickload = lambda index: load_file(*lfvars, filename=fileModel.filePath(index))
update, config, loadthread, filename=fileModel.filePath(index))
for i in [treeview.doubleClicked, dirview.doubleClicked, dirview.clicked]: for i in [treeview.doubleClicked, dirview.doubleClicked, dirview.clicked]:
i.connect(clickload) i.connect(clickload)
return dock return dock
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