forked from M-Labs/artiq
1
0
Fork 0

dashboard/experiments: look improvements

This commit is contained in:
Sebastien Bourdeauducq 2016-06-18 18:55:25 +08:00
parent ec3e7792dc
commit ae914d2611
1 changed files with 22 additions and 6 deletions

View File

@ -50,6 +50,9 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
self.setHorizontalScrollMode(self.ScrollPerPixel) self.setHorizontalScrollMode(self.ScrollPerPixel)
self.setVerticalScrollMode(self.ScrollPerPixel) self.setVerticalScrollMode(self.ScrollPerPixel)
self.setStyleSheet("QTreeWidget {background: " +
self.palette().midlight().color().name() + " ;}")
self.viewport().installEventFilter(_WheelFilter(self.viewport())) self.viewport().installEventFilter(_WheelFilter(self.viewport()))
self._groups = dict() self._groups = dict()
@ -60,16 +63,28 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
if not arguments: if not arguments:
self.addTopLevelItem(QtWidgets.QTreeWidgetItem(["No arguments"])) self.addTopLevelItem(QtWidgets.QTreeWidgetItem(["No arguments"]))
gradient = QtGui.QLinearGradient(
0, 0, 0, QtGui.QFontMetrics(self.font()).lineSpacing()*2.5)
gradient.setColorAt(0, self.palette().base().color())
gradient.setColorAt(1, self.palette().midlight().color())
for name, argument in arguments.items(): for name, argument in arguments.items():
entry = argty_to_entry[argument["desc"]["ty"]](argument) entry = argty_to_entry[argument["desc"]["ty"]](argument)
widget_item = QtWidgets.QTreeWidgetItem([name]) widget_item = QtWidgets.QTreeWidgetItem([name])
self._arg_to_entry_widgetitem[name] = entry, widget_item self._arg_to_entry_widgetitem[name] = entry, widget_item
for col in range(3):
widget_item.setBackground(col, gradient)
font = widget_item.font(0)
font.setBold(True)
widget_item.setFont(0, font)
if argument["group"] is None: if argument["group"] is None:
self.addTopLevelItem(widget_item) self.addTopLevelItem(widget_item)
else: else:
self._get_group(argument["group"]).addChild(widget_item) self._get_group(argument["group"]).addChild(widget_item)
self.setItemWidget(widget_item, 1, entry) fix_layout = LayoutWidget()
fix_layout.addWidget(entry)
self.setItemWidget(widget_item, 1, fix_layout)
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")
@ -123,12 +138,12 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
if name in self._groups: if name in self._groups:
return self._groups[name] return self._groups[name]
group = QtWidgets.QTreeWidgetItem([name]) group = QtWidgets.QTreeWidgetItem([name])
for c in 0, 1: for col in range(3):
group.setBackground(c, QtGui.QBrush(QtGui.QColor(100, 100, 100))) group.setBackground(col, self.palette().mid())
group.setForeground(c, QtGui.QBrush(QtGui.QColor(220, 220, 255))) group.setForeground(col, self.palette().brightText())
font = group.font(c) font = group.font(col)
font.setBold(True) font.setBold(True)
group.setFont(c, font) group.setFont(col, font)
self.addTopLevelItem(group) self.addTopLevelItem(group)
self._groups[name] = group self._groups[name] = group
return group return group
@ -185,6 +200,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
def __init__(self, manager, expurl): def __init__(self, manager, expurl):
QtWidgets.QMdiSubWindow.__init__(self) QtWidgets.QMdiSubWindow.__init__(self)
self.resize(800, 600)
self.setWindowTitle(expurl) self.setWindowTitle(expurl)
self.setWindowIcon(QtWidgets.QApplication.style().standardIcon( self.setWindowIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_FileDialogContentsView)) QtWidgets.QStyle.SP_FileDialogContentsView))