gui: remove pyqtgraph

This commit is contained in:
Sebastien Bourdeauducq 2016-02-15 00:23:47 +01:00
parent 3ab35f7f8d
commit d30fe60edd
12 changed files with 202 additions and 202 deletions

View File

@ -5,9 +5,8 @@ import asyncio
import atexit
import os
import PyQt5
from quamash import QEventLoop, QtGui, QtCore, QtWidgets
import pyqtgraph
from PyQt5 import QtCore, QtGui, QtWidgets
from quamash import QEventLoop
from artiq import __artiq_dir__ as artiq_dir
from artiq.tools import *
@ -35,9 +34,9 @@ def get_argparser():
return parser
class MainWindow(QtGui.QMainWindow):
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, server):
QtGui.QMainWindow.__init__(self)
QtWidgets.QMainWindow.__init__(self)
icon = QtGui.QIcon(os.path.join(artiq_dir, "gui", "icon.png"))
self.setWindowIcon(icon)
self.setWindowTitle("ARTIQ - {}".format(server))
@ -62,7 +61,7 @@ def main():
args = get_argparser().parse_args()
init_logger(args)
app = QtGui.QApplication([])
app = QtWidgets.QApplication([])
loop = QEventLoop(app)
asyncio.set_event_loop(loop)
atexit.register(loop.close)
@ -91,7 +90,7 @@ def main():
# initialize main window
main_window = MainWindow(args.server)
smgr.register(main_window)
status_bar = QtGui.QStatusBar()
status_bar = QtWidgets.QStatusBar()
status_bar.showMessage("Connected to {}".format(args.server))
main_window.setStatusBar(status_bar)

View File

@ -4,7 +4,7 @@ import sys
import shlex
from functools import partial
from quamash import QtCore, QtGui, QtWidgets
from PyQt5 import QtCore, QtGui, QtWidgets
from artiq.protocols.pipe_ipc import AsyncioParentComm
from artiq.protocols import pyon
@ -195,35 +195,35 @@ class AppletsDock(QtWidgets.QDockWidget):
self.table = QtWidgets.QTableWidget(0, 3)
self.table.setHorizontalHeaderLabels(["Enable", "Name", "Command"])
self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.table.horizontalHeader().setStretchLastSection(True)
self.table.horizontalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.table.verticalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.table.horizontalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.table.verticalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.table.verticalHeader().hide()
self.table.setTextElideMode(QtCore.Qt.ElideNone)
self.setWidget(self.table)
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
new_action = QtGui.QAction("New applet", self.table)
new_action = QtWidgets.QAction("New applet", self.table)
new_action.triggered.connect(self.new)
self.table.addAction(new_action)
templates_menu = QtGui.QMenu()
templates_menu = QtWidgets.QMenu()
for name, template in _templates:
action = QtGui.QAction(name, self.table)
action = QtWidgets.QAction(name, self.table)
action.triggered.connect(partial(self.new_template, template))
templates_menu.addAction(action)
restart_action = QtGui.QAction("New applet from template", self.table)
restart_action = QtWidgets.QAction("New applet from template", self.table)
restart_action.setMenu(templates_menu)
self.table.addAction(restart_action)
restart_action = QtGui.QAction("Restart selected applet", self.table)
restart_action = QtWidgets.QAction("Restart selected applet", self.table)
restart_action.setShortcut("CTRL+R")
restart_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
restart_action.triggered.connect(self.restart)
self.table.addAction(restart_action)
delete_action = QtGui.QAction("Delete selected applet", self.table)
delete_action = QtWidgets.QAction("Delete selected applet", self.table)
delete_action.setShortcut("DELETE")
delete_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
delete_action.triggered.connect(self.delete)

View File

@ -3,7 +3,7 @@ from collections import OrderedDict
from functools import partial
import logging
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from artiq.tools import short_format
from artiq.gui.tools import LayoutWidget
@ -39,19 +39,20 @@ class DatasetsDock(QtWidgets.QDockWidget):
grid = LayoutWidget()
self.setWidget(grid)
self.search = QtGui.QLineEdit()
self.search = QtWidgets.QLineEdit()
self.search.setPlaceholderText("search...")
self.search.editingFinished.connect(self._search_datasets)
grid.addWidget(self.search, 0, 0)
self.table = QtGui.QTreeView()
self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.table.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.table = QtWidgets.QTreeView()
self.table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.table.header().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
grid.addWidget(self.table, 1, 0)
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
delete_action = QtGui.QAction("Delete dataset", self.table)
delete_action = QtWidgets.QAction("Delete dataset", self.table)
delete_action.triggered.connect(self.delete_clicked)
delete_action.setShortcut("DELETE")
delete_action.setShortcutContext(QtCore.Qt.WidgetShortcut)

View File

