def status_monitor(self, notify_queue=None):
        # When called with a queue, this function writes to the queue
        # when the pulseblaster is waiting. This indicates the end of
        # an experimental run.
        self.status, waits_pending, time_based_shot_over = yield (
            self.queue_work(self._primary_worker, 'check_status'))

        if self.programming_scheme == 'pb_start/BRANCH':
            done_condition = self.status['waiting']
        elif self.programming_scheme == 'pb_stop_programming/STOP':
            done_condition = self.status['stopped']

        if time_based_shot_over is not None:
            done_condition = time_based_shot_over

        if notify_queue is not None and done_condition and not waits_pending:
            # Experiment is over. Tell the queue manager about it, then
            # set the status checking timeout back to every 2 seconds
            # with no queue.
            notify_queue.put('done')
            self.statemachine_timeout_remove(self.status_monitor)
            self.statemachine_timeout_add(2000, self.status_monitor)
            if self.programming_scheme == 'pb_stop_programming/STOP':
                # Not clear that on all models the outputs will be correct after being
                # stopped this way, so we do program_manual with current values to be sure:
                self.program_device()
        # Update widgets with new status
        for state in self.status_states:
            if self.status[state]:
                icon = QtGui.QIcon(':/qtutils/fugue/tick')
            else:
                icon = QtGui.QIcon(':/qtutils/fugue/cross')

            pixmap = icon.pixmap(QtCore.QSize(16, 16))
            self.status_widgets[state].setPixmap(pixmap)
 def sectionSizeFromContents(self, logical_index):
     base_size = QtWidgets.QHeaderView.sectionSizeFromContents(self, logical_index)
     width, height = base_size.width(), base_size.height()
     if logical_index in self.widgets:
         widget_size = self.widgets[logical_index].size()
         widget_width, widget_height = widget_size.width(), widget_size.height()
         height = max(height, widget_height + 2)
         width = max(width, widget_width + 7)
     return QtCore.QSize(width, height)
예제 #3
0
    def status_monitor(self):
        # When called with a queue, this function writes to the queue
        # when the pulseblaster is waiting. This indicates the end of
        # an experimental run.
        self.status = yield (self.queue_work(self._primary_worker,
                                             'check_status'))

        for key in self.status_bits:
            if self.status[key]:
                icon = QtGui.QIcon(':/qtutils/fugue/tick')
            else:
                icon = QtGui.QIcon(':/qtutils/fugue/cross')
            pixmap = icon.pixmap(QtCore.QSize(16, 16))
            self.bit_values_widgets[key].setPixmap(pixmap)
 def __init__(self, parent=None, *args, **kwargs):
     self.tabSize = QtCore.QSize(kwargs.pop('width', 100),
                                 kwargs.pop('height', 25))
     QtWidgets.QTabBar.__init__(self, parent, *args, **kwargs)