def _update_stop_scene_leds(self, index): scenes = self.song().scenes scene_index = index + self.scene_offset() if self.is_enabled( ) and self._stop_scene_clip_buttons is not None and index < len( self._stop_scene_clip_buttons): button = self._stop_scene_clip_buttons[index] if button is not None: value_to_send = None if scene_index < len( scenes) and scenes[scene_index].clip_slots: tracks = self.tracks_to_use() if find_if( lambda x: x.playing_slot_index == scene_index and x .fired_slot_index != -2, tracks): value_to_send = self._stop_clip_value elif find_if( lambda x: x.fired_slot_index == -2 and x. playing_slot_index == scene_index, tracks): value_to_send = self._stop_clip_triggered_value else: value_to_send = b'Session.StoppedClip' if value_to_send is None: button.turn_off() elif in_range(value_to_send, 0, 128): button.send_value(value_to_send) else: button.set_light(value_to_send) return
def set_device_parameter_value(self, device_name, parameter_name, value, raise_if_not_exists=False): # type: (str, str, Any) -> None device = find_if(lambda d: d.name.lower() == device_name.lower(), self.song.current_track.all_devices) if not device: if not raise_if_not_exists: return raise Protocol0Error("Couldn't find device %s in track devices" % device_name) param = find_if(lambda d: d.name.lower() == parameter_name.lower(), device.parameters) if not param: if not raise_if_not_exists: return raise Protocol0Error("Couldn't find parameter %s in device %s" % (parameter_name, device_name)) if param.is_enabled: seq = Sequence().add(wait=1) seq.add(lambda: setattr(param, "value", value)) return seq.done()
def find_drum_group_device(self, track): device = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track.devices) if device: if device.can_have_drum_pads: return device elif device.can_have_chains: return find_if(bool, imap(self.find_drum_group_device, device.chains)) else: return None
def find_drum_group_device(track_or_chain): instrument = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track_or_chain.devices) if instrument: if instrument.can_have_drum_pads: return instrument if instrument.can_have_chains: return find_if(bool, map(find_drum_group_device, instrument.chains))
def find_drum_group_device(track_or_chain): """ Looks up recursively for a drum_group device in the track. """ instrument = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track_or_chain.devices) if instrument: if instrument.can_have_drum_pads: return instrument elif instrument.can_have_chains: return find_if(bool, imap(find_drum_group_device, instrument.chains))
def highlighted_clip_slot(self): # type: () -> Optional[ClipSlot] """ first look in track then in song """ return find_if( lambda cs: cs._clip_slot == self.song._view.highlighted_clip_slot, self.selected_track.clip_slots) or find_if( lambda cs: cs._clip_slot == self.song._view. highlighted_clip_slot, [ cs for track in self.song.simple_tracks for cs in track.clip_slots ])
def get_device(track_or_chain, name=None, class_name=None): """ Returns the device on the given track or chain with the given name, class_name or both. """ if live_object_is_valid(track_or_chain): if name is not None and class_name is not None: return find_if(lambda x: x.class_name == class_name and x.name == name, track_or_chain.devices) if name is not None: return find_if(lambda x: x.name == name, track_or_chain.devices) return find_if(lambda x: x.class_name == class_name, track_or_chain.devices) else: return
def get_device_and_parameter_from_name(self, track, device_name, parameter_name): # type: (AbstractTrack, str, str) -> Tuple[Device, DeviceParameter] device = find_if(lambda d: d.name.lower() == device_name.lower(), track.devices) parameter = None if device: parameter = find_if( lambda p: parameter_name.lower() == p.name.lower(), device.parameters) return (device, parameter)
def _update_stop_all_clips_button(self): button = self._stop_all_button if button: value_to_send = 'Session.StoppedClip' tracks = self.tracks_to_use() if find_if(lambda x: x.playing_slot_index >= 0 and x.fired_slot_index != -2, tracks): value_to_send = self._stop_clip_value elif find_if(lambda x: x.fired_slot_index == -2, tracks): value_to_send = self._stop_clip_triggered_value if value_to_send is None: button.turn_off() else: button.set_light(value_to_send)
def get_device_parameter(device, name, by_og_name=False): """ Returns the device's parameter of the given name (which can be its index) or original name if specified. """ if live_object_is_valid(device): if isinstance(name, int): if name in xrange(len(device.parameters)) and device.parameters[name].is_enabled: return device.parameters[name] return if isinstance(device, Live.RackDevice.RackDevice): by_og_name = False if by_og_name: return find_if(lambda x: x.original_name == name and x.is_enabled, device.parameters) return find_if(lambda x: x.name == name and x.is_enabled, device.parameters) else: return
def _show_notes_information(self, mode = None): if self.is_enabled(): if mode is None: mode = self.selected_mode if mode == 'sequence': message = 'Sequence %s to %s' first = find_if(lambda editor: editor.editing_note != None, self._note_editors) last = find_if(lambda editor: editor.editing_note != None, reversed(self._note_editors)) start_note = first.editing_note if first != None else None end_note = last.editing_note if last != None else None else: message = 'Play %s to %s' start_note = self._instrument._pattern.note(0, 0).index end_note = self._instrument._pattern.note(7, 7).index self.show_notification(message % (pitch_index_to_string(start_note), pitch_index_to_string(end_note)))
def _update_led_feedback(self): if self._drum_group_device: soloed_pads = find_if(lambda pad: pad.solo, self._all_drum_pads) for button in self.drum_matrix: pad = self._coordinate_to_pad_map.get(button.coordinate, None) if pad: self._update_pad_led(pad, button, soloed_pads)
def _select_note_mode(self): track = self.song().view.selected_track mod_device = False current_device = self._device._device if not current_device is None: if self._host and self._host._client: for client in self._host._client: #self.log_message('cur device: ' + str(current_device) + ' client: ' + str(client.device)) if client.device == current_device: mod_device = True break drum_device = find_if(lambda d: d.can_have_drum_pads, track.devices) self._step_sequencer.set_drum_group_device(drum_device) if track == None or track.is_foldable or track in self.song( ).return_tracks or track == self.song().master_track: self._note_modes.selected_mode = 'disabled' elif mod_device is True: #self.log_message('found mod device') if not self._host._active_client.device is current_device: self._host._select_client(self._host._client.index(client)) self._note_modes.selected_mode = 'disabled' self._note_modes.selected_mode = 'mod' elif track and track.has_audio_input: self._note_modes.selected_mode = 'looperhack' elif drum_device: self._note_modes.selected_mode = 'sequencer' else: self._note_modes.selected_mode = 'instrument'
def _on_selected_device_changed(self): selected_device = self._selected_track.view.selected_device if selected_device == None: self._set_current_node(self._make_exit_node()) return is_just_default_child_selection = False if self._current_node and self._current_node.children: selected = self.selected_object if isinstance(selected, Live.DrumPad.DrumPad) and find_if( lambda pad: pad.chains and pad.chains[0].devices and pad.chains[0].devices[0] == selected_device, selected.canonical_parent.drum_pads, ): is_just_default_child_selection = True if ( isinstance(selected, Live.Chain.Chain) and selected_device and selected_device.canonical_parent == selected and selected.devices[0] == selected_device ): is_just_default_child_selection = True if not is_just_default_child_selection: if selected_device: target = selected_device.canonical_parent node = (not self._current_node or self._current_node.object != target) and self._make_navigation_node( target, is_entering=False ) self._set_current_node(node)
def _select_note_mode(self, mod_device = None): track = self.song().view.selected_track current_device = self._device._device mod_device = self._is_mod(current_device) newmod_device = self._is_newmod(current_device) drum_device = find_if(lambda d: d.can_have_drum_pads, track.devices) channelized = False #self.log_message('track has midi input: ' + str(track.has_midi_input) + ' current subrouting in CHANNELS: ' + str(track.current_input_sub_routing)) if track.has_midi_input and track.current_input_sub_routing in ['Ch. 2', 'Ch. 3', 'Ch. 4', 'Ch. 5', 'Ch. 6', 'Ch. 7', 'Ch. 8', 'Ch. 9', 'Ch. 10', 'Ch. 11', 'Ch. 12', 'Ch. 13', 'Ch. 14', 'Ch. 15', 'Ch. 16']: channelized = True if not (self._note_modes.selected_mode is 'mod' and self._host.is_modlocked()): self._step_sequencer.set_drum_group_device(drum_device) if track == None or track.is_foldable or track in self.song().return_tracks or track == self.song().master_track: self._note_modes.selected_mode = 'disabled' elif not mod_device is None: self._note_modes.selected_mode = 'disabled' self._note_modes.selected_mode = 'mod' if not self._host._active_client is mod_device: self._host._select_client(mod_device._number) elif not newmod_device is None: self._note_modes.selected_mode = 'disabled' self._note_modes.selected_mode = 'newmod' elif track and track.has_audio_input: self._note_modes.selected_mode = 'looperhack' elif channelized: self._note_modes.selected_mode = 'monoscale' elif drum_device: self._note_modes.selected_mode = 'sequencer' else: self._note_modes.selected_mode = 'instrument'
def _update_note_infos(self): if self.settings.is_enabled(): def min_max((l_min, l_max), (r_min, r_max)): return (min(l_min, r_min), max(l_max, r_max)) all_min_max_attributes = filter( None, imap(lambda e: e.get_min_max_note_values(), self._editors)) min_max_values = [ (99999, -99999) ] * 4 if len(all_min_max_attributes) > 0 else None for min_max_attribute in all_min_max_attributes: for i, attribute in enumerate(min_max_attribute): min_max_values[i] = min_max(min_max_values[i], attribute) for i in xrange(4): self.settings.set_min_max( i, min_max_values[i] if min_max_values else None) edit_all_notes_active = find_if( lambda e: e.modify_all_notes_enabled, self._editors) != None self.settings.set_info_message( 'Tweak to add note' if not edit_all_notes_active and not min_max_values else '')
def handle_sysex(self, midi_bytes): result = find_if(lambda (id, _): midi_bytes[:len(id)] == id, self._forwarding_long_identifier_registry.iteritems()) if result != None: id, control = result control.receive_value(midi_bytes[len(id):-1]) else: self.log_message('Got unknown sysex message: ', midi_bytes)
def _on_selected_device_changed(self): selected_device = self._selected_track.view.selected_device if selected_device == None: self._set_current_node(self._make_exit_node()) return is_just_default_child_selection = False if self._current_node and self._current_node.children: selected = self.selected_object if isinstance(selected, Live.DrumPad.DrumPad) and find_if( lambda pad: pad.chains and pad.chains[0].devices and pad. chains[0].devices[0] == selected_device, selected.canonical_parent.drum_pads): is_just_default_child_selection = True if isinstance( selected, Live.Chain.Chain ) and selected_device and selected_device.canonical_parent == selected and selected.devices[ 0] == selected_device: is_just_default_child_selection = True if not is_just_default_child_selection: if selected_device: target = selected_device.canonical_parent node = (not self._current_node or self._current_node.object != target) and self._make_navigation_node( target, is_entering=False) self._set_current_node(node)
def _select_note_mode(self): track = self.song().view.selected_track mod_device = False current_device = self._device._device if not current_device is None: if self._host and self._host._client: for client in self._host._client: #self.log_message('cur device: ' + str(current_device) + ' client: ' + str(client.device)) if client.device == current_device: mod_device = True break drum_device = find_if(lambda d: d.can_have_drum_pads, track.devices) self._step_sequencer.set_drum_group_device(drum_device) if track == None or track.is_foldable or track in self.song().return_tracks or track == self.song().master_track: self._note_modes.selected_mode = 'disabled' elif mod_device is True: #self.log_message('found mod device') if not self._host._active_client.device is current_device: self._host._select_client(self._host._client.index(client)) self._note_modes.selected_mode = 'disabled' self._note_modes.selected_mode = 'mod' elif track and track.has_audio_input: self._note_modes.selected_mode = 'looperhack' elif drum_device: self._note_modes.selected_mode = 'sequencer' else: self._note_modes.selected_mode = 'instrument'
def __getattr__(self, name): found = find_if( lambda x: x is not None, imap(lambda c: getattr(c.proxied_interface, name, None), self.outer.nested_control_elements())) if found is not None: return found raise AttributeError
def _update_new_scene_button(self): if self._new_scene_button and self.is_enabled(): song = self.song() track_is_playing = find_if(lambda x: x.playing_slot_index >= 0, song.tracks) can_new = not song.view.selected_scene.is_empty or track_is_playing self._new_scene_button.set_light( self._new_scene_button.is_pressed() if can_new else "DefaultButton.Disabled" )
def _update_new_scene_button(self): if self._new_scene_button and self.is_enabled(): song = self.song() track_is_playing = find_if(lambda x: x.playing_slot_index >= 0, song.tracks) can_new = not song.view.selected_scene.is_empty or track_is_playing self._new_scene_button.set_light(self._new_scene_button.is_pressed( ) if can_new else 'DefaultButton.Disabled')
def find_instrument_devices(track_or_chain): """ Returns a list with all instrument rack descendants from a track or chain. """ instrument = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track_or_chain.devices) if instrument and not instrument.can_have_drum_pads and instrument.can_have_chains: return chain([instrument], *imap(find_instrument_devices, instrument.chains)) return []
def find_instrument_devices(track_or_chain): instrument = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track_or_chain.devices) if instrument: if not instrument.can_have_drum_pads: if instrument.can_have_chains: return chain([instrument], *map(find_instrument_devices, instrument.chains)) return []
def find_instrument_device(track_or_chain): """ Returns a list with all instrument rack descendants from a track or chain. """ instrument = find_if(lambda d: d.type == Live.Device.DeviceType.instrument, track_or_chain.devices) if instrument and not instrument.can_have_drum_pads: if instrument.can_have_chains: return instrument return None
def load_rack_device(self, rack_name, hide=False): # type: (str, bool) -> None seq = Sequence() seq.add(partial(self.load_from_user_library, None, "'%s.adg'" % rack_name), complete_on=lambda: find_if(lambda d: d.name == rack_name, self .song.selected_track.devices)) if hide: seq.add(self.parent.keyboardShortcutManager.hide_plugins, wait=1) return seq.done()
def __init__(self, all_pads = tuple(), parameter_sender = nop, default_profile = PadParameters(), update_delay = 0, *a, **k): raise find_if(lambda pad: pad < 0 or pad > 63, all_pads or []) == None or AssertionError super(PadUpdateComponent, self).__init__(*a, **k) self.parameter_sender = parameter_sender self._all_pads = set(all_pads) self._modified_pads = set(all_pads) self._profiles = {'default': default_profile} self._profile_for = dict(zip(all_pads, repeat('default'))) self._profile_count = {'default': len(all_pads)} self._update_task = self._tasks.add(Task.sequence(Task.wait(update_delay), Task.run(self._update_modified))) self._update_task.restart()
def _extract_path(self, path, items=None, browser=None): if isinstance(path, (str, unicode)): path = [path] if items is None: items = browser.tags if path: name = path[0] elem = find_if(lambda x: x.name == name, items) if elem: items = self._extract_path(path[1:], elem.children) return tuple(items)
def _update_drum_pad_leds(self): """ update hardware LEDs for drum pads """ if self.is_enabled() and self._drum_matrix and self._drum_group_device: soloed_pads = find_if(lambda pad: pad.solo, self._all_drum_pads) for button, (col, row) in ifilter(first, self._drum_matrix.iterbuttons()): index = (self._drum_matrix.height() - 1 - row) * self._drum_matrix.width() + col if self._visible_drum_pads: pad = self._visible_drum_pads[index] self._update_pad_led(pad, button, soloed_pads) else: button.set_light('DrumGroup.PadInvisible')
def _extract_path(self, path, items = None, browser = None): if isinstance(path, (str, unicode)): path = [path] if items is None: items = browser.tags if path: name = path[0] elem = find_if(lambda x: x.name == name, items) if elem: items = self._extract_path(path[1:], elem.children) return tuple(items)
def _has_clip_listener(self): self._map_clip() if self.song.highlighted_clip_slot == self and self.has_clip: self.parent._wait( 2, self.parent.push2Manager.update_clip_grid_quantization) other_clip_slot = find_last( lambda cs: cs.has_clip and cs.index < self.index, self.track.clip_slots) or find_if(lambda cs: cs.has_clip, self.track.clip_slots) if other_clip_slot: self.track.track_name.set(playing_slot_index=other_clip_slot.index)
def _update_stop_scene_leds(self, index): scenes = self.song().scenes scene_index = index + self.scene_offset() if self.is_enabled() and self._stop_scene_clip_buttons is not None and index < len(self._stop_scene_clip_buttons): button = self._stop_scene_clip_buttons[index] if button is not None: value_to_send = None if scene_index < len(scenes) and scenes[scene_index].clip_slots: tracks = self.tracks_to_use() if find_if(lambda x: x.playing_slot_index == scene_index and x.fired_slot_index != -2, tracks): value_to_send = self._stop_clip_value elif find_if(lambda x: x.fired_slot_index == -2 and x.playing_slot_index == scene_index, tracks): value_to_send = self._stop_clip_triggered_value else: value_to_send = 'Session.StoppedClip' if value_to_send is None: button.turn_off() elif in_range(value_to_send, 0, 128): button.send_value(value_to_send) else: button.set_light(value_to_send)
def min_note_quantization_start(self): # type: (Clip) -> float notes = self.get_notes() if not len(notes): return 1 notes_start_quantization = [ find_if(lambda qtz: float(note.start / qtz).is_integer(), reversed(PUSH2_BEAT_QUANTIZATION_STEPS)) for note in notes ] if None in notes_start_quantization: return PUSH2_BEAT_QUANTIZATION_STEPS[3] # 1/16 by default else: return min(notes_start_quantization)
def make_instrument_from_simple_track(self, track): # type: (SimpleTrack) -> Optional[AbstractInstrument] from a_protocol_0.consts import INSTRUMENT_NAME_MAPPINGS from a_protocol_0.devices.InstrumentSimpler import InstrumentSimpler from a_protocol_0.devices.InstrumentMinitaur import InstrumentMinitaur if not len(track.all_devices): return None simpler_device = find_if(lambda d: d.is_simpler, track.all_devices) # type: Live.Device.Device if simpler_device: # simpler devices can change, other if track.instrument and track.instrument.device._device == simpler_device: return track.instrument return InstrumentSimpler(track=track, device=simpler_device) instrument_device = find_if( lambda d: d.is_plugin and d.name.lower() in INSTRUMENT_NAME_MAPPINGS, track.all_devices) if not instrument_device: if EXTERNAL_SYNTH_MINITAUR_NAME in track.name.lower(): return track.instrument or InstrumentMinitaur(track=track, device=None) else: return None class_name = INSTRUMENT_NAME_MAPPINGS[instrument_device.name.lower()] try: mod = __import__('a_protocol_0.devices.' + class_name, fromlist=[class_name]) except ImportError: self.parent.log_info("Import Error on instrument %s" % class_name) return None class_ = getattr(mod, class_name) return track.instrument or class_(track=track, device=instrument_device)
def selected_parameter(self): # type: () -> DeviceParameter param = find_if( lambda p: p._device_parameter == self.song._view. selected_parameter, [ param for track in self.simple_tracks for param in track.device_parameters ]) if not param: raise Protocol0Error("There is no currently selected parameter") return param
def _on_content_lists_changed(self): components = self._list_components contents = self._browser_model.content_lists[self._scroll_offset:] messages = self._browser_model.empty_list_messages scroll_depth = len(self._browser_model.content_lists) - len( self._list_components) self._max_scroll_offset = max(0, scroll_depth + 2) self._max_hierarchy = max(0, scroll_depth) for component, content, message in map(None, components, contents, messages): if component != None: component.scrollable_list = content component.empty_list_message = message active_lists = len(contents) num_head = clamp(active_lists - 1, 0, self.NUM_COLUMNS - 1) head = components[:num_head] last = components[num_head:] def set_data_sources_with_separator(component, sources, separator): for source in sources: source.separator = separator component.set_data_sources(sources) component.set_enabled(True) for idx, component in enumerate(head): offset = idx * self.COLUMN_SIZE sources = self._data_sources[offset:offset + self.COLUMN_SIZE] set_data_sources_with_separator(component, sources, '|') if last: offset = num_head * self.COLUMN_SIZE scrollable_list = last[0].scrollable_list if scrollable_list and find_if(lambda item: item.content.is_folder, scrollable_list.items): sources = self._data_sources[offset:offset + self.COLUMN_SIZE] map(DisplayDataSource.clear, self._data_sources[offset + self.COLUMN_SIZE:]) else: sources = self._data_sources[offset:] set_data_sources_with_separator(last[0], sources, '') for component in last[1:]: component.set_enabled(False) self.set_select_buttons(self._select_buttons) self.set_state_buttons(self._state_buttons) self.set_encoder_controls(self._encoder_controls) self._update_navigation_button_state() return
def _update_note_infos(self): if self.settings.is_enabled(): def min_max((l_min, l_max), (r_min, r_max)): return (min(l_min, r_min), max(l_max, r_max)) all_min_max_attributes = filter(None, imap(lambda e: e.get_min_max_note_values(), self._editors)) min_max_values = [(99999, -99999)] * 4 if len(all_min_max_attributes) > 0 else None for min_max_attribute in all_min_max_attributes: for i, attribute in enumerate(min_max_attribute): min_max_values[i] = min_max(min_max_values[i], attribute) for i in xrange(4): self.settings.set_min_max(i, min_max_values[i] if min_max_values else None) edit_all_notes_active = find_if(lambda e: e.modify_all_notes_enabled, self._editors) != None self.settings.set_info_message('Tweak to add note' if not edit_all_notes_active and not min_max_values else '')
def _on_content_lists_changed(self): components = self._list_components contents = self._browser_model.content_lists[self._scroll_offset:] messages = self._browser_model.empty_list_messages scroll_depth = len(self._browser_model.content_lists) - len(self._list_components) self._max_scroll_offset = max(0, scroll_depth + 2) self._max_hierarchy = max(0, scroll_depth) for component, content, message in map(None, components, contents, messages): if component != None: component.scrollable_list = content component.empty_list_message = message active_lists = len(contents) num_head = clamp(active_lists - 1, 0, self.NUM_COLUMNS - 1) head = components[:num_head] last = components[num_head:] def set_data_sources_with_separator(component, sources, separator): for source in sources: source.separator = separator component.set_data_sources(sources) component.set_enabled(True) for idx, component in enumerate(head): offset = idx * self.COLUMN_SIZE sources = self._data_sources[offset:offset + self.COLUMN_SIZE] set_data_sources_with_separator(component, sources, '|') if last: offset = num_head * self.COLUMN_SIZE scrollable_list = last[0].scrollable_list if scrollable_list and find_if(lambda item: item.content.is_folder, scrollable_list.items): sources = self._data_sources[offset:offset + self.COLUMN_SIZE] map(DisplayDataSource.clear, self._data_sources[offset + self.COLUMN_SIZE:]) else: sources = self._data_sources[offset:] set_data_sources_with_separator(last[0], sources, '') for component in last[1:]: component.set_enabled(False) self.set_select_buttons(self._select_buttons) self.set_state_buttons(self._state_buttons) self.set_encoder_controls(self._encoder_controls) self._update_navigation_button_state() return
def _select_note_mode(self, mod_device = None): track = self.song().view.selected_track current_device = self._device._device mod_device = self._is_mod(current_device) drum_device = find_if(lambda d: d.can_have_drum_pads, track.devices) self._step_sequencer.set_drum_group_device(drum_device) if track == None or track.is_foldable or track in self.song().return_tracks or track == self.song().master_track: self._note_modes.selected_mode = 'disabled' elif not mod_device is None: self._note_modes.selected_mode = 'disabled' self._note_modes.selected_mode = 'mod' if not self._host._active_client is mod_device: self._host._select_client(mod_device._number) elif track and track.has_audio_input: self._note_modes.selected_mode = 'looperhack' elif drum_device: self._note_modes.selected_mode = 'sequencer' else: self._note_modes.selected_mode = 'instrument'
def _get_selected_child_from_model(self): devices = map(second, self.children) selected = self._get_track().view.selected_device if selected == None: return find_if(lambda d: isinstance(d, Live.DrumPad.DrumPad), devices) is_deeper = False while selected: if selected in devices: if isinstance(selected, Live.DrumPad.DrumPad): self._on_selected_drum_pad() self._update_child_slots() return selected if is_deeper and selected.can_have_drum_pads: self._on_selected_drum_pad() self._update_child_slots() return selected.view.selected_drum_pad return selected selected = selected.canonical_parent is_deeper = True
def is_momentary(self): return find_if(lambda c: getattr(c, 'is_momentary', const(False))(), self.nested_control_elements()) != None
def is_pressed(self): return find_if(lambda c: getattr(c, 'is_pressed', const(False))(), self.owned_control_elements()) != None
def __getattr__(self, name): found = find_if(lambda x: x is not None, imap(lambda c: getattr(c.proxied_interface, name, None), self.outer.nested_control_elements())) if found is not None: return found raise AttributeError
def _find_item(self, path, items=None, browser=None): name = path[0] elem = find_if(lambda x: x.name == name, items) if elem: return [elem] if len(path) == 1 else self._find_item(path[1:], elem.children)
def is_selected(self): return find_if(lambda x: x.is_selected, self.children)
def _has_clip(self, scene_or_track): return find_if(lambda x: x.clip != None, scene_or_track.clip_slots) != None
def _validate_pads(self, pads): if find_if(lambda pad: pad < 0 or pad > 63, pads or []) != None: raise ValueError