forked from M-Labs/artiq
1
0
Fork 0

dashboard/experiments: style

This commit is contained in:
Robert Jördens 2016-05-08 16:18:44 +02:00
parent c5fcb6b8d5
commit 904db4923c
1 changed files with 22 additions and 14 deletions

View File

@ -46,9 +46,9 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
set_resize_mode(1, QtWidgets.QHeaderView.Stretch) set_resize_mode(1, QtWidgets.QHeaderView.Stretch)
set_resize_mode(2, QtWidgets.QHeaderView.ResizeToContents) set_resize_mode(2, QtWidgets.QHeaderView.ResizeToContents)
self.header().setVisible(False) self.header().setVisible(False)
self.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) self.setSelectionMode(self.NoSelection)
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) self.setHorizontalScrollMode(self.ScrollPerPixel)
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) self.setVerticalScrollMode(self.ScrollPerPixel)
self.viewport().installEventFilter(_WheelFilter(self.viewport())) self.viewport().installEventFilter(_WheelFilter(self.viewport()))
@ -73,8 +73,9 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
recompute_argument = QtWidgets.QToolButton() recompute_argument = QtWidgets.QToolButton()
recompute_argument.setToolTip("Re-run the experiment's build " recompute_argument.setToolTip("Re-run the experiment's build "
"method and take the default value") "method and take the default value")
recompute_argument.setIcon(QtWidgets.QApplication.style().standardIcon( recompute_argument.setIcon(
QtWidgets.QStyle.SP_BrowserReload)) QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_BrowserReload))
recompute_argument.clicked.connect( recompute_argument.clicked.connect(
partial(self._recompute_argument_clicked, name)) partial(self._recompute_argument_clicked, name))
fix_layout = LayoutWidget() fix_layout = LayoutWidget()
@ -84,8 +85,9 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
widget_item = QtWidgets.QTreeWidgetItem() widget_item = QtWidgets.QTreeWidgetItem()
self.addTopLevelItem(widget_item) self.addTopLevelItem(widget_item)
recompute_arguments = QtWidgets.QPushButton("Recompute all arguments") recompute_arguments = QtWidgets.QPushButton("Recompute all arguments")
recompute_arguments.setIcon(QtWidgets.QApplication.style().standardIcon( recompute_arguments.setIcon(
QtWidgets.QStyle.SP_BrowserReload)) QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_BrowserReload))
recompute_arguments.clicked.connect(dock._recompute_arguments_clicked) recompute_arguments.clicked.connect(dock._recompute_arguments_clicked)
load_hdf5 = QtWidgets.QPushButton("Load HDF5") load_hdf5 = QtWidgets.QPushButton("Load HDF5")
@ -196,10 +198,12 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
datetime.setDateTime(QtCore.QDateTime.fromMSecsSinceEpoch( datetime.setDateTime(QtCore.QDateTime.fromMSecsSinceEpoch(
scheduling["due_date"]*1000)) scheduling["due_date"]*1000))
datetime_en.setChecked(scheduling["due_date"] is not None) datetime_en.setChecked(scheduling["due_date"] is not None)
def update_datetime(dt): def update_datetime(dt):
scheduling["due_date"] = dt.toMSecsSinceEpoch()/1000 scheduling["due_date"] = dt.toMSecsSinceEpoch()/1000
datetime_en.setChecked(True) datetime_en.setChecked(True)
datetime.dateTimeChanged.connect(update_datetime) datetime.dateTimeChanged.connect(update_datetime)
def update_datetime_en(checked): def update_datetime_en(checked):
if checked: if checked:
due_date = datetime.dateTime().toMSecsSinceEpoch()/1000 due_date = datetime.dateTime().toMSecsSinceEpoch()/1000
@ -213,6 +217,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.layout.addWidget(pipeline_name, 1, 3) self.layout.addWidget(pipeline_name, 1, 3)
pipeline_name.setText(scheduling["pipeline_name"]) pipeline_name.setText(scheduling["pipeline_name"])
def update_pipeline_name(text): def update_pipeline_name(text):
scheduling["pipeline_name"] = text scheduling["pipeline_name"] = text
pipeline_name.textEdited.connect(update_pipeline_name) pipeline_name.textEdited.connect(update_pipeline_name)
@ -223,6 +228,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.layout.addWidget(priority, 2, 1) self.layout.addWidget(priority, 2, 1)
priority.setValue(scheduling["priority"]) priority.setValue(scheduling["priority"])
def update_priority(value): def update_priority(value):
scheduling["priority"] = value scheduling["priority"] = value
priority.valueChanged.connect(update_priority) priority.valueChanged.connect(update_priority)
@ -232,6 +238,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self.layout.addWidget(flush, 2, 2, 1, 2) self.layout.addWidget(flush, 2, 2, 1, 2)
flush.setChecked(scheduling["flush"]) flush.setChecked(scheduling["flush"])
def update_flush(checked): def update_flush(checked):
scheduling["flush"] = bool(checked) scheduling["flush"] = bool(checked)
flush.stateChanged.connect(update_flush) flush.stateChanged.connect(update_flush)
@ -247,6 +254,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
log_level.setCurrentIndex(log_levels.index( log_level.setCurrentIndex(log_levels.index(
log_level_to_name(options["log_level"]))) log_level_to_name(options["log_level"])))
def update_log_level(index): def update_log_level(index):
options["log_level"] = getattr(logging, log_level.currentText()) options["log_level"] = getattr(logging, log_level.currentText())
log_level.currentIndexChanged.connect(update_log_level) log_level.currentIndexChanged.connect(update_log_level)
@ -263,6 +271,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
if options["repo_rev"] is not None: if options["repo_rev"] is not None:
repo_rev.setText(options["repo_rev"]) repo_rev.setText(options["repo_rev"])
def update_repo_rev(text): def update_repo_rev(text):
if text: if text:
options["repo_rev"] = text options["repo_rev"] = text
@ -355,9 +364,9 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
try: try:
self.log_level.setCurrentIndex(log_levels.index( self.log_level.setCurrentIndex(log_levels.index(
log_level_to_name(expid["log_level"]))) log_level_to_name(expid["log_level"])))
if ("repo_rev" in expid if ("repo_rev" in expid and
and expid["repo_rev"] != "N/A" expid["repo_rev"] != "N/A" and
and hasattr(self, "repo_rev")): hasattr(self, "repo_rev")):
self.repo_rev.setText(expid["repo_rev"]) self.repo_rev.setText(expid["repo_rev"])
except: except:
logger.error("Could not set submission options from HDF5 expid", logger.error("Could not set submission options from HDF5 expid",
@ -366,7 +375,6 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
await self._recompute_arguments_task(arguments) await self._recompute_arguments_task(arguments)
def closeEvent(self, event): def closeEvent(self, event):
self.sigClosed.emit() self.sigClosed.emit()
QtWidgets.QMdiSubWindow.closeEvent(self, event) QtWidgets.QMdiSubWindow.closeEvent(self, event)
@ -543,9 +551,9 @@ class ExperimentManager:
repo_match = "repo_rev" in expid repo_match = "repo_rev" in expid
else: else:
repo_match = "repo_rev" not in expid repo_match = "repo_rev" not in expid
if (repo_match if (repo_match and
and expid["file"] == file expid["file"] == file and
and expid["class_name"] == class_name): expid["class_name"] == class_name):
rids.append(rid) rids.append(rid)
asyncio.ensure_future(self._request_term_multiple(rids)) asyncio.ensure_future(self._request_term_multiple(rids))