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

Dock fix

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