コード例 #1
0
 def loadChannelSettings(self, parent, direction, ch):
     hbox = QHBoxLayout(parent)
     formLayout = QFormLayout()
     hbox.addLayout(formLayout)
     factories = [
         ("NCO Frequency", FreqEntryWidget,
          functools.partial(self._iris.setFrequency, direction, ch, "BB"),
          functools.partial(self._iris.getFrequency, direction, ch, "BB")),
         ("Filter BW", FreqEntryWidget,
          functools.partial(self._iris.setBandwidth, direction, ch),
          functools.partial(self._iris.getBandwidth, direction, ch)),
     ]
     for name, widgetType, setter, getter in factories:
         edit = FreqEntryWidget(parent)
         formLayout.addRow(name, edit)
         self.loadEditWidget(edit, setter, getter, [direction, ch, name])
     for name in self._iris.listGains(direction, ch):
         edit = QDoubleSpinBox(parent)
         formLayout.addRow(name, edit)
         self.loadEditWidget(
             edit, functools.partial(self._iris.setGain, direction, ch,
                                     name),
             functools.partial(self._iris.getGain, direction, ch, name),
             [direction, ch, name])
         r = self._iris.getGainRange(direction, ch, name)
         edit.setRange(r.minimum(), r.maximum())
         if r.step() != 0: edit.setSingleStep(r.step())
         edit.setSuffix(' dB')
     formLayout = QFormLayout()
     hbox.addLayout(formLayout)
     edit = StringValueComboBox(options=self._iris.listAntennas(
         direction, ch),
                                parent=parent)
     formLayout.addRow("Antenna", edit)
     self.loadEditWidget(
         edit, functools.partial(self._iris.setAntenna, direction, ch),
         functools.partial(self._iris.getAntenna, direction, ch),
         [direction, ch, 'Antenna'])
     self.loadArbitrarySettings(parent, formLayout, [direction, ch])
     if self._iris.hasDCOffsetMode(direction, ch):
         info = SoapySDR.ArgInfo()
         info.type = info.BOOL
         edit = ArbitrarySettingsWidget(info, self)
         formLayout.addRow("DC Removal", edit)
         self.loadEditWidget(
             edit,
             lambda v: iris.setDCOffsetMode(direction, ch, v == "true"),
             lambda: "true"
             if iris.getDCOffsetMode(direction, ch) else "false",
             [direction, ch, 'DC Removal'])
     sklkCalButton = QPushButton("SKLK Calibrate", parent)
     sklkCalButton.pressed.connect(
         functools.partial(self._iris.writeSetting, direction, ch,
                           "CALIBRATE", "SKLK"))
     formLayout.addRow("Self Calibrate", sklkCalButton)
     mcuCalButton = QPushButton("MCU Calibrate", parent)
     mcuCalButton.pressed.connect(
         functools.partial(self._iris.writeSetting, direction, ch,
                           "CALIBRATE", ""))
     formLayout.addRow("Self Calibrate", mcuCalButton)
コード例 #2
0
 def loadChannelSettings(self, parent, direction, ch):
     hbox = QHBoxLayout(parent)
     formLayout = QFormLayout()
     hbox.addLayout(formLayout)
     factories = [
         ("NCO Frequency", FreqEntryWidget, functools.partial(listFuncHelper, [iris.setFrequency for iris in self._writeIrises], direction, ch, "BB"), lambda direction=direction, ch=ch: self._iris.getFrequency(direction, ch, "BB")), #functools.partial(self._iris.getFrequency, direction, ch, "BB")), # use this syntax to make direction and ch to persist, but execute self._iris when called (for switching iris readback): https://stackoverflow.com/questions/11087047/deferred-evaluation-with-lambda-in-python/11087323
         ("Filter BW", FreqEntryWidget, functools.partial(listFuncHelper, [iris.setBandwidth for iris in self._writeIrises], direction, ch), lambda direction=direction, ch=ch: self._iris.getBandwidth(direction, ch)),
     ]
     for name, widgetType, setter, getter in factories:
         edit = FreqEntryWidget(parent)
         formLayout.addRow(name, edit)
         self.loadEditWidget(edit, setter, getter, [direction, ch, name])
     for name in self._iris.listGains(direction, ch):
         edit = QDoubleSpinBox(parent)
         formLayout.addRow(name, edit)
         self.loadEditWidget(edit,
             functools.partial(listFuncHelper, [iris.setGain for iris in self._writeIrises], direction, ch, name),
             lambda direction=direction, ch=ch, name=name: self._iris.getGain(direction, ch, name),
             [direction, ch, name])
         r = self._iris.getGainRange(direction, ch, name)
         edit.setRange(r.minimum(), r.maximum())
         if r.step() != 0: edit.setSingleStep(r.step())
         edit.setSuffix(' dB')
     formLayout = QFormLayout()
     hbox.addLayout(formLayout)
     edit = StringValueComboBox(options=self._iris.listAntennas(direction, ch), parent=parent)
     formLayout.addRow("Antenna", edit)
     self.loadEditWidget(edit,
         functools.partial(listFuncHelper, [iris.setAntenna for iris in self._writeIrises], direction, ch),
         lambda direction=direction, ch=ch: self._iris.getAntenna(direction, ch),
         [direction, ch, 'Antenna'])
     self.loadArbitrarySettings(parent, formLayout, [direction, ch])
     if self._iris.hasDCOffsetMode(direction, ch):
         info = SoapySDR.ArgInfo()
         info.type = info.BOOL
         edit = ArbitrarySettingsWidget(info, self)
         formLayout.addRow("DC Removal", edit)
         self.loadEditWidget(edit,
             lambda v: [iris.setDCOffsetMode(direction, ch, v == "true") for iris in self._writeIrises], #this is a lambda in IrisControlGui, but maybe it's messing things up?
             lambda: "true" if self._iris.getDCOffsetMode(direction, ch) else "false",
             [direction, ch, 'DC Removal'])
     sklkCalButton = QPushButton("SKLK Calibrate", parent)
     sklkCalButton.pressed.connect(functools.partial(listFuncHelper, [iris.writeSetting for iris in self._writeIrises], direction, ch, "CALIBRATE", "SKLK"))
     formLayout.addRow("Self Calibrate", sklkCalButton)
     mcuCalButton = QPushButton("MCU Calibrate", parent)
     mcuCalButton.pressed.connect(functools.partial(listFuncHelper, [iris.writeSetting for iris in self._writeIrises], direction, ch, "CALIBRATE", ""))
     formLayout.addRow("Self Calibrate", mcuCalButton)