def _update_trigger_levels_hystereses_condition_times(self):
        tr = self._trigger_source
        level_count = len(tr.levels) if hasattr(tr, 'levels') else 0
        logging.debug("tr.level.count="+str(level_count))
        for i in range(len(self._menu_trigger_levels)):
            menu = self._menu_trigger_levels[i]
            menu.menuAction().setVisible(level_count > i)
            if menu.menuAction().isVisible():
                value = tr.levels[i]
                logging.debug("tr.levels="+str(tr.levels[i]))
                for action in menu.actions():
                    action.setChecked(utils.unwrap_QVariant(action.data())["value"] == value)

        hysteresis_count = len(tr.hystereses) if hasattr(tr, 'hystereses') else 0
        for i in range(len(self._menu_trigger_hystereses)):
            menu = self._menu_trigger_hystereses[i]
            menu.menuAction().setVisible(hysteresis_count > i)
            if menu.menuAction().isVisible():
                value = tr.hystereses[i]
                for action in menu.actions():
                    action.setChecked(utils.unwrap_QVariant(action.data())["value"] == value)

        self._menu_trigger_condition.menuAction().setVisible(hasattr(tr, 'conditions') and tr.conditions != libtiepie.TCM_NONE)
        if self._menu_trigger_condition.menuAction().isVisible():
            self._menu_trigger_condition.clear()
            for tc in TRIGGER_CONDITIONS:
                if tr.conditions & tc["value"] != 0:
                    action = self._menu_trigger_condition.addAction(tc["name"])
                    action.setCheckable(True)
                    action.setChecked(tr.condition == tc["value"])
                    action.setData(tc["value"])
                    action.toggled.connect(self._trigger_condition_changed)
                    self._menu_trigger_kind_act_group.addAction(action)

        self._update_trigger_times()
    def _sample_frequency_changed(self, checked):
        if checked:
            self._scp.sample_frequency = utils.unwrap_QVariant(self.sender().data())

            self._update_record_length()
            # TODO: self._update_trigger_time_out()
            self._update_trigger_times()
Beispiel #3
0
 def _channel_range_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         if data["range"] is None:
             self._scp.channels[data["ch"]].auto_ranging = True
         else:
             self._scp.channels[data["ch"]].range = data["range"]
 def _persistency_changed(self, checked):
     if checked:
         self.persistency = utils.unwrap_QVariant(self.sender().data())
         logging.debug('persistency changed to '+str(self.persistency))
     else:
         self.persistency = 1
     if self.persistency != 1:
       QMessageBox.about(self, "Warning", "Persistency!=1 is causing memory leaks!") #,icon=QMessageBox.Warning)
Beispiel #5
0
 def _trigger_hysteresis_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         if data["value"] is None:
             value, ok = QInputDialog.getDouble(self, "", "Enter trigger hysteresis:", self._trigger_source.hystereses[data["index"]] * 100, 0, 100)
             if ok:
                 self._trigger_source.hystereses[data["index"]] = value
         else:
             self._trigger_source.hystereses[data["index"]] = data["value"]
Beispiel #6
0
 def _pre_sample_ratio_changed(self, checked):
     if checked:
         value = utils.unwrap_QVariant(self.sender().data())
         if value is None:
             value, ok = QInputDialog.getDouble(self, "", "Enter pre sample ratio:", self._scp.pre_sample_ratio, 0, 10)
             if ok:
                 self._scp.pre_sample_ratio = value
         else:
             self._scp.pre_sample_ratio = value
Beispiel #7
0
 def _record_length_changed(self, checked):
     if checked:
         value = utils.unwrap_QVariant(self.sender().data())
         if value is None:
             value, ok = QInputDialog.getInt(self, "", "Enter record length:", self._scp.record_length, 1, self._scp.verify_record_length(RECORD_LENGTH_MAX))
             if ok:
                 self._scp.record_length = value
         else:
             self._scp.record_length = value