@ -1,7 +1,7 @@
import logging
from collections import OrderedDict
from quamash import QtGui, QtCore
from PyQt5 import QtCore, QtGui, QtWidgets
from artiq.gui.tools import LayoutWidget, disable_scroll_wheel
@ -9,9 +9,9 @@ from artiq.gui.tools import LayoutWidget, disable_scroll_wheel
logger = logging.getLogger(__name__)
class _StringEntry(QtGui.QLineEdit):
class _StringEntry(QtWidgets.QLineEdit):
def __init__(self, argument):
QtGui.QLineEdit.__init__(self)
QtWidgets.QLineEdit.__init__(self)
self.setText(argument["state"])
def update(text):
argument["state"] = text
@ -26,9 +26,9 @@ class _StringEntry(QtGui.QLineEdit):
return procdesc.get("default", "")
class _BooleanEntry(QtGui.QCheckBox):
class _BooleanEntry(QtWidgets.QCheckBox):
def __init__(self, argument):
QtGui.QCheckBox.__init__(self)
QtWidgets.QCheckBox.__init__(self)
self.setChecked(argument["state"])
def update(checked):
argument["state"] = bool(checked)
@ -43,9 +43,9 @@ class _BooleanEntry(QtGui.QCheckBox):
return procdesc.get("default", False)
class _EnumerationEntry(QtGui.QComboBox):
class _EnumerationEntry(QtWidgets.QComboBox):
def __init__(self, argument):
QtGui.QComboBox.__init__(self)
QtWidgets.QComboBox.__init__(self)
disable_scroll_wheel(self)
choices = argument["desc"]["choices"]
self.addItems(choices)
@ -67,9 +67,9 @@ class _EnumerationEntry(QtGui.QComboBox):
return procdesc["choices"][0]
class _NumberEntry(QtGui.QDoubleSpinBox):
class _NumberEntry(QtWidgets.QDoubleSpinBox):
def __init__(self, argument):
QtGui.QDoubleSpinBox.__init__(self)
QtWidgets.QDoubleSpinBox.__init__(self)
disable_scroll_wheel(self)
procdesc = argument["desc"]
scale = procdesc["scale"]
@ -108,7 +108,7 @@ class _NoScan(LayoutWidget):
LayoutWidget.__init__(self)
scale = procdesc["scale"]
self.value = QtGui.QDoubleSpinBox()
self.value = QtWidgets.QDoubleSpinBox()
disable_scroll_wheel(self.value)
self.value.setDecimals(procdesc["ndecimals"])
if procdesc["global_min"] is not None:
@ -122,7 +122,7 @@ class _NoScan(LayoutWidget):
self.value.setSingleStep(procdesc["global_step"]/scale)
if procdesc["unit"]:
self.value.setSuffix(" " + procdesc["unit"])
self.addWidget(QtGui.QLabel("Value:"), 0, 0)
self.addWidget(QtWidgets.QLabel("Value:"), 0, 0)
self.addWidget(self.value, 0, 1)
self.value.setValue(state["value"]/scale)
@ -151,20 +151,20 @@ class _RangeScan(LayoutWidget):
if procdesc["unit"]:
spinbox.setSuffix(" " + procdesc["unit"])
self.addWidget(QtGui.QLabel("Min:"), 0, 0)
self.min = QtGui.QDoubleSpinBox()
self.addWidget(QtWidgets.QLabel("Min:"), 0, 0)
self.min = QtWidgets.QDoubleSpinBox()
disable_scroll_wheel(self.min)
apply_properties(self.min)
self.addWidget(self.min, 0, 1)
self.addWidget(QtGui.QLabel("Max:"), 1, 0)
self.max = QtGui.QDoubleSpinBox()
self.addWidget(QtWidgets.QLabel("Max:"), 1, 0)
self.max = QtWidgets.QDoubleSpinBox()
disable_scroll_wheel(self.max)
apply_properties(self.max)
self.addWidget(self.max, 1, 1)
self.addWidget(QtGui.QLabel("#Points:"), 2, 0)
self.npoints = QtGui.QSpinBox()
self.addWidget(QtWidgets.QLabel("#Points:"), 2, 0)
self.npoints = QtWidgets.QSpinBox()
disable_scroll_wheel(self.npoints)
self.npoints.setMinimum(2)
self.npoints.setValue(10)
@ -188,8 +188,8 @@ class _ExplicitScan(LayoutWidget):
def __init__(self, state):
LayoutWidget.__init__(self)
self.value = QtGui.QLineEdit()
self.addWidget(QtGui.QLabel("Sequence:"), 0, 0)
self.value = QtWidgets.QLineEdit()
self.addWidget(QtWidgets.QLabel("Sequence:"), 0, 0)
self.addWidget(self.value, 0, 1)
float_regexp = "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
@ -208,7 +208,7 @@ class _ScanEntry(LayoutWidget):
LayoutWidget.__init__(self)
self.argument = argument
self.stack = QtGui.QStackedWidget()
self.stack = QtWidgets.QStackedWidget()
self.addWidget(self.stack, 1, 0, colspan=4)
procdesc = argument["desc"]
@ -222,11 +222,11 @@ class _ScanEntry(LayoutWidget):
self.stack.addWidget(widget)
self.radiobuttons = OrderedDict()
self.radiobuttons["NoScan"] = QtGui.QRadioButton("No scan")
self.radiobuttons["LinearScan"] = QtGui.QRadioButton("Linear")
self.radiobuttons["RandomScan"] = QtGui.QRadioButton("Random")
self.radiobuttons["ExplicitScan"] = QtGui.QRadioButton("Explicit")
scan_type = QtGui.QButtonGroup()
self.radiobuttons["NoScan"] = QtWidgets.QRadioButton("No scan")
self.radiobuttons["LinearScan"] = QtWidgets.QRadioButton("Linear")
self.radiobuttons["RandomScan"] = QtWidgets.QRadioButton("Random")
self.radiobuttons["ExplicitScan"] = QtWidgets.QRadioButton("Explicit")
scan_type = QtWidgets.QButtonGroup()
for n, b in enumerate(self.radiobuttons.values()):
self.addWidget(b, 0, n)
scan_type.addButton(b)

