browser: add HDF5 to experiment DND

This commit is contained in:
Robert Jördens 2016-05-07 23:56:39 +02:00
parent 4016e5adaa
commit 66927da70c

View File

@ -157,6 +157,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.setWindowTitle(expurl)
self.setWindowIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_FileDialogContentsView))
self.setAcceptDrops(True)
self.layout = QtWidgets.QGridLayout()
top_widget = QtWidgets.QWidget()
@ -214,6 +215,17 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.layout.addWidget(reqterm, 3, 4)
reqterm.clicked.connect(self.reqterm_clicked)
def dragEnterEvent(self, ev):
if ev.mimeData().hasFormat("text/uri-list"):
ev.acceptProposedAction()
def dropEvent(self, ev):
for uri in ev.mimeData().urls():
if uri.scheme() == "file":
logger.info("loading HDF5 arguments from %s", uri.path())
asyncio.ensure_future(self._load_hdf5_task(uri.path()))
ev.acceptProposedAction()
async def _recompute_arguments(self, overrides={}):
try:
arginfo = await self._area.compute_arginfo(self.expurl)
@ -303,9 +315,10 @@ class ExperimentsArea(QtWidgets.QMdiArea):
self.open_experiments = []
self.worker_handlers = {
# "get_dataset": dataset_db.get,
# "update_dataset": dataset_db.update,
"get_device_db": lambda: None,
"get_device": lambda k: None,
"get_dataset": lambda k: 0, # TODO
"update_dataset": lambda k, v: None,
}
def paintEvent(self, event):