event_counter
frog.gui.event_counter
¤
Provides a class for monitoring events such as device opening/closing.
Classes¤
EventCounter(on_target_reached, on_below_target, target_count=None, device_names=())
¤
A class for monitoring events such as device opening/closing.
Callbacks are run when the desired count is reached and when the count drops below the target.
Create a new EventCounter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
on_target_reached
|
Callable[[], Any]
|
Callback for when target_count is reached |
required |
on_below_target
|
Callable[[], Any]
|
Callback for when count drops below target_count |
required |
target_count
|
int | None
|
The target count on which on_target_reached will be run |
None
|
device_names
|
Sequence[str]
|
The names of serial device topics to subscribe to |
()
|
Source code in frog/gui/event_counter.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
Functions¤
decrement()
¤
Decrease the counter by one and run callback if count drops below target.
Source code in frog/gui/event_counter.py
54 55 56 57 58 |
|
increment()
¤
Increase the counter by one and run callback if target reached.
Source code in frog/gui/event_counter.py
48 49 50 51 52 |
|