View File

@ -3,7 +3,7 @@ import asyncio
from functools import partial
from collections import OrderedDict
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtGui, QtWidgets
from artiq.gui.tools import (LayoutWidget, log_level_to_name,
QDockWidgetCloseDetect)
@ -19,25 +19,25 @@ logger = logging.getLogger(__name__)
# 2. file:<class name>@<file name>
class _ArgumentEditor(QtGui.QTreeWidget):
class _ArgumentEditor(QtWidgets.QTreeWidget):
def __init__(self, manager, dock, expurl):
self.manager = manager
self.expurl = expurl
QtGui.QTreeWidget.__init__(self)
QtWidgets.QTreeWidget.__init__(self)
self.setColumnCount(3)
self.header().setStretchLastSection(False)
if hasattr(self.header(), "setSectionResizeMode"):
set_resize_mode = self.header().setSectionResizeMode
else:
set_resize_mode = self.header().setResizeMode
set_resize_mode(0, QtGui.QHeaderView.ResizeToContents)
set_resize_mode(1, QtGui.QHeaderView.Stretch)
set_resize_mode(2, QtGui.QHeaderView.ResizeToContents)
set_resize_mode(0, QtWidgets.QHeaderView.ResizeToContents)
set_resize_mode(1, QtWidgets.QHeaderView.Stretch)
set_resize_mode(2, QtWidgets.QHeaderView.ResizeToContents)
self.header().setVisible(False)
self.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
self.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
self._groups = dict()
self._arg_to_entry_widgetitem = dict()
@ -45,11 +45,11 @@ class _ArgumentEditor(QtGui.QTreeWidget):
arguments = self.manager.get_submission_arguments(self.expurl)
if not arguments:
self.addTopLevelItem(QtGui.QTreeWidgetItem(["No arguments"]))
self.addTopLevelItem(QtWidgets.QTreeWidgetItem(["No arguments"]))
for name, argument in arguments.items():
entry = argty_to_entry[argument["desc"]["ty"]](argument)
widget_item = QtGui.QTreeWidgetItem([name])
widget_item = QtWidgets.QTreeWidgetItem([name])
self._arg_to_entry_widgetitem[name] = entry, widget_item
if argument["group"] is None:
@ -57,24 +57,24 @@ class _ArgumentEditor(QtGui.QTreeWidget):
else:
self._get_group(argument["group"]).addChild(widget_item)
self.setItemWidget(widget_item, 1, entry)
recompute_argument = QtGui.QToolButton()
recompute_argument = QtWidgets.QToolButton()
recompute_argument.setToolTip("Re-run the experiment's build "
"method and take the default value")
recompute_argument.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_BrowserReload))
recompute_argument.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_BrowserReload))
recompute_argument.clicked.connect(
partial(self._recompute_argument_clicked, name))
fix_layout = LayoutWidget()
fix_layout.addWidget(recompute_argument)
self.setItemWidget(widget_item, 2, fix_layout)
widget_item = QtGui.QTreeWidgetItem()
widget_item = QtWidgets.QTreeWidgetItem()
self.addTopLevelItem(widget_item)
recompute_arguments = QtGui.QPushButton("Recompute all arguments")
recompute_arguments.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_BrowserReload))
recompute_arguments.setSizePolicy(QtGui.QSizePolicy.Maximum,
QtGui.QSizePolicy.Maximum)
recompute_arguments = QtWidgets.QPushButton("Recompute all arguments")
recompute_arguments.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_BrowserReload))
recompute_arguments.setSizePolicy(QtWidgets.QSizePolicy.Maximum,
QtWidgets.QSizePolicy.Maximum)
recompute_arguments.clicked.connect(dock._recompute_arguments_clicked)
fix_layout = LayoutWidget()
fix_layout.addWidget(recompute_arguments)
@ -83,7 +83,7 @@ class _ArgumentEditor(QtGui.QTreeWidget):
def _get_group(self, name):
if name in self._groups:
return self._groups[name]
group = QtGui.QTreeWidgetItem([name])
group = QtWidgets.QTreeWidgetItem([name])
for c in 0, 1:
group.setBackground(c, QtGui.QBrush(QtGui.QColor(100, 100, 100)))
group.setForeground(c, QtGui.QBrush(QtGui.QColor(220, 220, 255)))
@ -155,9 +155,9 @@ class _ExperimentDock(QDockWidgetCloseDetect):
scheduling = manager.get_submission_scheduling(expurl)
options = manager.get_submission_options(expurl)
datetime = QtGui.QDateTimeEdit()
datetime = QtWidgets.QDateTimeEdit()
datetime.setDisplayFormat("MMM d yyyy hh:mm:ss")
datetime_en = QtGui.QCheckBox("Due date:")
datetime_en = QtWidgets.QCheckBox("Due date:")
self.layout.addWidget(datetime_en, 1, 0)
self.layout.addWidget(datetime, 1, 1)
@ -179,8 +179,8 @@ class _ExperimentDock(QDockWidgetCloseDetect):
scheduling["due_date"] = due_date
datetime_en.stateChanged.connect(update_datetime_en)
pipeline_name = QtGui.QLineEdit()
self.layout.addWidget(QtGui.QLabel("Pipeline:"), 1, 2)
pipeline_name = QtWidgets.QLineEdit()
self.layout.addWidget(QtWidgets.QLabel("Pipeline:"), 1, 2)
self.layout.addWidget(pipeline_name, 1, 3)
pipeline_name.setText(scheduling["pipeline_name"])
@ -188,9 +188,9 @@ class _ExperimentDock(QDockWidgetCloseDetect):
scheduling["pipeline_name"] = text
pipeline_name.textEdited.connect(update_pipeline_name)
priority = QtGui.QSpinBox()
priority = QtWidgets.QSpinBox()
priority.setRange(-99, 99)
self.layout.addWidget(QtGui.QLabel("Priority:"), 2, 0)
self.layout.addWidget(QtWidgets.QLabel("Priority:"), 2, 0)
self.layout.addWidget(priority, 2, 1)
priority.setValue(scheduling["priority"])
@ -198,7 +198,7 @@ class _ExperimentDock(QDockWidgetCloseDetect):
scheduling["priority"] = value
priority.valueChanged.connect(update_priority)
flush = QtGui.QCheckBox("Flush")
flush = QtWidgets.QCheckBox("Flush")
flush.setToolTip("Flush the pipeline before starting the experiment")
self.layout.addWidget(flush, 2, 2, 1, 2)
@ -207,12 +207,12 @@ class _ExperimentDock(QDockWidgetCloseDetect):
scheduling["flush"] = bool(checked)
flush.stateChanged.connect(update_flush)
log_level = QtGui.QComboBox()
log_level = QtWidgets.QComboBox()
log_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
log_level.addItems(log_levels)
log_level.setCurrentIndex(1)
log_level.setToolTip("Minimum level for log entry production")
log_level_label = QtGui.QLabel("Logging level:")
log_level_label = QtWidgets.QLabel("Logging level:")
log_level_label.setToolTip("Minimum level for log message production")
self.layout.addWidget(log_level_label, 3, 0)
self.layout.addWidget(log_level, 3, 1)
@ -224,9 +224,9 @@ class _ExperimentDock(QDockWidgetCloseDetect):
log_level.currentIndexChanged.connect(update_log_level)
if "repo_rev" in options:
repo_rev = QtGui.QLineEdit()
repo_rev = QtWidgets.QLineEdit()
repo_rev.setPlaceholderText("current")
repo_rev_label = QtGui.QLabel("Revision:")
repo_rev_label = QtWidgets.QLabel("Revision:")
repo_rev_label.setToolTip("Experiment repository revision "
"(commit ID) to use")
self.layout.addWidget(repo_rev_label, 3, 2)
@ -241,23 +241,23 @@ class _ExperimentDock(QDockWidgetCloseDetect):
options["repo_rev"] = None
repo_rev.textEdited.connect(update_repo_rev)
submit = QtGui.QPushButton("Submit")
submit.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogOkButton))
submit = QtWidgets.QPushButton("Submit")
submit.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOkButton))
submit.setToolTip("Schedule the experiment (Ctrl+Return)")
submit.setShortcut("CTRL+RETURN")
submit.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
submit.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding)
self.layout.addWidget(submit, 1, 4, 2, 1)
submit.clicked.connect(self.submit_clicked)
reqterm = QtGui.QPushButton("Terminate instances")
reqterm.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogCancelButton))
reqterm = QtWidgets.QPushButton("Terminate instances")
reqterm.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogCancelButton))
reqterm.setToolTip("Request termination of instances (Ctrl+Backspace)")
reqterm.setShortcut("CTRL+BACKSPACE")
reqterm.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
reqterm.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding)
self.layout.addWidget(reqterm, 3, 4)
reqterm.clicked.connect(self.reqterm_clicked)

