mirror of https://github.com/m-labs/artiq.git
port recent GUI changes to PyQt6
This commit is contained in:
parent
f7edb7b706
commit
c4c932020a
|
@ -62,8 +62,8 @@ class DatasetsDock(QtWidgets.QDockWidget):
|
||||||
def __init__(self, dataset_sub, dataset_ctl):
|
def __init__(self, dataset_sub, dataset_ctl):
|
||||||
QtWidgets.QDockWidget.__init__(self, "Datasets")
|
QtWidgets.QDockWidget.__init__(self, "Datasets")
|
||||||
self.setObjectName("Datasets")
|
self.setObjectName("Datasets")
|
||||||
self.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable |
|
self.setFeatures(self.DockWidgetFeature.DockWidgetMovable |
|
||||||
QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetFloatable)
|
self.DockWidgetFeature.DockWidgetFloatable)
|
||||||
|
|
||||||
grid = LayoutWidget()
|
grid = LayoutWidget()
|
||||||
self.setWidget(grid)
|
self.setWidget(grid)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt6 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from artiq.gui.models import DictSyncModel
|
from artiq.gui.models import DictSyncModel
|
||||||
from artiq.gui.entries import EntryTreeWidget, procdesc_to_entry
|
from artiq.gui.entries import EntryTreeWidget, procdesc_to_entry
|
||||||
|
@ -44,11 +44,11 @@ class _InteractiveArgsRequest(EntryTreeWidget):
|
||||||
self.quickStyleClicked.connect(self.supply)
|
self.quickStyleClicked.connect(self.supply)
|
||||||
cancel_btn = QtWidgets.QPushButton("Cancel")
|
cancel_btn = QtWidgets.QPushButton("Cancel")
|
||||||
cancel_btn.setIcon(QtWidgets.QApplication.style().standardIcon(
|
cancel_btn.setIcon(QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_DialogCancelButton))
|
QtWidgets.QStyle.StandardPixmap.SP_DialogCancelButton))
|
||||||
cancel_btn.clicked.connect(self.cancel)
|
cancel_btn.clicked.connect(self.cancel)
|
||||||
supply_btn = QtWidgets.QPushButton("Supply")
|
supply_btn = QtWidgets.QPushButton("Supply")
|
||||||
supply_btn.setIcon(QtWidgets.QApplication.style().standardIcon(
|
supply_btn.setIcon(QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_DialogOkButton))
|
QtWidgets.QStyle.StandardPixmap.SP_DialogOkButton))
|
||||||
supply_btn.clicked.connect(self.supply)
|
supply_btn.clicked.connect(self.supply)
|
||||||
buttons = LayoutWidget()
|
buttons = LayoutWidget()
|
||||||
buttons.addWidget(cancel_btn, 1, 1)
|
buttons.addWidget(cancel_btn, 1, 1)
|
||||||
|
@ -78,7 +78,7 @@ class _InteractiveArgsView(QtWidgets.QStackedWidget):
|
||||||
QtWidgets.QStackedWidget.__init__(self)
|
QtWidgets.QStackedWidget.__init__(self)
|
||||||
self.tabs = QtWidgets.QTabWidget()
|
self.tabs = QtWidgets.QTabWidget()
|
||||||
self.default_label = QtWidgets.QLabel("No pending interactive arguments requests.")
|
self.default_label = QtWidgets.QLabel("No pending interactive arguments requests.")
|
||||||
self.default_label.setAlignment(QtCore.Qt.AlignCenter)
|
self.default_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||||
font = QtGui.QFont(self.default_label.font())
|
font = QtGui.QFont(self.default_label.font())
|
||||||
font.setItalic(True)
|
font.setItalic(True)
|
||||||
self.default_label.setFont(font)
|
self.default_label.setFont(font)
|
||||||
|
@ -99,9 +99,12 @@ class _InteractiveArgsView(QtWidgets.QStackedWidget):
|
||||||
self._insert_widget(i)
|
self._insert_widget(i)
|
||||||
|
|
||||||
def _insert_widget(self, row):
|
def _insert_widget(self, row):
|
||||||
rid = self.model.data(self.model.index(row, 0), QtCore.Qt.DisplayRole)
|
rid = self.model.data(self.model.index(row, 0),
|
||||||
title = self.model.data(self.model.index(row, 1), QtCore.Qt.DisplayRole)
|
QtCore.Qt.ItemDataRole.DisplayRole)
|
||||||
arglist_desc = self.model.data(self.model.index(row, 2), QtCore.Qt.DisplayRole)
|
title = self.model.data(self.model.index(row, 1),
|
||||||
|
QtCore.Qt.ItemDataRole.DisplayRole)
|
||||||
|
arglist_desc = self.model.data(self.model.index(row, 2),
|
||||||
|
QtCore.Qt.ItemDataRole.DisplayRole)
|
||||||
inter_args_request = _InteractiveArgsRequest(rid, arglist_desc)
|
inter_args_request = _InteractiveArgsRequest(rid, arglist_desc)
|
||||||
inter_args_request.supplied.connect(self.supplied)
|
inter_args_request.supplied.connect(self.supplied)
|
||||||
inter_args_request.cancelled.connect(self.cancelled)
|
inter_args_request.cancelled.connect(self.cancelled)
|
||||||
|
@ -126,7 +129,7 @@ class InteractiveArgsDock(QtWidgets.QDockWidget):
|
||||||
QtWidgets.QDockWidget.__init__(self, "Interactive Args")
|
QtWidgets.QDockWidget.__init__(self, "Interactive Args")
|
||||||
self.setObjectName("Interactive Args")
|
self.setObjectName("Interactive Args")
|
||||||
self.setFeatures(
|
self.setFeatures(
|
||||||
QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable)
|
self.DockWidgetFeature.DockWidgetMovable | self.DockWidgetFeature.DockWidgetFloatable)
|
||||||
self.interactive_args_rpc = interactive_args_rpc
|
self.interactive_args_rpc = interactive_args_rpc
|
||||||
self.request_view = _InteractiveArgsView()
|
self.request_view = _InteractiveArgsView()
|
||||||
self.request_view.supplied.connect(self.supply)
|
self.request_view.supplied.connect(self.supply)
|
||||||
|
|
|
@ -761,7 +761,7 @@ class Model(DictSyncTreeSepModel):
|
||||||
class _AddChannelDialog(QtWidgets.QDialog):
|
class _AddChannelDialog(QtWidgets.QDialog):
|
||||||
def __init__(self, parent, model):
|
def __init__(self, parent, model):
|
||||||
QtWidgets.QDialog.__init__(self, parent=parent)
|
QtWidgets.QDialog.__init__(self, parent=parent)
|
||||||
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu)
|
||||||
self.setWindowTitle("Add channels")
|
self.setWindowTitle("Add channels")
|
||||||
|
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
|
@ -771,14 +771,15 @@ class _AddChannelDialog(QtWidgets.QDialog):
|
||||||
self._tree_view = QtWidgets.QTreeView()
|
self._tree_view = QtWidgets.QTreeView()
|
||||||
self._tree_view.setHeaderHidden(True)
|
self._tree_view.setHeaderHidden(True)
|
||||||
self._tree_view.setSelectionBehavior(
|
self._tree_view.setSelectionBehavior(
|
||||||
QtWidgets.QAbstractItemView.SelectItems)
|
QtWidgets.QAbstractItemView.SelectionBehavior.SelectItems)
|
||||||
self._tree_view.setSelectionMode(
|
self._tree_view.setSelectionMode(
|
||||||
QtWidgets.QAbstractItemView.ExtendedSelection)
|
QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||||
self._tree_view.setModel(self._model)
|
self._tree_view.setModel(self._model)
|
||||||
layout.addWidget(self._tree_view)
|
layout.addWidget(self._tree_view)
|
||||||
|
|
||||||
self._button_box = QtWidgets.QDialogButtonBox(
|
self._button_box = QtWidgets.QDialogButtonBox(
|
||||||
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
|
QtWidgets.QDialogButtonBox.StandardButton.Ok | \
|
||||||
|
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||||
)
|
)
|
||||||
self._button_box.setCenterButtons(True)
|
self._button_box.setCenterButtons(True)
|
||||||
self._button_box.accepted.connect(self.add_channels)
|
self._button_box.accepted.connect(self.add_channels)
|
||||||
|
@ -800,8 +801,8 @@ class _MonInjDock(QDockWidgetCloseDetect):
|
||||||
def __init__(self, name, manager):
|
def __init__(self, name, manager):
|
||||||
QtWidgets.QDockWidget.__init__(self, "MonInj")
|
QtWidgets.QDockWidget.__init__(self, "MonInj")
|
||||||
self.setObjectName(name)
|
self.setObjectName(name)
|
||||||
self.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable |
|
self.setFeatures(self.DockWidgetFeature.DockWidgetMovable |
|
||||||
QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetFloatable)
|
self.DockWidgetFeature.DockWidgetFloatable)
|
||||||
grid = LayoutWidget()
|
grid = LayoutWidget()
|
||||||
self.setWidget(grid)
|
self.setWidget(grid)
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
@ -810,7 +811,7 @@ class _MonInjDock(QDockWidgetCloseDetect):
|
||||||
newdock = QtWidgets.QToolButton()
|
newdock = QtWidgets.QToolButton()
|
||||||
newdock.setToolTip("Create new moninj dock")
|
newdock.setToolTip("Create new moninj dock")
|
||||||
newdock.setIcon(QtWidgets.QApplication.style().standardIcon(
|
newdock.setIcon(QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileDialogNewFolder))
|
QtWidgets.QStyle.StandardPixmap.SP_FileDialogNewFolder))
|
||||||
newdock.clicked.connect(lambda: self.manager.create_new_dock())
|
newdock.clicked.connect(lambda: self.manager.create_new_dock())
|
||||||
grid.addWidget(newdock, 0, 0)
|
grid.addWidget(newdock, 0, 0)
|
||||||
|
|
||||||
|
@ -821,7 +822,7 @@ class _MonInjDock(QDockWidgetCloseDetect):
|
||||||
dialog_btn.setToolTip("Add channels")
|
dialog_btn.setToolTip("Add channels")
|
||||||
dialog_btn.setIcon(
|
dialog_btn.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileDialogListView))
|
QtWidgets.QStyle.StandardPixmap.SP_FileDialogListView))
|
||||||
dialog_btn.clicked.connect(self.channel_dialog.open)
|
dialog_btn.clicked.connect(self.channel_dialog.open)
|
||||||
grid.addWidget(dialog_btn, 0, 1)
|
grid.addWidget(dialog_btn, 0, 1)
|
||||||
|
|
||||||
|
@ -834,7 +835,8 @@ class _MonInjDock(QDockWidgetCloseDetect):
|
||||||
self.flow = DragDropFlowLayoutWidget()
|
self.flow = DragDropFlowLayoutWidget()
|
||||||
scroll_area.setWidgetResizable(True)
|
scroll_area.setWidgetResizable(True)
|
||||||
scroll_area.setWidget(self.flow)
|
scroll_area.setWidget(self.flow)
|
||||||
self.flow.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
self.flow.setContextMenuPolicy(
|
||||||
|
QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.flow.customContextMenuRequested.connect(self.custom_context_menu)
|
self.flow.customContextMenuRequested.connect(self.custom_context_menu)
|
||||||
|
|
||||||
def custom_context_menu(self, pos):
|
def custom_context_menu(self, pos):
|
||||||
|
@ -842,7 +844,7 @@ class _MonInjDock(QDockWidgetCloseDetect):
|
||||||
if index == -1:
|
if index == -1:
|
||||||
return
|
return
|
||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
delete_action = QtWidgets.QAction("Delete widget", menu)
|
delete_action = QtGui.QAction("Delete widget", menu)
|
||||||
delete_action.triggered.connect(partial(self.delete_widget, index))
|
delete_action.triggered.connect(partial(self.delete_widget, index))
|
||||||
menu.addAction(delete_action)
|
menu.addAction(delete_action)
|
||||||
menu.exec_(self.flow.mapToGlobal(pos))
|
menu.exec_(self.flow.mapToGlobal(pos))
|
||||||
|
@ -931,7 +933,7 @@ class MonInj:
|
||||||
dock = _MonInjDock(name, self)
|
dock = _MonInjDock(name, self)
|
||||||
self.docks[name] = dock
|
self.docks[name] = dock
|
||||||
if add_to_area:
|
if add_to_area:
|
||||||
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea.RightDockWidgetArea, dock)
|
||||||
dock.setFloating(True)
|
dock.setFloating(True)
|
||||||
dock.sigClosed.connect(partial(self.on_dock_closed, name))
|
dock.sigClosed.connect(partial(self.on_dock_closed, name))
|
||||||
self.update_closable()
|
self.update_closable()
|
||||||
|
@ -945,10 +947,10 @@ class MonInj:
|
||||||
dock.deleteLater()
|
dock.deleteLater()
|
||||||
|
|
||||||
def update_closable(self):
|
def update_closable(self):
|
||||||
flags = (QtWidgets.QDockWidget.DockWidgetMovable |
|
flags = (QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable |
|
||||||
QtWidgets.QDockWidget.DockWidgetFloatable)
|
QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetFloatable)
|
||||||
if len(self.docks) > 1:
|
if len(self.docks) > 1:
|
||||||
flags |= QtWidgets.QDockWidget.DockWidgetClosable
|
flags |= QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetClosable
|
||||||
for dock in self.docks.values():
|
for dock in self.docks.values():
|
||||||
dock.setFeatures(flags)
|
dock.setFeatures(flags)
|
||||||
|
|
||||||
|
@ -968,7 +970,8 @@ class MonInj:
|
||||||
dock = _MonInjDock(name, self)
|
dock = _MonInjDock(name, self)
|
||||||
self.docks[name] = dock
|
self.docks[name] = dock
|
||||||
dock.restore_state(dock_state)
|
dock.restore_state(dock_state)
|
||||||
self.main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
|
self.main_window.addDockWidget(
|
||||||
|
QtCore.Qt.DockWidgetArea.RightDockWidgetArea, dock)
|
||||||
dock.sigClosed.connect(partial(self.on_dock_closed, name))
|
dock.sigClosed.connect(partial(self.on_dock_closed, name))
|
||||||
self.update_closable()
|
self.update_closable()
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ class ShortcutsDock(QtWidgets.QDockWidget):
|
||||||
def __init__(self, main_window, exp_manager):
|
def __init__(self, main_window, exp_manager):
|
||||||
QtWidgets.QDockWidget.__init__(self, "Shortcuts")
|
QtWidgets.QDockWidget.__init__(self, "Shortcuts")
|
||||||
self.setObjectName("Shortcuts")
|
self.setObjectName("Shortcuts")
|
||||||
self.setFeatures(QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetMovable |
|
self.setFeatures(self.DockWidgetFeature.DockWidgetMovable |
|
||||||
QtWidgets.QDockWidget.DockWidgetFeature.DockWidgetFloatable)
|
self.DockWidgetFeature.DockWidgetFloatable)
|
||||||
|
|
||||||
layout = QtWidgets.QGridLayout()
|
layout = QtWidgets.QGridLayout()
|
||||||
top_widget = QtWidgets.QWidget()
|
top_widget = QtWidgets.QWidget()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import bisect
|
||||||
import itertools
|
import itertools
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt6 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -130,7 +130,7 @@ class _BaseWaveform(pg.PlotWidget):
|
||||||
self.setMinimumHeight(WAVEFORM_MIN_HEIGHT)
|
self.setMinimumHeight(WAVEFORM_MIN_HEIGHT)
|
||||||
self.setMaximumHeight(WAVEFORM_MAX_HEIGHT)
|
self.setMaximumHeight(WAVEFORM_MAX_HEIGHT)
|
||||||
self.setMenuEnabled(False)
|
self.setMenuEnabled(False)
|
||||||
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu)
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.width = width
|
self.width = width
|
||||||
|
@ -200,13 +200,13 @@ class _BaseWaveform(pg.PlotWidget):
|
||||||
self.cursor_y = self.y_data[ind]
|
self.cursor_y = self.y_data[ind]
|
||||||
|
|
||||||
def mouseMoveEvent(self, e):
|
def mouseMoveEvent(self, e):
|
||||||
if e.buttons() == QtCore.Qt.LeftButton \
|
if e.buttons() == QtCore.Qt.MouseButton.LeftButton \
|
||||||
and e.modifiers() == QtCore.Qt.ShiftModifier:
|
and e.modifiers() == QtCore.Qt.KeyboardModifier.ShiftModifier:
|
||||||
drag = QtGui.QDrag(self)
|
drag = QtGui.QDrag(self)
|
||||||
mime = QtCore.QMimeData()
|
mime = QtCore.QMimeData()
|
||||||
drag.setMimeData(mime)
|
drag.setMimeData(mime)
|
||||||
pixmapi = QtWidgets.QApplication.style().standardIcon(
|
pixmapi = QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileIcon)
|
QtWidgets.QStyle.StandardPixmap.SP_FileIcon)
|
||||||
drag.setPixmap(pixmapi.pixmap(32))
|
drag.setPixmap(pixmapi.pixmap(32))
|
||||||
drag.exec_(QtCore.Qt.MoveAction)
|
drag.exec_(QtCore.Qt.MoveAction)
|
||||||
else:
|
else:
|
||||||
|
@ -428,8 +428,9 @@ class _WaveformView(QtWidgets.QWidget):
|
||||||
scroll_area = VDragScrollArea(self)
|
scroll_area = VDragScrollArea(self)
|
||||||
scroll_area.setWidgetResizable(True)
|
scroll_area.setWidgetResizable(True)
|
||||||
scroll_area.setContentsMargins(0, 0, 0, 0)
|
scroll_area.setContentsMargins(0, 0, 0, 0)
|
||||||
scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame)
|
scroll_area.setFrameShape(QtWidgets.QFrame.Shape.NoFrame)
|
||||||
scroll_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
scroll_area.setVerticalScrollBarPolicy(
|
||||||
|
QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||||
layout.addWidget(scroll_area)
|
layout.addWidget(scroll_area)
|
||||||
|
|
||||||
self._splitter = VDragDropSplitter(parent=scroll_area)
|
self._splitter = VDragDropSplitter(parent=scroll_area)
|
||||||
|
@ -444,10 +445,11 @@ class _WaveformView(QtWidgets.QWidget):
|
||||||
)
|
)
|
||||||
self.confirm_delete_dialog.setText("Delete all waveforms?")
|
self.confirm_delete_dialog.setText("Delete all waveforms?")
|
||||||
self.confirm_delete_dialog.setStandardButtons(
|
self.confirm_delete_dialog.setStandardButtons(
|
||||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
|
QtWidgets.QMessageBox.StandardButton.Ok |
|
||||||
|
QtWidgets.QMessageBox.StandardButton.Cancel
|
||||||
)
|
)
|
||||||
self.confirm_delete_dialog.setDefaultButton(
|
self.confirm_delete_dialog.setDefaultButton(
|
||||||
QtWidgets.QMessageBox.Ok
|
QtWidgets.QMessageBox.StandardButton.Ok
|
||||||
)
|
)
|
||||||
|
|
||||||
def setModel(self, model):
|
def setModel(self, model):
|
||||||
|
@ -519,10 +521,10 @@ class _WaveformView(QtWidgets.QWidget):
|
||||||
w.setStoppedX(self._stopped_x)
|
w.setStoppedX(self._stopped_x)
|
||||||
w.cursorMove.connect(self.cursorMove)
|
w.cursorMove.connect(self.cursorMove)
|
||||||
w.onCursorMove(self._cursor_x)
|
w.onCursorMove(self._cursor_x)
|
||||||
action = QtWidgets.QAction("Delete waveform", w)
|
action = QtGui.QAction("Delete waveform", w)
|
||||||
action.triggered.connect(lambda: self._delete_waveform(w))
|
action.triggered.connect(lambda: self._delete_waveform(w))
|
||||||
w.addAction(action)
|
w.addAction(action)
|
||||||
action = QtWidgets.QAction("Delete all waveforms", w)
|
action = QtGui.QAction("Delete all waveforms", w)
|
||||||
action.triggered.connect(self.confirm_delete_dialog.open)
|
action.triggered.connect(self.confirm_delete_dialog.open)
|
||||||
w.addAction(action)
|
w.addAction(action)
|
||||||
return w
|
return w
|
||||||
|
@ -548,7 +550,7 @@ class _WaveformModel(QtCore.QAbstractTableModel):
|
||||||
def columnCount(self, parent=QtCore.QModelIndex()):
|
def columnCount(self, parent=QtCore.QModelIndex()):
|
||||||
return len(self.headers)
|
return len(self.headers)
|
||||||
|
|
||||||
def data(self, index, role=QtCore.Qt.DisplayRole):
|
def data(self, index, role=QtCore.Qt.ItemDataRole.DisplayRole):
|
||||||
if index.isValid():
|
if index.isValid():
|
||||||
return self.backing_struct[index.row()][index.column()]
|
return self.backing_struct[index.row()][index.column()]
|
||||||
return None
|
return None
|
||||||
|
@ -656,7 +658,7 @@ class Model(DictSyncTreeSepModel):
|
||||||
class _AddChannelDialog(QtWidgets.QDialog):
|
class _AddChannelDialog(QtWidgets.QDialog):
|
||||||
def __init__(self, parent, model):
|
def __init__(self, parent, model):
|
||||||
QtWidgets.QDialog.__init__(self, parent=parent)
|
QtWidgets.QDialog.__init__(self, parent=parent)
|
||||||
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.ActionsContextMenu)
|
||||||
self.setWindowTitle("Add channels")
|
self.setWindowTitle("Add channels")
|
||||||
|
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
|
@ -666,14 +668,14 @@ class _AddChannelDialog(QtWidgets.QDialog):
|
||||||
self._tree_view = QtWidgets.QTreeView()
|
self._tree_view = QtWidgets.QTreeView()
|
||||||
self._tree_view.setHeaderHidden(True)
|
self._tree_view.setHeaderHidden(True)
|
||||||
self._tree_view.setSelectionBehavior(
|
self._tree_view.setSelectionBehavior(
|
||||||
QtWidgets.QAbstractItemView.SelectItems)
|
QtWidgets.QAbstractItemView.SelectionBehavior.SelectItems)
|
||||||
self._tree_view.setSelectionMode(
|
self._tree_view.setSelectionMode(
|
||||||
QtWidgets.QAbstractItemView.ExtendedSelection)
|
QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||||
self._tree_view.setModel(self._model)
|
self._tree_view.setModel(self._model)
|
||||||
layout.addWidget(self._tree_view)
|
layout.addWidget(self._tree_view)
|
||||||
|
|
||||||
self._button_box = QtWidgets.QDialogButtonBox(
|
self._button_box = QtWidgets.QDialogButtonBox(
|
||||||
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
|
QtWidgets.QDialogButtonBox.StandardButton.Ok | QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||||
)
|
)
|
||||||
self._button_box.setCenterButtons(True)
|
self._button_box.setCenterButtons(True)
|
||||||
self._button_box.accepted.connect(self.add_channels)
|
self._button_box.accepted.connect(self.add_channels)
|
||||||
|
@ -696,7 +698,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||||
QtWidgets.QDockWidget.__init__(self, "Waveform")
|
QtWidgets.QDockWidget.__init__(self, "Waveform")
|
||||||
self.setObjectName("Waveform")
|
self.setObjectName("Waveform")
|
||||||
self.setFeatures(
|
self.setFeatures(
|
||||||
QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable)
|
self.DockWidgetFeature.DockWidgetMovable | self.DockWidgetFeature.DockWidgetFloatable)
|
||||||
|
|
||||||
self._channel_model = Model({})
|
self._channel_model = Model({})
|
||||||
self._waveform_model = _WaveformModel()
|
self._waveform_model = _WaveformModel()
|
||||||
|
@ -724,14 +726,14 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||||
self._menu_btn = QtWidgets.QPushButton()
|
self._menu_btn = QtWidgets.QPushButton()
|
||||||
self._menu_btn.setIcon(
|
self._menu_btn.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileDialogStart))
|
QtWidgets.QStyle.StandardPixmap.SP_FileDialogStart))
|
||||||
grid.addWidget(self._menu_btn, 0, 0)
|
grid.addWidget(self._menu_btn, 0, 0)
|
||||||
|
|
||||||
self._request_dump_btn = QtWidgets.QToolButton()
|
self._request_dump_btn = QtWidgets.QToolButton()
|
||||||
self._request_dump_btn.setToolTip("Fetch analyzer data from device")
|
self._request_dump_btn.setToolTip("Fetch analyzer data from device")
|
||||||
self._request_dump_btn.setIcon(
|
self._request_dump_btn.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_BrowserReload))
|
QtWidgets.QStyle.StandardPixmap.SP_BrowserReload))
|
||||||
self._request_dump_btn.clicked.connect(
|
self._request_dump_btn.clicked.connect(
|
||||||
lambda: asyncio.ensure_future(exc_to_warning(self.proxy_client.trigger_proxy_task())))
|
lambda: asyncio.ensure_future(exc_to_warning(self.proxy_client.trigger_proxy_task())))
|
||||||
grid.addWidget(self._request_dump_btn, 0, 1)
|
grid.addWidget(self._request_dump_btn, 0, 1)
|
||||||
|
@ -743,7 +745,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||||
self._add_btn.setToolTip("Add channels...")
|
self._add_btn.setToolTip("Add channels...")
|
||||||
self._add_btn.setIcon(
|
self._add_btn.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileDialogListView))
|
QtWidgets.QStyle.StandardPixmap.SP_FileDialogListView))
|
||||||
self._add_btn.clicked.connect(self._add_channel_dialog.open)
|
self._add_btn.clicked.connect(self._add_channel_dialog.open)
|
||||||
grid.addWidget(self._add_btn, 0, 2)
|
grid.addWidget(self._add_btn, 0, 2)
|
||||||
|
|
||||||
|
@ -763,7 +765,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||||
self._reset_zoom_btn.setToolTip("Reset zoom")
|
self._reset_zoom_btn.setToolTip("Reset zoom")
|
||||||
self._reset_zoom_btn.setIcon(
|
self._reset_zoom_btn.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_TitleBarMaxButton))
|
QtWidgets.QStyle.StandardPixmap.SP_TitleBarMaxButton))
|
||||||
self._reset_zoom_btn.clicked.connect(self._waveform_view.resetZoom)
|
self._reset_zoom_btn.clicked.connect(self._waveform_view.resetZoom)
|
||||||
grid.addWidget(self._reset_zoom_btn, 0, 3)
|
grid.addWidget(self._reset_zoom_btn, 0, 3)
|
||||||
|
|
||||||
|
@ -773,7 +775,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
||||||
grid.addWidget(self._cursor_control, 0, 4, colspan=6)
|
grid.addWidget(self._cursor_control, 0, 4, colspan=6)
|
||||||
|
|
||||||
def _add_async_action(self, label, coro):
|
def _add_async_action(self, label, coro):
|
||||||
action = QtWidgets.QAction(label, self)
|
action = QtGui.QAction(label, self)
|
||||||
action.triggered.connect(
|
action.triggered.connect(
|
||||||
lambda: asyncio.ensure_future(exc_to_warning(coro())))
|
lambda: asyncio.ensure_future(exc_to_warning(coro())))
|
||||||
self._file_menu.addAction(action)
|
self._file_menu.addAction(action)
|
||||||
|
|
|
@ -95,14 +95,15 @@ class MdiArea(QtWidgets.QMdiArea):
|
||||||
self.pixmap = QtGui.QPixmap(os.path.join(
|
self.pixmap = QtGui.QPixmap(os.path.join(
|
||||||
artiq_dir, "gui", "logo_ver.svg"))
|
artiq_dir, "gui", "logo_ver.svg"))
|
||||||
|
|
||||||
self.setActivationOrder(self.ActivationHistoryOrder)
|
self.setActivationOrder(
|
||||||
|
QtWidgets.QMdiArea.WindowOrder.ActivationHistoryOrder)
|
||||||
|
|
||||||
self.tile = QtWidgets.QShortcut(
|
self.tile = QtGui.QShortcut(
|
||||||
QtGui.QKeySequence('Ctrl+Shift+T'), self)
|
QtGui.QKeySequence('Ctrl+Shift+T'), self)
|
||||||
self.tile.activated.connect(
|
self.tile.activated.connect(
|
||||||
lambda: self.tileSubWindows())
|
lambda: self.tileSubWindows())
|
||||||
|
|
||||||
self.cascade = QtWidgets.QShortcut(
|
self.cascade = QtGui.QShortcut(
|
||||||
QtGui.QKeySequence('Ctrl+Shift+C'), self)
|
QtGui.QKeySequence('Ctrl+Shift+C'), self)
|
||||||
self.cascade.activated.connect(
|
self.cascade.activated.connect(
|
||||||
lambda: self.cascadeSubWindows())
|
lambda: self.cascadeSubWindows())
|
||||||
|
@ -255,7 +256,7 @@ def main():
|
||||||
right_docks = [
|
right_docks = [
|
||||||
d_explorer, d_shortcuts,
|
d_explorer, d_shortcuts,
|
||||||
d_datasets, d_applets,
|
d_datasets, d_applets,
|
||||||
d_waveform, d_interactive_args
|
# d_waveform, d_interactive_args
|
||||||
]
|
]
|
||||||
main_window.addDockWidget(QtCore.Qt.DockWidgetArea.RightDockWidgetArea, right_docks[0])
|
main_window.addDockWidget(QtCore.Qt.DockWidgetArea.RightDockWidgetArea, right_docks[0])
|
||||||
for d1, d2 in zip(right_docks, right_docks[1:]):
|
for d1, d2 in zip(right_docks, right_docks[1:]):
|
||||||
|
|
|
@ -29,7 +29,7 @@ class EntryArea(EntryTreeWidget):
|
||||||
reset_all_button.setToolTip("Reset all to default values")
|
reset_all_button.setToolTip("Reset all to default values")
|
||||||
reset_all_button.setIcon(
|
reset_all_button.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_BrowserReload))
|
QtWidgets.QStyle.StandardPixmap.SP_BrowserReload))
|
||||||
reset_all_button.clicked.connect(self.reset_all)
|
reset_all_button.clicked.connect(self.reset_all)
|
||||||
buttons = LayoutWidget()
|
buttons = LayoutWidget()
|
||||||
buttons.layout.setColumnStretch(0, 1)
|
buttons.layout.setColumnStretch(0, 1)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt6 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from artiq.gui.flowlayout import FlowLayout
|
from artiq.gui.flowlayout import FlowLayout
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class VDragDropSplitter(QtWidgets.QSplitter):
|
||||||
QtWidgets.QSplitter.__init__(self, parent=parent)
|
QtWidgets.QSplitter.__init__(self, parent=parent)
|
||||||
self.setAcceptDrops(True)
|
self.setAcceptDrops(True)
|
||||||
self.setContentsMargins(0, 0, 0, 0)
|
self.setContentsMargins(0, 0, 0, 0)
|
||||||
self.setOrientation(QtCore.Qt.Vertical)
|
self.setOrientation(QtCore.Qt.Orientation.Vertical)
|
||||||
self.setChildrenCollapsible(False)
|
self.setChildrenCollapsible(False)
|
||||||
|
|
||||||
def resetSizes(self):
|
def resetSizes(self):
|
||||||
|
@ -78,7 +78,7 @@ class VDragScrollArea(QtWidgets.QScrollArea):
|
||||||
self._speed = speed
|
self._speed = speed
|
||||||
|
|
||||||
def eventFilter(self, obj, e):
|
def eventFilter(self, obj, e):
|
||||||
if e.type() == QtCore.QEvent.DragMove:
|
if e.type() == QtCore.QEvent.Type.DragMove:
|
||||||
val = self.verticalScrollBar().value()
|
val = self.verticalScrollBar().value()
|
||||||
height = self.viewport().height()
|
height = self.viewport().height()
|
||||||
y = e.pos().y()
|
y = e.pos().y()
|
||||||
|
@ -89,7 +89,7 @@ class VDragScrollArea(QtWidgets.QScrollArea):
|
||||||
self._direction = 1
|
self._direction = 1
|
||||||
if not self._timer.isActive():
|
if not self._timer.isActive():
|
||||||
self._timer.start()
|
self._timer.start()
|
||||||
elif e.type() in (QtCore.QEvent.Drop, QtCore.QEvent.DragLeave):
|
elif e.type() in (QtCore.QEvent.Type.Drop, QtCore.QEvent.Type.DragLeave):
|
||||||
self._timer.stop()
|
self._timer.stop()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ class DragDropFlowLayoutWidget(QtWidgets.QWidget):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
if event.buttons() == QtCore.Qt.LeftButton \
|
if event.buttons() == QtCore.Qt.MouseButton.LeftButton \
|
||||||
and event.modifiers() == QtCore.Qt.ShiftModifier:
|
and event.modifiers() == QtCore.Qt.KeyboardModifier.ShiftModifier:
|
||||||
index = self._get_index(event.pos())
|
index = self._get_index(event.pos())
|
||||||
if index == -1:
|
if index == -1:
|
||||||
return
|
return
|
||||||
|
@ -127,7 +127,7 @@ class DragDropFlowLayoutWidget(QtWidgets.QWidget):
|
||||||
mime.setData("index", str(index).encode())
|
mime.setData("index", str(index).encode())
|
||||||
drag.setMimeData(mime)
|
drag.setMimeData(mime)
|
||||||
pixmapi = QtWidgets.QApplication.style().standardIcon(
|
pixmapi = QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_FileIcon)
|
QtWidgets.QStyle.StandardPixmap.SP_FileIcon)
|
||||||
drag.setPixmap(pixmapi.pixmap(32))
|
drag.setPixmap(pixmapi.pixmap(32))
|
||||||
drag.exec_(QtCore.Qt.MoveAction)
|
drag.exec_(QtCore.Qt.MoveAction)
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
|
@ -82,14 +82,14 @@ class EntryTreeWidget(QtWidgets.QTreeWidget):
|
||||||
reset_entry.setToolTip("Reset to default value")
|
reset_entry.setToolTip("Reset to default value")
|
||||||
reset_entry.setIcon(
|
reset_entry.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_BrowserReload))
|
QtWidgets.QStyle.StandardPixmap.SP_BrowserReload))
|
||||||
reset_entry.clicked.connect(partial(self.reset_entry, key))
|
reset_entry.clicked.connect(partial(self.reset_entry, key))
|
||||||
|
|
||||||
disable_other_scans = QtWidgets.QToolButton()
|
disable_other_scans = QtWidgets.QToolButton()
|
||||||
widgets["disable_other_scans"] = disable_other_scans
|
widgets["disable_other_scans"] = disable_other_scans
|
||||||
disable_other_scans.setIcon(
|
disable_other_scans.setIcon(
|
||||||
QtWidgets.QApplication.style().standardIcon(
|
QtWidgets.QApplication.style().standardIcon(
|
||||||
QtWidgets.QStyle.SP_DialogResetButton))
|
QtWidgets.QStyle.StandardPixmap.SP_DialogResetButton))
|
||||||
disable_other_scans.setToolTip("Disable other scans")
|
disable_other_scans.setToolTip("Disable other scans")
|
||||||
disable_other_scans.clicked.connect(
|
disable_other_scans.clicked.connect(
|
||||||
partial(self._disable_other_scans, key))
|
partial(self._disable_other_scans, key))
|
||||||
|
|
Loading…
Reference in New Issue