Beispiel #8
0
 def _trigger_timeout_changed(self, checked):
     if checked:
         value = utils.unwrap_QVariant(self.sender().data())
         if value is None:
             max = self._scp.verify_trigger_time_out(1e100)
             value, ok = QInputDialog.getDouble(self, "", "Enter trigger time out:", self._scp.trigger_time_out, 0, max, 3)
             if ok:
                 self._scp.trigger_time_out = value
         else:
             self._scp.trigger_time_out = value
Beispiel #9
0
 def _trigger_time_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         if data["value"] is None:
             min = self._trigger_source.times.verify(data["index"], 1e-100)
             max = self._trigger_source.times.verify(data["index"], 1e100)
             value, ok = QInputDialog.getDouble(self, "", "Enter trigger time:", self._trigger_source.times[data["index"]], min, max, 9)
             if ok:
                 self._trigger_source.times[data["index"]] = value
         else:
             self._trigger_source.times[data["index"]] = data["value"]
    def _trigger_source_changed(self, checked):
        data = utils.unwrap_QVariant(self.sender().data())
        if "ch" in data:
            tr = self._scp.channels[data["ch"]].trigger
        elif "trin" in data:
            tr = self._scp.trigger_inputs[data["trin"]]

        tr.enabled = checked

        if checked:
            self._trigger_source = tr
            self._update_trigger_source()
Beispiel #11
0
    def _sample_frequency_changed(self, checked):
        if checked:
            value = utils.unwrap_QVariant(self.sender().data())
            if value is None:
                value, ok = QInputDialog.getDouble(self, "", "Enter sample frequency:", self._scp.sample_frequency, 1, self._scp.sample_frequency_max)
                if ok:
                    self._scp.sample_frequency = value
            else:
                self._scp.sample_frequency = value

            self._update_record_length()
            # TODO: self._update_trigger_time_out()
            self._update_trigger_times()
 def _channel_gain_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         chnum = data["ch"]
         self.gain[chnum] = data["range"]
         logging.debug('channel_gain_changed for channel '+str(chnum)+' to '+str(data["range"]))
         if data["range"] is None:
             self._scp.channels[chnum].auto_ranging = True
         else:
             value = data["range"]*self.nDiv
             logging.debug('changing range to '+str(value))
             self._scp.channels[data["ch"]].range = value
         self._update_labels()
 def _channel_enabled_changed(self, checked):
     self._scp.channels[utils.unwrap_QVariant(self.sender().data())].enabled = checked
     self._update_sample_frequency()
     self._update_labels()
 def _record_length_changed(self, checked):
     if checked:
         self._scp.record_length = utils.unwrap_QVariant(self.sender().data())
 def _trigger_time_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         self._trigger_source.times[data["index"]] = data["value"]
 def _trigger_condition_changed(self, checked):
     if checked:
         self._trigger_source.condition = utils.unwrap_QVariant(self.sender().data())
         self._update_trigger_times()
 def _trigger_level_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         logging.debug("_trigger_source.levels "+str(data["index"])+", "+str(data["value"]))
         self._trigger_source.levels[data["index"]] = data["value"]
 def _trigger_kind_changed(self, checked):
     if checked:
         self._trigger_source.kind = utils.unwrap_QVariant(self.sender().data())
         self._update_trigger_levels_hystereses_condition_times()
 def _pre_sample_ratio_changed(self, checked):
     if checked:
         self._scp.pre_sample_ratio = utils.unwrap_QVariant(self.sender().data())
 def _trigger_timeout_changed(self, checked):
     if checked:
         self._scp.trigger_time_out = utils.unwrap_QVariant(self.sender().data())
 def _channel_coupling_changed(self, checked):
     if checked:
         data = utils.unwrap_QVariant(self.sender().data())
         self._scp.channels[data["ch"]].coupling = data["ck"]
         self._update_channel_gain(data["ch"])