def addXPADtree(self): """Add an XPad tree as a data source, if UDA is available""" try: from pyxpad.xpadsource import XPadSource except ImportError: self.main.write("Sorry, no XPAD tree support") self.main.write(str(sys.exc_info())) return try: # Select the directory tr = self.main.tr dname = QFileDialog.getExistingDirectory(self.main, tr("Open XPAD directory"), QDir.currentPath()) if (dname == "") or (dname is None): return # Create data source s = XPadSource.from_tree(dname) # Add data source and update self.addSource(s) self.updateDisplay() except: self.main.write("Error creating XPadSource") self.main.write(str(sys.exc_info())) raise
def test_get_last_shot(mock_uda, copy_tree_data, pyxpadbot, qtbot): main = pyxpadbot main.sources.addSource(XPadSource.from_tree(copy_tree_data)) main.sources.updateDisplay() main.lastShotButton.setEnabled(True) qtbot.mouseClick(main.lastShotButton, QtCore.Qt.LeftButton) assert str(main.shotInput.text()).strip() == MOCK_LAST_SHOT
def test_init_with_tree(copy_tree_data): source = XPadSource.from_tree(copy_tree_data) assert list(source.variables.keys()) == EXPECTED_VARIABLE_NAMES assert source.variables["second_signal"].desc == "a description"
def test_read(copy_tree_data, mock_uda): source = XPadSource.from_tree(copy_tree_data) data = source.read("something", 42) assert data.name == "something"