Пример #1
0
    def __init__(self, channel, sysclk, title):
        self.channel = channel
        self.sysclk = sysclk

        QtGui.QFrame.__init__(self)

        self.setFrameShape(QtGui.QFrame.Panel)
        self.setFrameShadow(QtGui.QFrame.Raised)

        grid = QtGui.QGridLayout()
        self.setLayout(grid)
        label = QtGui.QLabel(title)
        label.setAlignment(QtCore.Qt.AlignCenter)
        label.setWordWrap(True)
        grid.addWidget(label, 1, 1)

        self._value = QtGui.QLabel()
        self._value.setAlignment(QtCore.Qt.AlignCenter)
        self._value.setWordWrap(True)
        grid.addWidget(self._value, 2, 1, 6, 1)

        grid.setRowStretch(1, 1)
        grid.setRowStretch(2, 0)
        grid.setRowStretch(3, 1)

        self.set_value(0)
Пример #2
0
    def __init__(self, global_min, global_max, global_step, unit, ndecimals):
        LayoutWidget.__init__(self)

        def apply_properties(spinbox):
            spinbox.setDecimals(ndecimals)
            if global_min is not None:
                spinbox.setMinimum(global_min)
            else:
                spinbox.setMinimum(float("-inf"))
            if global_max is not None:
                spinbox.setMaximum(global_max)
            else:
                spinbox.setMaximum(float("inf"))
            if global_step is not None:
                spinbox.setSingleStep(global_step)
            if unit:
                spinbox.setSuffix(" " + unit)

        self.addWidget(QtGui.QLabel("Min:"), 0, 0)
        self.min = QtGui.QDoubleSpinBox()
        apply_properties(self.min)
        self.addWidget(self.min, 0, 1)

        self.addWidget(QtGui.QLabel("Max:"), 0, 2)
        self.max = QtGui.QDoubleSpinBox()
        apply_properties(self.max)
        self.addWidget(self.max, 0, 3)

        self.addWidget(QtGui.QLabel("#Points:"), 0, 4)
        self.npoints = QtGui.QSpinBox()
        self.npoints.setMinimum(2)
        self.npoints.setValue(10)
        self.addWidget(self.npoints, 0, 5)
Пример #3
0
    def __init__(self, procdesc):
        LayoutWidget.__init__(self)

        self.stack = QtGui.QStackedWidget()
        self.addWidget(self.stack, 1, 0, colspan=4)

        self.scale = procdesc["scale"]

        gmin, gmax = procdesc["global_min"], procdesc["global_max"]
        gstep = procdesc["global_step"]
        unit = procdesc["unit"]
        ndecimals = procdesc["ndecimals"]

        self.v_noscan = QtGui.QDoubleSpinBox()
        self.v_noscan.setDecimals(ndecimals)
        if gmin is not None:
            self.v_noscan.setMinimum(gmin / self.scale)
        else:
            self.v_noscan.setMinimum(float("-inf"))
        if gmax is not None:
            self.v_noscan.setMaximum(gmax / self.scale)
        else:
            self.v_noscan.setMaximum(float("inf"))
        self.v_noscan.setSingleStep(gstep / self.scale)
        if unit:
            self.v_noscan.setSuffix(" " + unit)
        self.v_noscan_gr = LayoutWidget()
        self.v_noscan_gr.addWidget(QtGui.QLabel("Value:"), 0, 0)
        self.v_noscan_gr.addWidget(self.v_noscan, 0, 1)
        self.stack.addWidget(self.v_noscan_gr)

        self.v_linear = _Range(gmin, gmax, gstep, unit, self.scale, ndecimals)
        self.stack.addWidget(self.v_linear)

        self.v_random = _Range(gmin, gmax, gstep, unit, self.scale, ndecimals)
        self.stack.addWidget(self.v_random)

        self.v_explicit = QtGui.QLineEdit()
        self.v_explicit_gr = LayoutWidget()
        self.v_explicit_gr.addWidget(QtGui.QLabel("Sequence:"), 0, 0)
        self.v_explicit_gr.addWidget(self.v_explicit, 0, 1)
        self.stack.addWidget(self.v_explicit_gr)

        self.noscan = QtGui.QRadioButton("No scan")
        self.linear = QtGui.QRadioButton("Linear")
        self.random = QtGui.QRadioButton("Random")
        self.explicit = QtGui.QRadioButton("Explicit")
        radiobuttons = QtGui.QButtonGroup()
        for n, b in enumerate(
            [self.noscan, self.linear, self.random, self.explicit]):
            self.addWidget(b, 0, n)
            radiobuttons.addButton(b)
            b.toggled.connect(self.select_page)

        if "default" in procdesc:
            self.set_argument_value(procdesc["default"])
        else:
            self.noscan.setChecked(True)