View File

@ -2,7 +2,7 @@ import asyncio
import logging
from functools import partial
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from artiq.gui.tools import LayoutWidget
from artiq.gui.models import DictSyncTreeSepModel
@ -11,9 +11,9 @@ from artiq.gui.models import DictSyncTreeSepModel
logger = logging.getLogger(__name__)
class _OpenFileDialog(QtGui.QDialog):
class _OpenFileDialog(QtWidgets.QDialog):
def __init__(self, explorer, exp_manager, experiment_db_ctl):
QtGui.QDialog.__init__(self, parent=explorer)
QtWidgets.QDialog.__init__(self, parent=explorer)
self.resize(710, 700)
self.setWindowTitle("Open file outside repository")
@ -21,21 +21,21 @@ class _OpenFileDialog(QtGui.QDialog):
self.exp_manager = exp_manager
self.experiment_db_ctl = experiment_db_ctl
grid = QtGui.QGridLayout()
grid = QtWidgets.QGridLayout()
self.setLayout(grid)
grid.addWidget(QtGui.QLabel("Location:"), 0, 0)
self.location_label = QtGui.QLabel("")
grid.addWidget(QtWidgets.QLabel("Location:"), 0, 0)
self.location_label = QtWidgets.QLabel("")
grid.addWidget(self.location_label, 0, 1)
grid.setColumnStretch(1, 1)
self.file_list = QtGui.QListWidget()
self.file_list = QtWidgets.QListWidget()
asyncio.ensure_future(self.refresh_view())
grid.addWidget(self.file_list, 1, 0, 1, 2)
self.file_list.doubleClicked.connect(self.accept)
buttons = QtGui.QDialogButtonBox(
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
buttons = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
grid.addWidget(buttons, 2, 0, 1, 2)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
@ -47,10 +47,10 @@ class _OpenFileDialog(QtGui.QDialog):
else:
self.location_label.setText(self.explorer.current_directory)
item = QtGui.QListWidgetItem()
item = QtWidgets.QListWidgetItem()
item.setText("..")
item.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_FileDialogToParent))
item.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_FileDialogToParent))
self.file_list.addItem(item)
try:
@ -62,14 +62,14 @@ class _OpenFileDialog(QtGui.QDialog):
self.explorer.current_directory = ""
for name in sorted(contents, key=lambda x: (x[-1] not in "\\/", x)):
if name[-1] in "\\/":
icon = QtGui.QStyle.SP_DirIcon
icon = QtWidgets.QStyle.SP_DirIcon
else:
icon = QtGui.QStyle.SP_FileIcon
icon = QtWidgets.QStyle.SP_FileIcon
if name[-3:] != ".py":
continue
item = QtGui.QListWidgetItem()
item = QtWidgets.QListWidgetItem()
item.setText(name)
item.setIcon(QtGui.QApplication.style().standardIcon(icon))
item.setIcon(QtWidgets.QApplication.style().standardIcon(icon))
self.file_list.addItem(item)
def accept(self):
@ -107,7 +107,7 @@ class _OpenFileDialog(QtGui.QDialog):
logger.error("Failed to open file '%s'",
file, exc_info=True)
asyncio.ensure_future(open_task())
QtGui.QDialog.accept(self)
QtWidgets.QDialog.accept(self)
class Model(DictSyncTreeSepModel):
@ -130,24 +130,24 @@ class Explorer(QtWidgets.QWidget):
self.d_shortcuts = d_shortcuts
self.schedule_ctl = schedule_ctl
self.el = QtGui.QTreeView()
self.el = QtWidgets.QTreeView()
self.el.setHeaderHidden(True)
self.el.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)
self.el.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectItems)
layout.addWidget(self.el, 0, 0, 1, 2)
self.el.doubleClicked.connect(
partial(self.expname_action, "open_experiment"))
open = QtGui.QPushButton("Open")
open.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogOpenButton))
open = QtWidgets.QPushButton("Open")
open.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOpenButton))
open.setToolTip("Open the selected experiment (Return)")
layout.addWidget(open, 1, 0)
open.clicked.connect(
partial(self.expname_action, "open_experiment"))
submit = QtGui.QPushButton("Submit")
submit.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogOkButton))
submit = QtWidgets.QPushButton("Submit")
submit.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOkButton))
submit.setToolTip("Schedule the selected experiment (Ctrl+Return)")
layout.addWidget(submit, 1, 1)
submit.clicked.connect(
@ -157,41 +157,41 @@ class Explorer(QtWidgets.QWidget):
explist_sub.add_setmodel_callback(self.set_model)
self.el.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
open_action = QtGui.QAction("Open", self.el)
open_action = QtWidgets.QAction("Open", self.el)
open_action.triggered.connect(
partial(self.expname_action, "open_experiment"))
open_action.setShortcut("RETURN")
open_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.el.addAction(open_action)
submit_action = QtGui.QAction("Submit", self.el)
submit_action = QtWidgets.QAction("Submit", self.el)
submit_action.triggered.connect(
partial(self.expname_action, "submit"))
submit_action.setShortcut("CTRL+RETURN")
submit_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.el.addAction(submit_action)
reqterm_action = QtGui.QAction("Request termination of instances", self.el)
reqterm_action = QtWidgets.QAction("Request termination of instances", self.el)
reqterm_action.triggered.connect(
partial(self.expname_action, "request_inst_term"))
reqterm_action.setShortcut("CTRL+BACKSPACE")
reqterm_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.el.addAction(reqterm_action)
set_shortcut_menu = QtGui.QMenu()
set_shortcut_menu = QtWidgets.QMenu()
for i in range(12):
action = QtGui.QAction("F" + str(i+1), self.el)
action = QtWidgets.QAction("F" + str(i+1), self.el)
action.triggered.connect(partial(self.set_shortcut, i))
set_shortcut_menu.addAction(action)
set_shortcut_action = QtGui.QAction("Set shortcut", self.el)
set_shortcut_action = QtWidgets.QAction("Set shortcut", self.el)
set_shortcut_action.setMenu(set_shortcut_menu)
self.el.addAction(set_shortcut_action)
sep = QtGui.QAction(self.el)
sep = QtWidgets.QAction(self.el)
sep.setSeparator(True)
self.el.addAction(sep)
scan_repository_action = QtGui.QAction("Scan repository HEAD",
self.el)
scan_repository_action = QtWidgets.QAction("Scan repository HEAD",
self.el)
def scan_repository():
asyncio.ensure_future(experiment_db_ctl.scan_repository_async())
self.status_bar.showMessage("Requested repository scan")
@ -199,8 +199,8 @@ class Explorer(QtWidgets.QWidget):
self.el.addAction(scan_repository_action)
self.current_directory = ""
open_file_action = QtGui.QAction("Open file outside repository",
self.el)
open_file_action = QtWidgets.QAction("Open file outside repository",
self.el)
open_file_action.triggered.connect(
lambda: _OpenFileDialog(self, self.exp_manager,
experiment_db_ctl).open())

View File

@ -4,7 +4,7 @@ import time
import re
from functools import partial
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtGui, QtWidgets
from artiq.gui.tools import (LayoutWidget, log_level_to_name,
QDockWidgetCloseDetect)
@ -148,46 +148,46 @@ class _LogDock(QDockWidgetCloseDetect):
grid = LayoutWidget()
self.setWidget(grid)
grid.addWidget(QtGui.QLabel("Minimum level: "), 0, 0)
self.filter_level = QtGui.QComboBox()
grid.addWidget(QtWidgets.QLabel("Minimum level: "), 0, 0)
self.filter_level = QtWidgets.QComboBox()
self.filter_level.addItems(["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"])
self.filter_level.setToolTip("Display entries at or above this level")
grid.addWidget(self.filter_level, 0, 1)
self.filter_level.currentIndexChanged.connect(
self.filter_level_changed)
self.filter_freetext = QtGui.QLineEdit()
self.filter_freetext = QtWidgets.QLineEdit()
self.filter_freetext.setPlaceholderText("freetext filter...")
self.filter_freetext.editingFinished.connect(
self.filter_freetext_changed)
grid.addWidget(self.filter_freetext, 0, 2)
scrollbottom = QtGui.QToolButton()
scrollbottom = QtWidgets.QToolButton()
scrollbottom.setToolTip("Scroll to bottom")
scrollbottom.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_ArrowDown))
scrollbottom.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_ArrowDown))
grid.addWidget(scrollbottom, 0, 3)
scrollbottom.clicked.connect(self.scroll_to_bottom)
newdock = QtGui.QToolButton()
newdock = QtWidgets.QToolButton()
newdock.setToolTip("Create new log dock")
newdock.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_FileDialogNewFolder))
newdock.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_FileDialogNewFolder))
# note the lambda, the default parameter is overriden otherwise
newdock.clicked.connect(lambda: manager.create_new_dock())
grid.addWidget(newdock, 0, 4)
grid.layout.setColumnStretch(2, 1)
self.log = QtGui.QTableView()
self.log.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
self.log.horizontalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.log = QtWidgets.QTableView()
self.log.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.log.horizontalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.log.horizontalHeader().setStretchLastSection(True)
self.log.verticalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.log.verticalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.log.verticalHeader().hide()
self.log.setHorizontalScrollMode(
QtGui.QAbstractItemView.ScrollPerPixel)
QtWidgets.QAbstractItemView.ScrollPerPixel)
self.log.setVerticalScrollMode(
QtGui.QAbstractItemView.ScrollPerPixel)
QtWidgets.QAbstractItemView.ScrollPerPixel)
self.log.setShowGrid(False)
self.log.setTextElideMode(QtCore.Qt.ElideNone)
grid.addWidget(self.log, 1, 0, colspan=5)

