moninj: add drag drop support

This commit is contained in:
Simon Renblad 2024-04-30 16:02:29 +08:00
parent 9d93ad444a
commit 63c197479f

View File

@ -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