Пример #4
0
    def __init__(self, dialog_parent, status_bar, schedule_ctl):
        dockarea.Dock.__init__(self, "Explorer", size=(1500, 500))

        self.dialog_parent = dialog_parent
        self.status_bar = status_bar
        self.schedule_ctl = schedule_ctl

        self.splitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
        self.addWidget(self.splitter)

        grid = LayoutWidget()
        self.splitter.addWidget(grid)

        self.el = QtGui.QListView()
        self.el.selectionChanged = self._selection_changed
        self.selected_key = None
        grid.addWidget(self.el, 0, 0, colspan=4)

        self.datetime = QtGui.QDateTimeEdit()
        self.datetime.setDisplayFormat("MMM d yyyy hh:mm:ss")
        self.datetime.setDate(QtCore.QDate.currentDate())
        self.datetime.dateTimeChanged.connect(self.enable_duedate)
        self.datetime_en = QtGui.QCheckBox("Due date:")
        grid.addWidget(self.datetime_en, 1, 0, colspan=2)
        grid.addWidget(self.datetime, 1, 2, colspan=2)

        self.pipeline = QtGui.QLineEdit()
        self.pipeline.setText("main")
        grid.addWidget(QtGui.QLabel("Pipeline:"), 2, 0, colspan=2)
        grid.addWidget(self.pipeline, 2, 2, colspan=2)

        self.priority = QtGui.QSpinBox()
        self.priority.setRange(-99, 99)
        grid.addWidget(QtGui.QLabel("Priority:"), 3, 0)
        grid.addWidget(self.priority, 3, 1)

        self.flush = QtGui.QCheckBox("Flush")
        self.flush.setToolTip(
            "Flush the pipeline before starting the experiment")
        grid.addWidget(self.flush, 3, 2)

        self.log_level = QtGui.QComboBox()
        for item in "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL":
            self.log_level.addItem(item)
        self.log_level.setCurrentIndex(1)
        self.log_level.setToolTip("Minimum level for log entry production")
        grid.addWidget(self.log_level, 3, 3)

        submit = QtGui.QPushButton("Submit")
        submit.setShortcut("CTRL+RETURN")
        submit.setToolTip("Schedule the selected experiment (CTRL+ENTER)")
        grid.addWidget(submit, 4, 0, colspan=4)
        submit.clicked.connect(self.submit_clicked)

        self.argeditor = _ArgumentEditor(self.dialog_parent)
        self.splitter.addWidget(self.argeditor)
        self.splitter.setSizes([grid.minimumSizeHint().width(), 1000])
        self.state = dict()
