def test_panel_creation(qtbot, panel, panel_widget): standard = FakeEpicsSignal('Tst:Pv', name='standard') read_and_write = FakeEpicsSignal('Tst:Read', write_pv='Tst:Write', name='read_and_write') read_only = FakeEpicsSignalRO('Tst:Pv:RO', name='read_only') simulated = SynSignal(func=random.random, name='simul') simulated_ro = SynSignalRO(func=random.random, name='simul_ro') standard.sim_put(1) read_and_write.sim_put(2) read_only.sim_put(3) simulated.put(4) signals = { # Signal is its own write 'Standard': standard, # Signal has separate write/read 'Read and Write': read_and_write, 'Read Only': read_only, 'Simulated': simulated, 'SimulatedRO': simulated_ro, 'Array': Signal(name='array', value=np.ones((5, 10))) } for name, signal in signals.items(): panel.add_signal(signal, name=name) wait_panel(qtbot, panel, signal_names=set(sig.name for sig in signals.values())) def widget_at(row, col): return panel.itemAtPosition(row, col).widget() # Check read-only channels do not have write widgets assert widget_at(2, 1) is widget_at(2, 2) assert widget_at(4, 1) is widget_at(4, 2) # Array widget has only a button, even when writable assert widget_at(5, 1) is widget_at(5, 2) # Check write widgets are present assert widget_at(0, 1) is not widget_at(0, 2) assert widget_at(1, 1) is not widget_at(1, 2) assert widget_at(3, 1) is not widget_at(3, 2) return panel_widget
def test_monitor(RE, hw): from ophyd.sim import SynSignal signal = SynSignal(name='signal') signal.put(0.0) RE(monitor_during_wrapper(count([hw.det], 5), [signal]))
def sig(): sig = SynSignal(name='test') sig.put(0) return sig