Exemple #1
0
    def setupUi(self):
        import pyqtgraph as pg

        pg.setConfigOptions(antialias=True)
        # This method is called after gui has been loaded (referenced in self.widget)
        # to customize gui building. In this case, we are adding a plot widget.
        self.pw = pg.PlotWidget()

        self.curve = self.pw.plot(pen='y')
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.pw)
        self.widget.placeholder.setLayout(layout)
Exemple #2
0
    def setupUi(self):

        # This method is called after gui has been loaded (referenced in self.widget)
        # to customize gui building. In this case, we are adding a plot widget.
        self.pw = pg.PlotWidget()
        self.curve = self.pw.plot(pen='y')
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.pw)
        self.widget.plotParent.setLayout(layout)
        self.scannerUi = AmplitudeScannerUi()

        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.scannerUi.widget)
        self.widget.scanner_widget.setLayout(layout)
Exemple #3
0
    def setupUi(self, parent):
        self.resize(275, 172)
        self.setWindowTitle('Convert units')
        self.layout = QtGui.QVBoxLayout(parent)
        self.layout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
        align = (QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing
                 | QtCore.Qt.AlignVCenter)

        self.layout1 = QtGui.QHBoxLayout()
        self.label1 = QtGui.QLabel()
        self.label1.setMinimumSize(QtCore.QSize(100, 0))
        self.label1.setText('Convert from:')
        self.label1.setAlignment(align)

        self.layout1.addWidget(self.label1)
        self.source_units = QtGui.QLineEdit()
        self.source_units.setReadOnly(True)
        self.layout1.addWidget(self.source_units)

        self.layout.addLayout(self.layout1)

        self.layout2 = QtGui.QHBoxLayout()
        self.label2 = QtGui.QLabel()
        self.label2.setMinimumSize(QtCore.QSize(100, 0))
        self.label2.setText('to:')
        self.label2.setAlignment(align)
        self.layout2.addWidget(self.label2)

        self.destination_units = QtGui.QLineEdit()
        self.layout2.addWidget(self.destination_units)

        self.layout.addLayout(self.layout2)

        self.message = QtGui.QLabel()
        self.message.setText('')
        self.message.setAlignment(QtCore.Qt.AlignCenter)

        self.layout.addWidget(self.message)

        self.buttonBox = QtGui.QDialogButtonBox()
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
        self.layout.addWidget(self.buttonBox)
        self.buttonBox.setEnabled(False)

        self.buttonBox.accepted.connect(self.accept)
        self.destination_units.textChanged.connect(self.check)

        self.setLayout(self.layout)
        self.destination_units.setFocus()
Exemple #4
0
    def __init__(self,
                 argspec,
                 parent=None,
                 window_title='Function arguments',
                 doc=None):
        super().__init__(parent)

        vlayout = QtGui.QVBoxLayout(self)

        layout = QtGui.QFormLayout()

        widgets = []

        defaults = argspec.defaults if argspec.defaults else ()
        defaults = ('', ) * (len(argspec.args[1:]) - len(defaults)) + defaults

        self.arguments = {}
        for arg, default in zip(argspec.args[1:], defaults):
            wid = QtGui.QLineEdit(self)
            wid.setObjectName(arg)
            wid.setText(json.dumps(default))
            self.arguments[arg] = default

            layout.addRow(arg, wid)
            widgets.append(wid)
            wid.textChanged.connect(self.on_widget_change(wid))
            if doc and arg in doc:
                wid.setToolTip(doc[arg])

        self.widgets = widgets

        buttonBox = QtGui.QDialogButtonBox()
        buttonBox.setOrientation(QtCore.Qt.Horizontal)
        buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
        buttonBox.setEnabled(True)
        buttonBox.accepted.connect(self.accept)

        vlayout.addLayout(layout)

        label = QtGui.QLabel()
        label.setText('Values are decoded from text using as JSON.')
        vlayout.addWidget(label)

        vlayout.addWidget(buttonBox)

        self.buttonBox = buttonBox
        self.valid = {wid.objectName(): True for wid in self.widgets}

        self.setWindowTitle(window_title)
Exemple #5
0
    def createGUI(self):

        # Demonstrate the supported widgets.
        # Uncomment to try others.
        self.widget = self._createGUITable()
        #self.widget = self._createGUILine()
        #self.widget = self._createGUIText()

        button = QtGui.QPushButton()
        button.setText('Initialize')
        button.setEnabled(True)
        button.clicked.connect(self.initialize)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(button)
        layout.addWidget(self.widget)
        self.setLayout(layout)

        self.setWindowTitle("Driver initialization")
Exemple #6
0
    def __init__(self, parent, target):
        super().__init__(parent)
        self._lantz_target = target

        layout = QtGui.QVBoxLayout(self)

        label = QtGui.QLabel()
        label.setText(str(target))
        layout.addWidget(label)

        recall = QtGui.QPushButton()
        recall.setText('Refresh')
        recall.clicked.connect(lambda x: target.refresh())

        update = QtGui.QPushButton()
        update.setText('Update')
        update.clicked.connect(
            lambda x: target.update(self.widgets_values_as_dict()))

        auto = QtGui.QCheckBox()
        auto.setText('Update on change')
        auto.setChecked(True)
        auto.stateChanged.connect(self.update_on_change)

        hlayout = QtGui.QHBoxLayout()
        hlayout.addWidget(recall)
        hlayout.addWidget(update)
        hlayout.addWidget(auto)

        layout.addLayout(hlayout)

        self.writable_widgets = []
        self.widgets = []

        # Feat
        for feat_name, feat in sorted(target.feats.items()):
            try:
                feat_widget = LabeledFeatWidget(self, target, feat)

                self.widgets.append(feat_widget)
                if feat_widget.writable:
                    self.writable_widgets.append(feat_widget)

                layout.addWidget(feat_widget)
            except Exception as ex:
                logger.debug('Could not create control for {}: {}'.format(
                    feat_name, ex))
                if __PRINT_TRACEBACK__:
                    import traceback
                    traceback.print_exc()

        # Actions
        line = QtGui.QFrame(self)
        #self.line.setGeometry(QtCore.QRect(110, 80, 351, 31))
        line.setFrameShape(QtGui.QFrame.HLine)
        line.setFrameShadow(QtGui.QFrame.Sunken)
        layout.addWidget(line)

        actions_label = QtGui.QLabel(self)
        actions_label.setText('Actions:')
        actions_label.setFixedWidth(120)

        self.actions_combo = QtGui.QComboBox(self)
        self.actions_combo.addItems(list(target.actions.keys()))

        actions_button = QtGui.QPushButton(self)
        actions_button.setFixedWidth(60)
        actions_button.setText('Run')
        actions_button.clicked.connect(self.on_run_clicked)

        alayout = QtGui.QHBoxLayout()
        alayout.addWidget(actions_label)
        alayout.addWidget(self.actions_combo)
        alayout.addWidget(actions_button)

        layout.addLayout(alayout)