本文整理汇总了Python中mpf.system.tasks.DelayManager类的典型用法代码示例。如果您正苦于以下问题:Python DelayManager类的具体用法?Python DelayManager怎么用?Python DelayManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DelayManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: timer_tick
def timer_tick(self):
"""Called by the platform each machine tick based on self.HZ"""
self.timing.timer_tick() # notifies the timing module
self.events.post('timer_tick') # sends the timer_tick system event
self.tick_num += 1
Task.timer_tick() # notifies tasks
DelayManager.timer_tick(self)
self.events._process_event_queue()
开发者ID:HarryXS,项目名称:mpf,代码行数:8,代码来源:media_controller.py
示例2: __init__
def __init__(self, machine):
self.log = logging.getLogger('switchplayer')
if 'switchplayer' not in machine.config:
machine.log.debug('"switchplayer:" section not found in '
'machine configuration, so the Switch Player'
'plugin will not be used.')
return
self.machine = machine
self.delay = DelayManager()
self.current_step = 0
config_spec = '''
start_event: string|machine_reset_phase_3
start_delay: secs|0
'''
self.config = Config.process_config(config_spec,
self.machine.config['switchplayer'])
self.machine.events.add_handler(self.config['start_event'],
self._start_event_callback)
self.step_list = self.config['steps']
self.start_delay = self.config['start_delay']
开发者ID:jabdoa2,项目名称:mpf,代码行数:26,代码来源:switch_player.py
示例3: __init__
def __init__(self, machine):
self.log = logging.getLogger("switch_player")
if "switch_player" not in machine.config:
machine.log.debug(
'"switch_player:" section not found in '
"machine configuration, so the Switch Player"
"plugin will not be used."
)
return
self.machine = machine
self.delay = DelayManager()
self.current_step = 0
config_spec = """
start_event: string|machine_reset_phase_3
start_delay: secs|0
"""
self.config = Config.process_config(config_spec, self.machine.config["switch_player"])
self.machine.events.add_handler(self.config["start_event"], self._start_event_callback)
self.step_list = self.config["steps"]
self.start_delay = self.config["start_delay"]
开发者ID:mini338,项目名称:mpf,代码行数:26,代码来源:switch_player.py
示例4: __init__
def __init__(self, machine, name, config, priority):
"""SequenceShot is where you need certain switches to be hit in the
right order, possibly within a time limit.
Subclass of `Shot`
Args:
machine: The MachineController object
name: String name of this shot.
config: Dictionary that holds the configuration for this shot.
"""
super(SequenceShot, self).__init__(machine, name, config, priority)
self.delay = DelayManager()
self.progress_index = 0
"""Tracks how far along through this sequence the current shot is."""
# convert our switches config to a list
if 'switches' in self.config:
self.config['switches'] = \
Config.string_to_list(self.config['switches'])
# convert our timout to ms
if 'time' in self.config:
self.config['time'] = Timing.string_to_ms(self.config['time'])
else:
self.config['time'] = 0
self.active_delay = False
self.enable()
开发者ID:jabdoa2,项目名称:mpf,代码行数:33,代码来源:shots.py
示例5: __init__
def __init__(self, machine, name):
self.log = logging.getLogger(__name__)
self.machine = machine
self.task = None
self.name = name
self.delays = DelayManager()
self.registered_event_handlers = list()
self.registered_switch_handlers = list()
开发者ID:town-hall-pinball,项目名称:mpf,代码行数:8,代码来源:machine_mode.py
示例6: __init__
def __init__(self, machine, mode, name, config):
self.machine = machine
self.mode = mode
self.name = name
self.config = config
self.tick_var = self.mode.name + '_' + self.name + '_tick'
self.mode.player[self.tick_var] = 0
self.running = False
self.start_value = 0
self.restart_on_complete = False
self._ticks = 0
self.end_value = 0
self.max_value = None
self.direction = 'up'
self.tick_secs = 1
self.timer = None
self.bcp = False
self.event_keys = set()
self.delay = DelayManager()
if 'start_value' in self.config:
self.start_value = self.config['start_value']
else:
self.start_value = 0
if 'start_running' in self.config and self.config['start_running']:
self.running = True
if 'end_value' in self.config:
self.end_value = self.config['end_value']
if 'control_events' in self.config and self.config['control_events']:
if type(self.config['control_events']) is dict:
self.config['control_events'] = [self.config['control_events']]
else:
self.config['control_events'] = list()
if 'direction' in self.config and self.config['direction'] == 'down':
self.direction = 'down'
if 'tick_interval' in self.config:
self.tick_secs = Timing.string_to_secs(self.config['tick_interval'])
if 'max_value' in self.config:
self.max_value = self.config['max_value']
if ('restart_on_complete' in self.config and
self.config['restart_on_complete']):
self.restart_on_complete = True
if 'bcp' in self.config and self.config['bcp']:
self.bcp = True
self.mode.player[self.tick_var] = self.start_value
self._setup_control_events(self.config['control_events'])
开发者ID:jabdoa2,项目名称:mpf,代码行数:58,代码来源:modes.py
示例7: __init__
def __init__(self, machine, name, config, collection=None, validate=True):
super(Multiball, self).__init__(machine, name, config, collection,
validate=validate)
self.delay = DelayManager()
# let ball devices initialise first
self.machine.events.add_handler('init_phase_3',
self._initialize)
开发者ID:jherrm,项目名称:mpf,代码行数:9,代码来源:multiball.py
示例8: __init__
def __init__(self, machine, config, name, path):
self.machine = machine
self.config = config
self.name = name.lower()
self.path = path
self.log = logging.getLogger("Mode." + name)
self.delay = DelayManager()
self.priority = 0
self._active = False
self._mode_start_wait_queue = None
self.stop_methods = list()
self.timers = dict()
self.start_callback = None
self.stop_callback = None
self.event_handlers = set()
self.switch_handlers = list()
self.mode_start_kwargs = dict()
self.mode_stop_kwargs = dict()
self.mode_devices = set()
self.player = None
"""Reference to the current player object."""
self._validate_mode_config()
self.configure_mode_settings(config.get("mode", dict()))
self.auto_stop_on_ball_end = self.config["mode"]["stop_on_ball_end"]
"""Controls whether this mode is stopped when the ball ends,
regardless of its stop_events settings.
"""
self.restart_on_next_ball = self.config["mode"]["restart_on_next_ball"]
"""Controls whether this mode will restart on the next ball. This only
works if the mode was running when the ball ended. It's tracked per-
player in the '_restart_modes_on_next_ball' untracked player variable.
"""
for asset_manager in self.machine.asset_managers.values():
config_data = self.config.get(asset_manager.config_section, dict())
self.config[asset_manager.config_section] = asset_manager.register_assets(
config=config_data, mode_path=self.path
)
# Call registered remote loader methods
for item in self.machine.mode_controller.loader_methods:
if item.config_section and item.config_section in self.config and self.config[item.config_section]:
item.method(config=self.config[item.config_section], mode_path=self.path, **item.kwargs)
elif not item.config_section:
item.method(config=self.config, mode_path=self.path, **item.kwargs)
self.mode_init()
开发者ID:qcapen,项目名称:mpf,代码行数:57,代码来源:mode.py
示例9: __init__
def __init__(self, machine, config, name, path):
self.machine = machine
self.config = config
self.name = name.lower()
self.path = path
self.log = logging.getLogger('Mode.' + name)
self.delay = DelayManager()
self.priority = 0
self._active = False
self._mode_start_wait_queue = None
self.stop_methods = list()
self.timers = dict()
self.start_callback = None
self.stop_callback = None
self.event_handlers = set()
self.switch_handlers = list()
self.mode_start_kwargs = dict()
self.mode_stop_kwargs = dict()
self.mode_devices = set()
self.auto_stop_on_ball_end = True
'''Controls whether this mode is stopped when the ball ends,
regardless of its stop_events settings.
'''
self.player = None
'''Reference to the current player object.'''
self._validate_mode_config()
self.configure_mode_settings(config.get('mode', dict()))
for asset_manager in self.machine.asset_managers.values():
config_data = self.config.get(asset_manager.config_section, dict())
self.config[asset_manager.config_section] = (
asset_manager.register_assets(config=config_data,
mode_path=self.path))
# Call registered remote loader methods
for item in self.machine.mode_controller.loader_methods:
if (item.config_section and
item.config_section in self.config and
self.config[item.config_section]):
item.method(config=self.config[item.config_section],
mode_path=self.path,
**item.kwargs)
elif not item.config_section:
item.method(config=self.config, mode_path=self.path,
**item.kwargs)
self.mode_init()
开发者ID:jherrm,项目名称:mpf,代码行数:56,代码来源:mode.py
示例10: BallSave
class BallSave(Device):
config_section = "ball_saves"
collection = "ball_saves"
class_label = "ball_save"
def __init__(self, machine, name, config, collection=None, validate=True):
super(BallSave, self).__init__(machine, name, config, collection, validate=validate)
self.delay = DelayManager()
self.source_playfield = self.config["source_playfield"]
def enable(self, **kwargs):
self.log.debug("Enabling...")
# Enable shoot again
self.machine.events.add_handler("ball_drain", self._ball_drain_shoot_again, priority=1000)
if self.config["auto_disable_time"] > 0:
self.delay.add("disable_shoot_again", self.config["auto_disable_time"], self.disable)
self.machine.events.post("ball_save_" + self.name + "_enabled")
def disable(self, **kwargs):
self.log.debug("Disabling...")
self.machine.events.remove_handler(self._ball_drain_shoot_again)
self.delay.remove("disable_shoot_again")
self.machine.events.post("ball_save_" + self.name + "_disabled")
def _ball_drain_shoot_again(self, balls, **kwargs):
if balls <= 0:
return {"balls": balls}
self.machine.events.post("ball_save_" + self.name + "_shoot_again", balls=balls)
self.log.debug("Ball drained during ball save. Requesting a new one.")
self.source_playfield.add_ball(balls=balls)
return {"balls": 0}
开发者ID:jherrm,项目名称:mpf,代码行数:40,代码来源:ball_save.py
示例11: __init__
def __init__(self, machine, name, config, collection=None, validate=True):
super(BallSave, self).__init__(machine, name, config, collection, validate=validate)
self.delay = DelayManager()
self.enabled = False
self.saves_remaining = 0
if self.config["balls_to_save"] == -1:
self.unlimited_saves = True
else:
self.unlimited_saves = False
self.source_playfield = self.config["source_playfield"]
开发者ID:mini338,项目名称:mpf,代码行数:13,代码来源:ball_save.py
示例12: __init__
def __init__(self, machine, name, collection):
self.log = logging.getLogger('Playfield')
self.machine = machine
self.name = name
self.tags = list()
self.config = defaultdict(lambda: None)
self.config['eject_targets'] = list()
self.ball_controller = self.machine.ball_controller
self.delay = DelayManager()
# Add the playfield ball device to the existing device collection
collection_object = getattr(self.machine, collection)[name] = self
# Attributes
self._balls = 0
self.num_balls_requested = 0
self.player_controlled_eject_in_progress = None
self.queued_balls = list()
# Set up event handlers
# Watch for balls added to the playfield
for device in self.machine.balldevices:
for target in device.config['eject_targets']:
if target == self.name:
self.machine.events.add_handler(
event='balldevice_' + device.name +
'_ball_eject_success',
handler=self._source_device_eject_success)
self.machine.events.add_handler(
event='balldevice_' + device.name +
'_ball_eject_attempt',
handler=self._source_device_eject_attempt)
break
# Watch for balls removed from the playfield
self.machine.events.add_handler('balldevice_captured_from_playfield',
self._ball_removed_handler)
# Watch for any switch hit which indicates a ball on the playfield
self.machine.events.add_handler('sw_playfield_active',
self.playfield_switch_hit)
开发者ID:jabdoa2,项目名称:mpf,代码行数:45,代码来源:playfield.py
示例13: __init__
def __init__(self, machine):
self.machine = machine
self.log = logging.getLogger("BallController")
self.log.debug("Loading the BallController")
self.delay = DelayManager()
self.game = None
self._num_balls_known = -999
self.num_balls_missing = 0
# Balls lost and/or not installed.
# register for events
self.machine.events.add_handler('request_to_start_game',
self.request_to_start_game)
self.machine.events.add_handler('machine_reset_phase_2',
self._initialize)
开发者ID:HarryXS,项目名称:mpf,代码行数:18,代码来源:ball_controller.py
示例14: __init__
def __init__(self, machine, name, player, config):
self.log = logging.getLogger('Counter.' + name)
self.log.debug("Creating Counter LogicBlock")
super(Counter, self).__init__(machine, name, player, config)
self.delay = DelayManager()
self.ignore_hits = False
self.hit_value = -1
config_spec = '''
count_events: list|None
count_complete_value: int|None
multiple_hit_window: ms|0
count_interval: int|1
direction: string|up
starting_count: int|0
'''
self.config = Config.process_config(config_spec=config_spec,
source=self.config)
if 'event_when_hit' not in self.config:
self.config['event_when_hit'] = ('counter_' + self.name +
'_hit')
if 'player_variable' not in self.config:
self.config['player_variable'] = self.name + '_count'
self.hit_value = self.config['count_interval']
if self.config['direction'] == 'down' and self.hit_value > 0:
self.hit_value *= -1
elif self.config['direction'] == 'up' and self.hit_value < 0:
self.hit_value *= -1
if not self.config['persist_state']:
self.player[self.config['player_variable']] = (
self.config['starting_count'])
开发者ID:HarryXS,项目名称:mpf,代码行数:40,代码来源:logic_blocks.py
示例15: __init__
def __init__(self, machine, name, config, collection=None, validate=True):
super(Diverter, self).__init__(machine, name, config, collection,
validate=validate)
self.delay = DelayManager()
# Attributes
self.active = False
self.enabled = False
self.platform = None
self.diverting_ejects_count = 0
self.eject_state = False
self.eject_attempt_queue = deque()
self.trigger_type = 'software' # 'software' or 'hardware'
# Create a list of ball device objects when active and inactive. We need
# this because ball eject attempts pass the target device as an object
# rather than by name.
# register for feeder device eject events
for feeder_device in self.config['feeder_devices']:
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_attempt',
self._feeder_eject_attempt)
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_failed',
self._feeder_eject_count_decrease)
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_success',
self._feeder_eject_count_decrease)
self.machine.events.add_handler('init_phase_3', self._register_switches)
self.platform = self.config['activation_coil'].platform
开发者ID:mini338,项目名称:mpf,代码行数:38,代码来源:diverter.py
示例16: __init__
def __init__(self, machine, platform):
self.log = logging.getLogger('Platform.Snux')
self.delay = DelayManager()
self.machine = machine
self.platform = platform
self.system11_config = None
self.snux_config = None
self.ac_relay_delay_ms = 100
self.special_drivers = set()
self.diag_led = None
'''Diagnostics LED (LED 3) on the Snux board turns on solid when MPF
first connects, then starts flashing once the MPF init is done.'''
self.ac_relay = None
self.flipper_relay = None
self.ac_relay_enabled = False # disabled = A, enabled = C
self.a_side_queue = set()
self.c_side_queue = set()
self.a_drivers = set()
self.c_drivers = set()
self.a_side_done_time = 0
self.c_side_done_time = 0
self.drivers_holding_a_side = set()
self.drivers_holding_c_side = set()
# self.a_side_busy = False # This is a property
# self.c_side_active = False # This is a property
self.a_side_enabled = True
self.c_side_enabled = False
self.ac_relay_in_transition = False
self._morph()
开发者ID:HarryXS,项目名称:mpf,代码行数:37,代码来源:snux.py
示例17: __init__
def __init__(self, machine, name, player, config):
self.log = logging.getLogger("Counter." + name)
self.log.debug("Creating Counter LogicBlock")
super(Counter, self).__init__(machine, name, player, config)
self.delay = DelayManager()
self.ignore_hits = False
self.hit_value = -1
config_spec = """
count_events: list|None
count_complete_value: int|0
multiple_hit_window: ms|0
count_interval: int|1
direction: string|up
starting_count: int|0
"""
self.config = Config.process_config(config_spec=config_spec, source=self.config)
if "event_when_hit" not in self.config:
self.config["event_when_hit"] = "counter_" + self.name + "_hit"
if "player_variable" not in self.config:
self.config["player_variable"] = self.name + "_count"
self.hit_value = self.config["count_interval"]
if self.config["direction"] == "down" and self.hit_value > 0:
self.hit_value *= -1
elif self.config["direction"] == "up" and self.hit_value < 0:
self.hit_value *= -1
self.player[self.config["player_variable"]] = self.config["starting_count"]
开发者ID:jabdoa2,项目名称:mpf,代码行数:36,代码来源:logic_blocks.py
示例18: Diverter
class Diverter(Device):
"""Represents a diverter in a pinball machine.
Args: Same as the Device parent class.
"""
config_section = 'diverters'
collection = 'diverters'
class_label = 'diverter'
def __init__(self, machine, name, config, collection=None, validate=True):
super(Diverter, self).__init__(machine, name, config, collection,
validate=validate)
self.delay = DelayManager()
# Attributes
self.active = False
self.enabled = False
self.platform = None
self.diverting_ejects_count = 0
self.eject_state = False
self.eject_attempt_queue = deque()
self.trigger_type = 'software' # 'software' or 'hardware'
# Create a list of ball device objects when active and inactive. We need
# this because ball eject attempts pass the target device as an object
# rather than by name.
# register for feeder device eject events
for feeder_device in self.config['feeder_devices']:
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_attempt',
self._feeder_eject_attempt)
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_failed',
self._feeder_eject_count_decrease)
self.machine.events.add_handler('balldevice_' + feeder_device.name +
'_ball_eject_success',
self._feeder_eject_count_decrease)
self.machine.events.add_handler('init_phase_3', self._register_switches)
self.platform = self.config['activation_coil'].platform
def _register_switches(self):
# register for deactivation switches
for switch in self.config['deactivation_switches']:
self.machine.switch_controller.add_switch_handler(
switch.name, self.deactivate)
# register for disable switches:
for switch in self.config['disable_switches']:
self.machine.switch_controller.add_switch_handler(
switch.name, self.disable)
def enable(self, auto=False, activations=-1, **kwargs):
"""Enables this diverter.
Args:
auto: Boolean value which is used to indicate whether this
diverter enabled itself automatically. This is passed to the
event which is posted.
activations: Integer of how many times you'd like this diverter to
activate before it will automatically disable itself. Default is
-1 which is unlimited.
If an 'activation_switches' is configured, then this method writes a
hardware autofire rule to the pinball controller which fires the
diverter coil when the switch is activated.
If no `activation_switches` is specified, then the diverter is activated
immediately.
"""
self.enabled = True
self.machine.events.post('diverter_' + self.name + '_enabling',
auto=auto)
if self.config['activation_switches']:
self.enable_switches()
else:
self.activate()
def disable(self, auto=False, **kwargs):
"""Disables this diverter.
This method will remove the hardware rule if this diverter is activated
via a hardware switch.
Args:
auto: Boolean value which is used to indicate whether this
diverter disabled itself automatically. This is passed to the
event which is posted.
**kwargs: This is here because this disable method is called by
#.........这里部分代码省略.........
开发者ID:mini338,项目名称:mpf,代码行数:101,代码来源:diverter.py
示例19: __init__
def __init__(self, machine, name, config, collection=None):
self.log = logging.getLogger('Diverter.' + name)
super(Diverter, self).__init__(machine, name, config, collection)
self.delay = DelayManager()
# Attributes
self.active = False
self.enabled = False
# configure defaults:
if 'type' not in self.config:
self.config['type'] = 'pulse' # default to pulse to not fry coils
if 'activation_time' not in self.config:
self.config['activation_time'] = 0
if 'activation_switches' in self.config:
self.config['activation_switches'] = Config.string_to_list(
self.config['activation_switches'])
else:
self.config['activation_switches'] = list()
if 'disable_switches' in self.config:
self.config['disable_switches'] = Config.string_to_list(
self.config['disable_switches'])
else:
self.config['disable_switches'] = list()
if 'deactivation_switches' in self.config:
self.config['deactivation_switches'] = Config.string_to_list(
self.config['deactivation_switches'])
else:
self.config['deactivation_switches'] = list()
if 'activation_coil' in self.config:
self.config['activation_coil'] = (
self.machine.coils[self.config['activation_coil']])
if 'deactivation_coil' in self.config:
self.config['deactivation_coil'] = (
self.machine.coils[self.config['deactivation_coil']])
else:
self.config['deactivation_coil'] = None
if 'targets_when_active' in self.config:
self.config['targets_when_active'] = Config.string_to_list(
self.config['targets_when_active'])
else:
self.config['targets_when_active'] = ['playfield']
if 'targets_when_inactive' in self.config:
self.config['targets_when_inactive'] = Config.string_to_list(
self.config['targets_when_inactive'])
else:
self.config['targets_when_inactive'] = ['playfield']
if 'feeder_devices' in self.config:
self.config['feeder_devices'] = Config.string_to_list(
self.config['feeder_devices'])
else:
self.config['feeder_devices'] = list()
# Create a list of ball device objects when active and inactive. We need
# this because ball eject attempts pass the target device as an object
# rather than by name.
self.config['active_objects'] = list()
self.config['inactive_objects'] = list()
for target_device in self.config['targets_when_active']:
if target_device == 'playfield':
self.config['active_objects'].append('playfield')
else:
self.config['active_objects'].append(
self.machine.balldevices[target_device])
for target_device in self.config['targets_when_inactive']:
if target_device == 'playfield':
self.config['inactive_objects'].append('playfield')
else:
self.config['inactive_objects'].append(
self.machine.balldevices[target_device])
# convert the activation_time to ms
self.config['activation_time'] = Timing.string_to_ms(self.config['activation_time'])
# register for events
for event in self.config['enable_events']:
self.machine.events.add_handler(event, self.enable)
for event in self.config['disable_events']:
self.machine.events.add_handler(event, self.disable)
# register for feeder device eject events
for feeder_device in self.config['feeder_devices']:
self.machine.events.add_handler('balldevice_' + feeder_device +
'_ball_eject_attempt',
self._feeder_eject_attempt)
# register for deactivation switches
for switch in self.config['deactivation_switches']:
#.........这里部分代码省略.........
开发者ID:town-hall-pinball,项目名称:mpf,代码行数:101,代码来源:diverter.py
示例20: Diverter
class Diverter(Device):
"""Represents a diverter in a pinball machine.
Args: Same as the Device parent class.
"""
config_section = 'diverters'
collection = 'diverters'
def __init__(self, machine, name, config, collection=None):
self.log = logging.getLogger('Diverter.' + name)
super(Diverter, self).__init__(machine, name, config, collection)
self.delay = DelayManager()
# Attributes
self.active = False
self.enabled = False
# configure defaults:
if 'type' not in self.config:
self.config['type'] = 'pulse' # default to pulse to not fry coils
if 'activation_time' not in self.config:
self.config['activation_time'] = 0
if 'activation_switches' in self.config:
self.config['activation_switches'] = Config.string_to_list(
self.config['activation_switches'])
else:
self.config['activation_switches'] = list()
if 'disable_switches' in self.config:
self.config['disable_switches'] = Config.string_to_list(
self.config['disable_switches'])
else:
self.config['disable_switches'] = list()
if 'deactivation_switches' in self.config:
self.config['deactivation_switches'] = Config.string_to_list(
self.config['deactivation_switches'])
else:
self.config['deactivation_switches'] = list()
if 'activation_coil' in self.config:
self.config['activation_coil'] = (
self.machine.coils[self.config['activation_coil']])
if 'deactivation_coil' in self.config:
self.config['deactivation_coil'] = (
self.machine.coils[self.config['deactivation_coil']])
else:
self.config['deactivation_coil'] = None
if 'targets_when_active' in self.config:
self.config['targets_when_active'] = Config.string_to_list(
self.config['targets_when_active'])
else:
self.config['targets_when_active'] = ['playfield']
if 'targets_when_inactive' in self.config:
self.config['targets_when_inactive'] = Config.string_to_list(
self.config['targets_when_inactive'])
else:
self.config['targets_when_inactive'] = ['playfield']
if 'feeder_devices' in self.config:
self.config['feeder_devices'] = Config.string_to_list(
self.config['feeder_devices'])
else:
self.config['feeder_devices'] = list()
# Create a list of ball device objects when active and inactive. We need
# this because ball eject attempts pass the target device as an object
# rather than by name.
self.config['active_objects'] = list()
self.config['inactive_objects'] = list()
for target_device in self.config['targets_when_active']:
if target_device == 'playfield':
self.config['active_objects'].append('playfield')
else:
self.config['active_objects'].append(
self.machine.balldevices[target_device])
for target_device in self.config['targets_when_inactive']:
if target_device == 'playfield':
self.config['inactive_objects'].append('playfield')
else:
self.config['inactive_objects'].append(
self.machine.balldevices[target_device])
# convert the activation_time to ms
self.config['activation_time'] = Timing.string_to_ms(self.config['activation_time'])
# register for events
for event in self.config['enable_events']:
self.machine.events.add_handler(event, self.enable)
for event in self.config['disable_events']:
self.machine.events.add_handler(event, self.disable)
#.........这里部分代码省略.........
开发者ID:town-hall-pinball,项目名称:mpf,代码行数:101,代码来源:diverter.py
注:本文中的mpf.system.tasks.DelayManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论