예제 #1
0
 def _update(self, result_future):
     super(CheckBoxParameterBinding, self)._update(result_future)
     try:
         with util.block_signals(self.target):
             self.target.setChecked(int(result_future))
     except Exception:
         pass
예제 #2
0
 def _update(self, rf):
     super(ComboBoxParameterBinding, self)._update(rf)
     try:
         with util.block_signals(self.target):
             self.target.setCurrentIndex(int(rf.result()))
     except Exception:
         pass
예제 #3
0
    def _update(self, rf):
        super(SliderParameterBinding, self)._update(rf)
        value = int(rf.result())
        if self.unit is not None:
            value = self.unit.unit_value(value)

        with util.block_signals(self.target):
            self.target.setValue(value)
예제 #4
0
 def _populate(self):
     with util.block_signals(self.text_edit):
         try:
             notes = self.device.get_extension('user_notes')
             if self.get_plain_text() != notes:
                 self.text_edit.setPlainText(notes)
         except KeyError:
             self.text_edit.clear()
         self.text_edit.document().setModified(False)
예제 #5
0
    def _update(self, rf):
        try:
            with util.block_signals(self.target):
                self.target.button(int(rf.result())).setChecked(True)

            for b in self.target.buttons():
                b.setToolTip(self._get_tooltip(rf))
                b.setStatusTip(b.toolTip())
        except Exception:
            pass
예제 #6
0
    def _update(self, result_future):
        if self.editing_observer.editing:
            log.debug("DoubleSpinBoxParameterBinding: _update: early return as editing in progress")
            self.editing_observer.last_result_future = result_future
            return

        super(DoubleSpinBoxParameterBinding, self)._update(result_future)

        try:
            value = self.unit.unit_value(int(result_future.result()))
            with util.block_signals(self.target):
                self.target.setValue(value)
        except Exception:
            pass
예제 #7
0
    def __init__(self, **kwargs):
        super(SpinBoxParameterBinding, self).__init__(**kwargs)

        if self.profile.range is not None:
            with util.block_signals(self.target):
                self.target.setMinimum(self.profile.range[0])
                self.target.setMaximum(self.profile.range[1])

        if hasattr(self.target, 'delayed_valueChanged'):
            self.target.delayed_valueChanged.connect(self._write_value)
        else:
            self.target.valueChanged.connect(self._write_value)

        self.editing_observer = SpinBoxEditingObserver(self)
예제 #8
0
    def _update(self, result_future):
        if self.editing_observer.editing:
            log.debug("SpinBoxParameterBinding: _update: early return as editing in progress")
            self.editing_observer.last_result_future = result_future
            return

        super(SpinBoxParameterBinding, self)._update(result_future)

        try:
            result = int(result_future.result())
            with util.block_signals(self.target):
                self.target.setValue(result)
                log.debug("SpinBoxParameterBinding: _update: addr=%d, result=%d", self.address, result)
        except Exception:
            pass
예제 #9
0
    def __init__(self, unit_name, **kwargs):
        super(DoubleSpinBoxParameterBinding, self).__init__(**kwargs)

        self.unit = self.profile.get_unit(unit_name)

        if self.profile.range is not None:
            with util.block_signals(self.target):
                self.target.setMinimum(self.unit.unit_value(self.profile.range[0]))
                self.target.setMaximum(self.unit.unit_value(self.profile.range[1]))

        if hasattr(self.target, 'delayed_valueChanged'):
            self.target.delayed_valueChanged.connect(self._value_changed)
        else:
            self.target.valueChanged.connect(self._value_changed)

        self.editing_observer = SpinBoxEditingObserver(self)