betfsm.events.Ctrl_C_Receiver

Installs a ctrl-C handler that puts a value into the blackboard. Should only be created using the get_instance class method.

get_instance(value='CTRL_C', repeated=math.inf) classmethod

One singleton queue per topic.

Configures the system SIGINT (Ctrl+C) handler to interact with a blackboard, where a variable will set to given value if Ctrl-c is pressed

Parameters:
  • value (str, default: 'CTRL_C' ) –

    Value that will be set when ctrl-c is pressed.

  • repeated ((int, None), default: inf ) –

    number of times to repeat ctrl-c before KeyboardInterrupt is raised

Returns:
  • Singleton instance of EventQueueSubscriber.

Example

To start monitoring for Ctrl+C. If ctrl-c is pressed, at the given path in the blackboard, a True value will be written.

Ctrl_C_Handler(blackboard,"/cancelation/ctrl_c",repeated=3) 

has_event(target_strings)

checks whether one of the target_strings is present in the blackboard.

poll_for(target_strings)

checks whether one of the target_strings is present in the blackboard and consumes the event, i.e. sets the value in blackboard to

remove_handler()

go back to the default ctrl-C handler