View File

@ -1,4 +1,4 @@
from quamash import QtCore
from PyQt5 import QtCore
from artiq.protocols.sync_struct import Subscriber

View File

@ -4,7 +4,7 @@ import socket
import struct
from operator import itemgetter
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from artiq.tools import TaskObject
from artiq.protocols.sync_struct import Subscriber
@ -21,56 +21,56 @@ _mode_enc = {
}
class _TTLWidget(QtGui.QFrame):
class _TTLWidget(QtWidgets.QFrame):
def __init__(self, channel, send_to_device, force_out, title):
self.channel = channel
self.send_to_device = send_to_device
self.force_out = force_out
QtGui.QFrame.__init__(self)
QtWidgets.QFrame.__init__(self)
self.setFrameShape(QtGui.QFrame.Panel)
self.setFrameShadow(QtGui.QFrame.Raised)
self.setFrameShape(QtWidgets.QFrame.Panel)
self.setFrameShadow(QtWidgets.QFrame.Raised)
grid = QtGui.QGridLayout()
grid = QtWidgets.QGridLayout()
self.setLayout(grid)
label = QtGui.QLabel(title)
label = QtWidgets.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
label.setWordWrap(True)
grid.addWidget(label, 1, 1)
self._direction = QtGui.QLabel()
self._direction = QtWidgets.QLabel()
self._direction.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(self._direction, 2, 1)
self._override = QtGui.QLabel()
self._override = QtWidgets.QLabel()
self._override.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(self._override, 3, 1)
self._value = QtGui.QLabel()
self._value = QtWidgets.QLabel()
self._value.setAlignment(QtCore.Qt.AlignCenter)
grid.addWidget(self._value, 4, 1, 6, 1)
self._value.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
menu = QtGui.QActionGroup(self._value)
menu = QtWidgets.QActionGroup(self._value)
menu.setExclusive(True)
self._expctl_action = QtGui.QAction("Experiment controlled", self._value)
self._expctl_action = QtWidgets.QAction("Experiment controlled", self._value)
self._expctl_action.setCheckable(True)
menu.addAction(self._expctl_action)
self._value.addAction(self._expctl_action)
self._expctl_action.triggered.connect(lambda: self.set_mode("exp"))
separator = QtGui.QAction(self._value)
separator = QtWidgets.QAction(self._value)
separator.setSeparator(True)
self._value.addAction(separator)
self._force1_action = QtGui.QAction("Force 1", self._value)
self._force1_action = QtWidgets.QAction("Force 1", self._value)
self._force1_action.setCheckable(True)
menu.addAction(self._force1_action)
self._value.addAction(self._force1_action)
self._force1_action.triggered.connect(lambda: self.set_mode("1"))
self._force0_action = QtGui.QAction("Force 0", self._value)
self._force0_action = QtWidgets.QAction("Force 0", self._value)
self._force0_action.setCheckable(True)
menu.addAction(self._force0_action)
self._value.addAction(self._force0_action)
self._force0_action.triggered.connect(lambda: self.set_mode("0"))
self._forcein_action = QtGui.QAction("Force input", self._value)
self._forcein_action = QtWidgets.QAction("Force input", self._value)
self._forcein_action.setCheckable(True)
self._forcein_action.setEnabled(not force_out)
menu.addAction(self._forcein_action)
@ -117,24 +117,24 @@ class _TTLWidget(QtGui.QFrame):
self._expctl_action.setChecked(True)
class _DDSWidget(QtGui.QFrame):
class _DDSWidget(QtWidgets.QFrame):
def __init__(self, channel, sysclk, title):
self.channel = channel
self.sysclk = sysclk
QtGui.QFrame.__init__(self)
QtWidgets.QFrame.__init__(self)
self.setFrameShape(QtGui.QFrame.Panel)
self.setFrameShadow(QtGui.QFrame.Raised)
self.setFrameShape(QtWidgets.QFrame.Panel)
self.setFrameShadow(QtWidgets.QFrame.Raised)
grid = QtGui.QGridLayout()
grid = QtWidgets.QGridLayout()
self.setLayout(grid)
label = QtGui.QLabel(title)
label = QtWidgets.QLabel(title)
label.setAlignment(QtCore.Qt.AlignCenter)
label.setWordWrap(True)
grid.addWidget(label, 1, 1)
self._value = QtGui.QLabel()
self._value = QtWidgets.QLabel()
self._value.setAlignment(QtCore.Qt.AlignCenter)
self._value.setWordWrap(True)
grid.addWidget(self._value, 2, 1, 6, 1)
@ -219,8 +219,8 @@ class _MonInjDock(QtWidgets.QDockWidget):
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
QtWidgets.QDockWidget.DockWidgetFloatable)
self.grid = QtGui.QGridLayout()
gridw = QtGui.QWidget()
self.grid = QtWidgets.QGridLayout()
gridw = QtWidgets.QWidget()
gridw.setLayout(self.grid)
self.setWidget(gridw)