Пример #5
0
    def __init__(self, send_to_device, channel, force_out, name, comment):
        self.send_to_device = send_to_device
        self.channel = channel
        self.comment = comment
        self.force_out = force_out

        QtGui.QFrame.__init__(self)

        self.setFrameShape(QtGui.QFrame.Panel)
        self.setFrameShadow(QtGui.QFrame.Raised)

        grid = QtGui.QGridLayout()
        self.setLayout(grid)
        label = QtGui.QLabel("{} {}".format(name, comment))
        label.setAlignment(QtCore.Qt.AlignCenter)
        grid.addWidget(label, 1, 1)

        self._direction = QtGui.QLabel()
        self._direction.setAlignment(QtCore.Qt.AlignCenter)
        grid.addWidget(self._direction, 2, 1)
        self._override = QtGui.QLabel()
        self._override.setAlignment(QtCore.Qt.AlignCenter)
        grid.addWidget(self._override, 3, 1)
        self._value = QtGui.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.setExclusive(True)
        self._expctl_action = QtGui.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.setSeparator(True)
        self._value.addAction(separator)
        self._force1_action = QtGui.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.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.setCheckable(True)
        self._forcein_action.setEnabled(not force_out)
        menu.addAction(self._forcein_action)
        self._value.addAction(self._forcein_action)
        self._forcein_action.triggered.connect(lambda: self.set_mode("in"))

        self.set_value(0, False, False)
Пример #6
0
    def __init__(self):
        dockarea.Dock.__init__(self, "Log", size=(1000, 300))

        grid = LayoutWidget()
        self.addWidget(grid)

        grid.addWidget(QtGui.QLabel("Minimum level: "), 0, 0)
        grid.layout.setColumnStretch(0, 0)
        grid.layout.setColumnStretch(1, 0)
        grid.layout.setColumnStretch(2, 1)
        self.filterbox = QtGui.QComboBox()
        for item in "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL":
            self.filterbox.addItem(item)
        self.filterbox.setToolTip("Display entries at or above this level")
        grid.addWidget(self.filterbox, 0, 1)
        self.filterbox.currentIndexChanged.connect(self.filter_changed)

        self.log = QtGui.QTableView()
        self.log.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
        self.log.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.log.setHorizontalScrollMode(
            QtGui.QAbstractItemView.ScrollPerPixel)
        self.log.setShowGrid(False)
        self.log.setTextElideMode(QtCore.Qt.ElideNone)
        grid.addWidget(self.log, 1, 0, colspan=3)
        self.scroll_at_bottom = False
Пример #7
0
    def __init__(self, send_to_device, channel, sysclk, name, comment):
        self.send_to_device = send_to_device
        self.channel = channel
        self.comment = comment
        self.sysclk = sysclk
        self.name = name

        QtGui.QFrame.__init__(self)

        self.setFrameShape(QtGui.QFrame.Panel)
        self.setFrameShadow(QtGui.QFrame.Raised)

        grid = QtGui.QGridLayout()
        self.setLayout(grid)
        label = QtGui.QLabel("{} {}".format(name, comment))
        label.setAlignment(QtCore.Qt.AlignCenter)
        grid.addWidget(label, 1, 1)

        self._value = QtGui.QLabel()
        self._value.setAlignment(QtCore.Qt.AlignCenter)
        grid.addWidget(self._value, 2, 1, 6, 1)

        self.set_value(0)
Пример #8
0
    def __init__(self, parent, window_title, prev_name, create_cb):
        QtGui.QDialog.__init__(self, parent=parent)
        self.setWindowTitle(window_title)

        self.grid = QtGui.QGridLayout()
        self.setLayout(self.grid)

        self.grid.addWidget(QtGui.QLabel("Name:"), 0, 0)
        self.name = QtGui.QLineEdit()
        self.grid.addWidget(self.name, 0, 1)
        if prev_name is not None:
            self.name.setText(prev_name)

        def on_accept():
            create_cb(self.name.text(), self.get_input())
        self.accepted.connect(on_accept)
Пример #9
0
    def __init__(self, parent, prev_name, prev_settings,
                 result_list, create_cb):
        _BaseSettings.__init__(self, parent, self._window_title,
                               prev_name, create_cb)

        self.result_widgets = dict()
        for row, (has_none, key) in enumerate(self._result_keys):
            self.grid.addWidget(QtGui.QLabel(key.capitalize() + ":"))
            w = QtGui.QComboBox()
            self.grid.addWidget(w, row + 1, 1)
            if has_none:
                w.addItem("<None>")
            w.addItems(result_list)
            w.setEditable(True)
            if key in prev_settings:
                w.setEditText(prev_settings[key])
            self.result_widgets[key] = w
        self.add_buttons()