예제 #1
0
        def validate(value):
            try:
                if value:
                    value = json.loads(value)
                else:
                    value = None
                palette = QtGui.QPalette()
                palette.setColor(widget.backgroundRole(),
                                 QtGui.QColor('white'))
                widget.setPalette(palette)
                self.arguments[name] = value
                self.valid[name] = True
            except:
                palette = QtGui.QPalette()
                palette.setColor(widget.backgroundRole(),
                                 QtGui.QColor(255, 102, 102))
                widget.setPalette(palette)
                self.valid[name] = False

            self.buttonBox.setEnabled(all(self.valid.values()))
예제 #2
0
파일: loop.py 프로젝트: gdavis-xilinx/lantz
    def connect_backend(self):
        super().connect_backend()

        self.widget.start_stop.clicked.connect(self.on_start_stop_clicked)
        self.widget.mode.currentIndexChanged.connect(self.on_mode_changed)
        self.widget.iterations.valueChanged.connect(self.recalculate)
        self.widget.duration.valueChanged.connect(self.recalculate)
        self.widget.interval.valueChanged.connect(self.recalculate)
        self.widget.progress_bar.setValue(0)

        self._ok_palette = QtGui.QPalette(self.widget.progress_bar.palette())
        self._overrun_palette = QtGui.QPalette(
            self.widget.progress_bar.palette())
        self._overrun_palette.setColor(QtGui.QPalette.Highlight,
                                       QtGui.QColor(QtCore.Qt.red))

        self.backend.iteration.connect(self.on_iteration)
        self.backend.loop_done.connect(self.on_loop_done)

        self.request_start.connect(self.backend.start)
        self.request_stop.connect(self.backend.stop)