View File

@ -2,7 +2,7 @@ import asyncio
import time
from functools import partial
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from artiq.gui.models import DictSyncModel
from artiq.tools import elide
@ -64,23 +64,23 @@ class ScheduleDock(QtWidgets.QDockWidget):
self.status_bar = status_bar
self.schedule_ctl = schedule_ctl
self.table = QtGui.QTableView()
self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.table.horizontalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.table.verticalHeader().setResizeMode(
QtGui.QHeaderView.ResizeToContents)
self.table = QtWidgets.QTableView()
self.table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.table.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.table.horizontalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.table.verticalHeader().setSectionResizeMode(
QtWidgets.QHeaderView.ResizeToContents)
self.table.verticalHeader().hide()
self.setWidget(self.table)
self.table.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
request_termination_action = QtGui.QAction("Request termination", self.table)
request_termination_action = QtWidgets.QAction("Request termination", self.table)
request_termination_action.triggered.connect(partial(self.delete_clicked, True))
request_termination_action.setShortcut("DELETE")
request_termination_action.setShortcutContext(QtCore.Qt.WidgetShortcut)
self.table.addAction(request_termination_action)
delete_action = QtGui.QAction("Delete", self.table)
delete_action = QtWidgets.QAction("Delete", self.table)
delete_action.triggered.connect(partial(self.delete_clicked, False))
delete_action.setShortcut("SHIFT+DELETE")
delete_action.setShortcutContext(QtCore.Qt.WidgetShortcut)

