forked from M-Labs/artiq
1
0
Fork 0

moninj: add drag drop support

This commit is contained in:
Simon Renblad 2024-04-30 16:02:29 +08:00
parent 9d93ad444a
commit 63c197479f
1 changed files with 5 additions and 7 deletions

View File

@ -4,13 +4,13 @@ import textwrap
from collections import namedtuple from collections import namedtuple
from functools import partial 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.comm_moninj import CommMonInj, TTLOverride, TTLProbe
from artiq.coredevice.ad9912_reg import AD9912_SER_CONF from artiq.coredevice.ad9912_reg import AD9912_SER_CONF
from artiq.gui.tools import LayoutWidget, QDockWidgetCloseDetect from artiq.gui.tools import LayoutWidget, QDockWidgetCloseDetect
from artiq.gui.models import DictSyncTreeSepModel from artiq.gui.models import DictSyncTreeSepModel
from artiq.gui.flowlayout import FlowLayout from artiq.gui.dndwidgets import VDragScrollArea, DragDropFlowLayoutWidget
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -919,13 +919,11 @@ class _MonInjDock(QDockWidgetCloseDetect):
self.display_name_edit = _DoubleClickLineEdit(name) self.display_name_edit = _DoubleClickLineEdit(name)
grid.addWidget(self.display_name_edit, 0, 2) grid.addWidget(self.display_name_edit, 0, 2)
scroll_area = QtWidgets.QScrollArea() scroll_area = VDragScrollArea(self)
grid.addWidget(scroll_area, 1, 0, 1, 10) grid.addWidget(scroll_area, 1, 0, 1, 10)
self.flow = FlowLayout() self.flow = DragDropFlowLayoutWidget()
grid_widget = QtWidgets.QWidget()
grid_widget.setLayout(self.flow)
scroll_area.setWidgetResizable(True) scroll_area.setWidgetResizable(True)
scroll_area.setWidget(grid_widget) scroll_area.setWidget(self.flow)
def add_channels(self): def add_channels(self):
handlers = self._channel_dialog.channels handlers = self._channel_dialog.channels