From 63c197479f17d89beb9c8bf5ac23f80ed835efa8 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Tue, 30 Apr 2024 16:02:29 +0800 Subject: [PATCH] moninj: add drag drop support --- artiq/dashboard/moninj.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index b1c5c64a3..ee5e3766a 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -4,13 +4,13 @@ import textwrap from collections import namedtuple from functools import partial -from PyQt5 import QtCore, QtWidgets +from PyQt5 import QtCore, QtWidgets, QtGui from artiq.coredevice.comm_moninj import CommMonInj, TTLOverride, TTLProbe from artiq.coredevice.ad9912_reg import AD9912_SER_CONF from artiq.gui.tools import LayoutWidget, QDockWidgetCloseDetect from artiq.gui.models import DictSyncTreeSepModel -from artiq.gui.flowlayout import FlowLayout +from artiq.gui.dndwidgets import VDragScrollArea, DragDropFlowLayoutWidget logger = logging.getLogger(__name__) @@ -919,13 +919,11 @@ class _MonInjDock(QDockWidgetCloseDetect): self.display_name_edit = _DoubleClickLineEdit(name) grid.addWidget(self.display_name_edit, 0, 2) - scroll_area = QtWidgets.QScrollArea() + scroll_area = VDragScrollArea(self) grid.addWidget(scroll_area, 1, 0, 1, 10) - self.flow = FlowLayout() - grid_widget = QtWidgets.QWidget() - grid_widget.setLayout(self.flow) + self.flow = DragDropFlowLayoutWidget() scroll_area.setWidgetResizable(True) - scroll_area.setWidget(grid_widget) + scroll_area.setWidget(self.flow) def add_channels(self): handlers = self._channel_dialog.channels