View File

@ -1,7 +1,7 @@
import logging
from functools import partial
from quamash import QtGui, QtCore, QtWidgets
from PyQt5 import QtCore, QtWidgets
from artiq.gui.tools import LayoutWidget
@ -27,7 +27,7 @@ class ShortcutsDock(QtWidgets.QDockWidget):
self.shortcut_widgets = dict()
for n, title in enumerate(["Key", "Experiment"]):
label = QtGui.QLabel("<b>" + title + "</b>")
label = QtWidgets.QLabel("<b>" + title + "</b>")
layout.addWidget(label, 0, n)
label.setMaximumHeight(label.sizeHint().height())
layout.setColumnStretch(1, 1)
@ -35,28 +35,28 @@ class ShortcutsDock(QtWidgets.QDockWidget):
for i in range(12):
row = i + 1
layout.addWidget(QtGui.QLabel("F" + str(i+1)), row, 0)
layout.addWidget(QtWidgets.QLabel("F" + str(i+1)), row, 0)
label = QtGui.QLabel()
label.setSizePolicy(QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Ignored)
label = QtWidgets.QLabel()
label.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
QtWidgets.QSizePolicy.Ignored)
layout.addWidget(label, row, 1)
clear = QtGui.QToolButton()
clear.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogResetButton))
clear = QtWidgets.QToolButton()
clear.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogResetButton))
layout.addWidget(clear, row, 2)
clear.clicked.connect(partial(self.set_shortcut, i, ""))
open = QtGui.QToolButton()
open.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogOpenButton))
open = QtWidgets.QToolButton()
open.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOpenButton))
layout.addWidget(open, row, 3)
open.clicked.connect(partial(self._open_experiment, i))
submit = QtGui.QPushButton("Submit")
submit.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_DialogOkButton))
submit = QtWidgets.QPushButton("Submit")
submit.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOkButton))
layout.addWidget(submit, row, 4)
submit.clicked.connect(partial(self._activated, i))

View File

@ -39,9 +39,9 @@ class QDockWidgetCloseDetect(QtWidgets.QDockWidget):
class LayoutWidget(QtWidgets.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.layout = QtGui.QGridLayout()
QtWidgets.QWidget.__init__(self, parent)
self.layout = QtWidgets.QGridLayout()
self.setLayout(self.layout)
def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1):
def addWidget(self, item, row=0, col=0, rowspan=1, colspan=1):
self.layout.addWidget(item, row, col, rowspan, colspan)