Пример #1
0
    def getAvailableSignals(self):
        """Add the available signals for listed shots as new sources"""
        from pyxpad.xpadsource import XPadSource

        shot_text = self.shotInput.text().split(",")
        shots = set(map(str.strip, shot_text))

        if shots == {""}:
            shots = {str(self.lastShot())}

        existing_sources = shots.intersection(self.sources.names)
        new_shots = shots.difference(self.sources.names)
        if existing_sources:
            plural = "s" if len(existing_sources) > 1 else ""
            grammar = "" if len(existing_sources) > 1 else "s"
            self.statusbar.showMessage(
                f"Skipping shot{plural} {', '.join(existing_sources)}; already exist{grammar} as source{plural}",
                1000,
            )

        for shot in new_shots:
            self.sources.addSource(XPadSource.from_signals(shot))
            self.sources.updateDisplay()
Пример #2
0
def test_from_signals(mock_uda):
    source = XPadSource.from_signals(1)
    assert list(source.variables.keys()) == EXPECTED_VARIABLE_NAMES