def __init__(self, *a, **k): super(ATOM, self).__init__(*a, **k) with self.component_guard(): with inject(skin=const(skin)).everywhere(): self._elements = Elements() with self.component_guard(): with inject(element_container=const(self._elements)).everywhere(): self._create_lighting() self._create_transport() self._create_record_modes() self._create_undo() self._create_view_toggle() self._create_background() self._create_session() self._create_mixer() self._create_encoder_modes() self._create_session_navigation_modes() self._create_keyboard() self._create_drum_group() self._create_note_modes() self._create_pad_modes() self._create_user_assignments_mode() self._target_track = ArmedTargetTrackComponent( name=u'Target_Track') self.__on_target_track_changed.subject = self._target_track self._drum_group_finder = self.register_disconnectable( PercussionInstrumentFinder( device_parent=self._target_track.target_track)) self.__on_drum_group_changed.subject = self._drum_group_finder self.__on_drum_group_changed() self.__on_main_view_changed.subject = self.application.view
def __init__(self, *a, **k): super(Akai_Force_MPC, self).__init__(*a, **k) self._product_id = None self._element_injector = inject( element_container=const(None)).everywhere() self._is_initialized = False self._initialize_task = self._tasks.add(task.run(self._initialize)) self._initialize_task.kill() self._components_enabled = False with self.component_guard(): self._ping_element = SysexElement( send_message_generator=const(SYSEX_MSG_HEADER + (BROADCAST_ID, PING_MSG_TYPE, SYSEX_END_BYTE)), name=b'Ping_Element') self._pong_element = MultiElement( name=b'Pong_Multi_Element', *[ IdentifyingSysexElement( sysex_identifier=SYSEX_MSG_HEADER + (identifier, PONG_MSG_TYPE), name=(b'Pong_Element_{}').format(index)) for index, identifier in enumerate(SUPPORTED_PRODUCT_IDS) ]) self._ping_pong = PingPongComponent( on_pong_callback=self._identify, on_ping_timeout=partial(self._enable_components, False), name=b'Ping_Pong') self._ping_pong.layer = Layer(ping=self._ping_element, pong=self._pong_element) return
class Messenger(object): u""" Externally provided interface for those components that provide global Push feedback. """ expect_dialog = dependency(expect_dialog=const(nop)) show_notification = dependency(show_notification=const(nop))
def _create_components(self): self._fixed_length_setting = FixedLengthSetting() self._fixed_length_recording = FixedLengthRecording( self.song, self._fixed_length_setting) self._create_quantization() with inject(fixed_length_recording=(const( self._fixed_length_recording)), quantization_component=(const( self._quantization))).everywhere(): super(Launchpad_Pro_MK3, self)._create_components() self._create_recording_modes() self._create_session_overview() self._create_auto_arm() self._create_background() self._create_device_navigation() self._create_device_parameters() self._create_print_to_clip() self._create_undo_redo() self._create_transport() self._create_clip_actions() self._create_fixed_length() self._create_drum_group() self._create_scale_pad_translator() self._create_mixer_modes() self._create_session_modes() self._create_note_modes() self._create_main_modes() self._Launchpad_Pro_MK3__on_layout_switch_value.subject = self._elements.layout_switch
def __init__(self, *a, **k): super(OperatorDeviceComponent, self).__init__(*a, **k) self._bank_configuration = {1: BankConfiguration(lambda : u'Operator%i' % self.selected_oscillator, ButtonRange(3, 6)), self.FILTER_BANK: BankConfiguration(const(u'Filter'), ButtonRange(1, 3)), 3: BankConfiguration(const(u'Filter Env.'), ButtonRange(2, 5)), 6: BankConfiguration(const(u'LFO'), ButtonRange(2, 5)), 8: BankConfiguration(const(u'Pitch'), ButtonRange(2, 5))}
def __init__(self, clip_slot_copy_handler=None, fixed_length_recording=None, *a, **k): self._clip_copy_handler = clip_slot_copy_handler or ClipSlotCopyHandler() self._fixed_length_recording = fixed_length_recording with inject(copy_handler=(const(self._clip_copy_handler)), fixed_length_recording=(const(self._fixed_length_recording))).everywhere(): (super(SpecialSessionComponent, self).__init__)(*a, **k) self._slot_launch_button = None self._duplicate_button = None self._duplicate = DuplicateSceneComponent((self._session_ring), parent=self) self._duplicate_enabler = EnablingModesComponent(parent=self, component=(self._duplicate)) self._end_initialisation()
def _create_elements(self): with self.component_guard(): skin = Skin(ForceColors if self.is_force else MPCColors) with inject(skin=const(skin)).everywhere(): elements_class = None if self.is_force: elements_class = ForceElements elif self._product_id == MPC_X_PRODUCT_ID: elements_class = MPCXElements elif self._product_id == MPC_LIVE_PRODUCT_ID: elements_class = MPCLiveElements self._elements = elements_class(self._product_id) self._element_injector = inject(element_container=const(self._elements)).everywhere()
class SpecialClipSlotComponent(ClipSlotComponent, Messenger): @depends(copy_handler=const(None), fixed_length_recording=const(None)) def __init__(self, copy_handler=None, fixed_length_recording=None, *a, **k): assert copy_handler is not None assert fixed_length_recording is not None super(SpecialClipSlotComponent, self).__init__(*a, **k) self._copy_handler = copy_handler self._fixed_length_recording = fixed_length_recording return def _do_delete_clip(self): if self._clip_slot and self._clip_slot.has_clip: clip_name = self._clip_slot.clip.name self._clip_slot.delete_clip() self.show_notification(MessageBoxText.DELETE_CLIP % clip_name) def _do_select_clip(self, clip_slot): if liveobj_valid(self._clip_slot): if self.song.view.highlighted_clip_slot != self._clip_slot: self.song.view.highlighted_clip_slot = self._clip_slot def _do_duplicate_clip(self): self._copy_handler.duplicate(self._clip_slot) def _on_clip_duplicated(self, source_clip, destination_clip): slot_name = source_clip.name self.show_notification(MessageBoxText.DUPLICATE_CLIP % slot_name) def _clip_is_recording(self): return self.has_clip() and self._clip_slot.clip.is_recording def _do_launch_clip(self, fire_state): should_start_fixed_length_recording = self._fixed_length_recording.should_start_fixed_length_recording( self._clip_slot) clip_is_recording = self._clip_is_recording() if fire_state and not should_start_fixed_length_recording and not clip_is_recording or not fire_state: super(SpecialClipSlotComponent, self)._do_launch_clip(fire_state) else: if should_start_fixed_length_recording: track = self._clip_slot.canonical_parent self._fixed_length_recording.start_recording_in_slot( track, list(track.clip_slots).index(self._clip_slot)) else: if clip_is_recording: self._fixed_length_recording.stop_recording( self._clip_slot.clip)
def _setup_mod(self): def get_monomodular(host): if isinstance(__builtins__, dict): if not 'monomodular' in list(__builtins__.keys()) or not isinstance(__builtins__['monomodular'], ModRouter): __builtins__['monomodular'] = ModRouter(song = self.song, register_component = self._register_component) else: if not hasattr(__builtins__, 'monomodular') or not isinstance(__builtins__['monomodular'], ModRouter): setattr(__builtins__, 'monomodular', ModRouter(song = self.song, register_component = self._register_component)) monomodular = __builtins__['monomodular'] if not monomodular.has_host(): monomodular.set_host(host) return monomodular self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, nav_up_button = self.elements.octave_up_button, nav_down_button = self.elements.octave_down_button, nav_left_button = self.elements.in_button, nav_right_button = self.elements.out_button, key_buttons = self.elements.side_buttons, ) self.modhandler.alt_shift_layer = AddLayerMode( self.modhandler, Layer(Shift_button = self.elements.shift_button, Alt_button = self.elements.select_button)) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6], )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], )) #lock_button = self.elements.master_select_button, #)) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 7, )) #key_buttons = self.elements.select_buttons)) #key_buttons = self.elements.track_state_buttons)) self._device_provider.restart_mod() # self._modHandle = ModControl(monomodular = self.monomodular, is_momentary = True, msg_type = MIDI_NOTE_TYPE, channel = 15, identifier = 0, name = 'ModHandle') self._modHandle = ModControl(modscript = self, monomodular = self.monomodular, name = 'ModHandle')
def __init__(self, device_bank_registry=None, banking_info=None, info_layer=None, delete_handler=None, session_ring=None, *a, **k): super(DeviceNavigationComponent, self).__init__(*a, **k) self._make_navigation_node = partial( make_navigation_node, session_ring=session_ring, device_bank_registry=device_bank_registry, banking_info=banking_info) self._delete_handler = delete_handler self._updating_children = BooleanContext() self._device_list = self.register_component( ScrollableListWithTogglesComponent()) self._on_selection_clicked_in_controller.subject = self._device_list self._on_selection_changed_in_controller.subject = self._device_list self._on_state_changed_in_controller.subject = self._device_list self._current_node = None self._message_box = self.register_component( MessageBoxComponent(layer=info_layer, is_enabled=False)) self._message_box.text = consts.MessageBoxText.EMPTY_DEVICE_CHAIN self._selected_track = None self._on_selected_track_changed.subject = self.song.view with inject(selection=const(NamedTuple( selected_device=None))).everywhere(): self._on_selected_track_changed() self._on_device_parameters_changed.subject = self._selected_track.view.selected_device return
def __init__(self, session_modes=None, *a, **k): assert session_modes is not None super(SimpleModeSwitcher, self).__init__(*a, **k) self._session_modes = session_modes self._cycle_mode = session_modes.cycle_mode self._get_current_alternative_mode = const(session_modes) return
def __init__(self, name=None, default_label=None, callback=None, is_active=None, *a, **k): assert callback super(DeviceTriggerOption, self).__init__(*a, **k) self.trigger = callback self._name = name or 'Option' self._default_label = default_label or self._name self._is_active_callback = is_active or const(True)
class AumPush2DeviceProvider(ModDeviceProvider): allow_update_callback = const(True) def update_device_selection(self): if self.allow_update_callback(): super(AumPush2DeviceProvider, self).update_device_selection()
def __init__(self, name = None, default_label = None, callback = None, is_active = None, *a, **k): raise callback or AssertionError super(DeviceTriggerOption, self).__init__(*a, **k) self.trigger = callback self._name = name or 'Option' self._default_label = default_label or self._name self._is_active_callback = is_active or const(True)
class FixedLengthTrackRecordingComponent(TrackRecordingComponent): """' Fixed length track recording records a new clip on the selected track with the length determined by the fixed length setting """ __module__ = __name__ @depends(fixed_length_recording=const(None)) def __init__(self, target_track_component, fixed_length_recording, *a, **k): assert fixed_length_recording is not None self._fixed_length_recording = fixed_length_recording super(FixedLengthTrackRecordingComponent, self).__init__(target_track_component, *a, **k) return def _start_recording(self): track = self._target_track_component.target_track song = self.song slot_index = list(song.scenes).index(song.view.selected_scene) slot = track.clip_slots[slot_index] if self._fixed_length_recording.should_start_recording_in_slot(slot): self._fixed_length_recording.start_recording_in_slot(slot) else: super(FixedLengthTrackRecordingComponent, self)._start_recording()
def _setup_mod(self): def get_monomodular(host): if isinstance(__builtins__, dict): if not 'monomodular' in __builtins__.keys() or not isinstance(__builtins__['monomodular'], ModRouter): __builtins__['monomodular'] = ModRouter(song = self.song, register_component = self._register_component) else: if not hasattr(__builtins__, 'monomodular') or not isinstance(__builtins__['monomodular'], ModRouter): setattr(__builtins__, 'monomodular', ModRouter(song = self.song, register_component = self._register_component)) monomodular = __builtins__['monomodular'] if not monomodular.has_host(): monomodular.set_host(host) return monomodular self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) #debug('mod task group:', self.modhandler.parent_task_group) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, shift_button = self.elements.shift_button, alt_button = self.elements.select_button, nav_up_button = self.elements.octave_up_button, nav_down_button = self.elements.octave_down_button, nav_left_button = self.elements.in_button, nav_right_button = self.elements.out_button, key_buttons = self.elements.side_buttons, ) #self.modhandler.layer.priority = 0 self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6], )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], )) #lock_button = self.elements.master_select_button, #)) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 7, )) #key_buttons = self.elements.select_buttons)) #key_buttons = self.elements.track_state_buttons)) self._device_provider.restart_mod()
def __init__(self, *a, **k): super(Code, self).__init__(*a, **k) with self.component_guard(): with inject(skin=const(make_default_skin())).everywhere(): self._create_controls() self._create_transport() self._create_mixer() self._create_mixer_navigation()
def apply_properties(self, new_object, song): decorated = None with inject(song=(const(song))).everywhere(): decorated = self._factory.decorate(new_object, additional_properties=(self._copied_additional_properties), song=song) self._apply_nested_properties(decorated) return decorated
def __init__(self, *a, **k): (super(NovationBase, self).__init__)( a, product_id_bytes=sysex.NOVATION_MANUFACTURER_ID + self.model_family_code + sysex.DEVICE_FAMILY_MEMBER_CODE, **k) self._element_injector = inject( element_container=(const(None))).everywhere() with self.component_guard(): with inject(skin=(const(self.skin))).everywhere(): self._elements = self.element_class() self._element_injector = inject( element_container=(const(self._elements))).everywhere() if self.suppress_layout_switch: self.register_slot(self._elements.layout_switch, nop, 'value') with self.component_guard(): self._create_components()
def __init__(self, parameter_provider = None, device_type_provider = const('default'), view = None, *a, **k): raise parameter_provider is not None or AssertionError raise view is not None or AssertionError super(DeviceViewConnector, self).__init__(*a, **k) self._parameter_provider = parameter_provider self._view = view self._parameters = None self._device_type_provider = device_type_provider
class State(ControlList.State): @depends(song=const(None)) def __init__(self, song, *a, **k): super(FootswitchRowControl.State, self).__init__(*a, **k) assert song is not None self.song = song self._beat_pulse_end_pulse_timer = None self._subdivision_pulse_end_pulse_timer = None self._pulse_beat_pulse_leds_timer = None self._last_beat = None self._last_sub_division = None self.__on_tempo_changed.subject = song self.__on_tempo_changed() def update_time(self, time): beat = time.beats if beat != self._last_beat: self._update_led_pulse(u'Beat_Pulse', True) self._beat_pulse_end_pulse_timer.start() self._last_beat = beat sub_division = time.sub_division if sub_division != self._last_sub_division and sub_division % 2 != 0: self._update_led_pulse(u'Subdivision_Pulse', True) self._subdivision_pulse_end_pulse_timer.start() self._last_sub_division = sub_division @listens(u'tempo') def __on_tempo_changed(self): self._init_led_flashing(self.song.tempo) def _init_led_flashing(self, tempo): def make_led_end_pulse_timer(pulse_type, pulse_length): looper = weakref.ref(self) def end_pulse(): self = looper() if self: self._update_led_pulse(pulse_type, False) return Live.Base.Timer(callback=end_pulse, interval=int(1000 * pulse_length), repeat=False) seconds_per_beat = old_div(60.0, tempo) subdivision_pulse_pulse_length = PULSE_LENGTH_FRACTION * old_div( seconds_per_beat, 2.0) beat_pulse_pulse_length = PULSE_LENGTH_FRACTION * seconds_per_beat self._subdivision_pulse_end_pulse_timer = make_led_end_pulse_timer( u'Subdivision_Pulse', subdivision_pulse_pulse_length) self._beat_pulse_end_pulse_timer = make_led_end_pulse_timer( u'Beat_Pulse', beat_pulse_pulse_length) def _update_led_pulse(self, pulse_type, on): assert pulse_type in PULSE_COLORS for control in filter(lambda c: c._control_element, self): if control.color == pulse_type: control._control_element.set_light( u'DefaultButton.On' if on else u'DefaultButton.Off')
def __init__(self, *a, **k): super(OperatorDeviceComponent, self).__init__(*a, **k) self._bank_configuration = { 1: BankConfiguration(lambda: u'Operator%i' % self.selected_oscillator, ButtonRange(3, 6)), self.FILTER_BANK: BankConfiguration(const(u'Filter'), ButtonRange(1, 3)), 3: BankConfiguration(const(u'Filter Env.'), ButtonRange(2, 5)), 6: BankConfiguration(const(u'LFO'), ButtonRange(2, 5)), 8: BankConfiguration(const(u'Pitch'), ButtonRange(2, 5)) } envelope_prefixes = [u'Ae', u'Be', u'Ce', u'De', u'Fe', u'Le', u'Pe'] self._parameter_name_features = get_parameter_name_to_envelope_features_map( envelope_prefixes)
def _setup_mod(self): self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component=const(self._register_component), song=const(self.song)).everywhere(): self.modhandler = PushModHandler( self ) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority=10, lock_button=self.elements.note_mode_button, grid=self.elements.matrix, key_buttons=self.elements.select_buttons, key2_buttons=self.elements.track_state_buttons, Shift_button=self.elements.shift_button, Alt_button=self.elements.select_button, detent_dial=self.elements.tempo_control, master_dial=self.elements.master_volume_control, name_display_line=self.elements.display_line3, value_display_line=self.elements.display_line4) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority=6, nav_up_button=self.elements.nav_up_button, nav_down_button=self.elements.nav_down_button, nav_left_button=self.elements.nav_left_button, nav_right_button=self.elements.nav_right_button, channel_buttons=self.elements.matrix.submatrix[:, 1:2], nav_matrix=self.elements.matrix.submatrix[4:8, 2:6])) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority=6, lock_button=self.elements.master_select_button, )) #device_selector_matrix = self.elements.matrix.submatrix[:, :1], self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer(priority=6, alt_name_display_line=self.elements.display_line3, alt_value_display_line=self.elements.display_line4))
def __init__(self, name=None, default_label=None, callback=None, is_active=None): raise callback or AssertionError self.trigger = callback self._name = name or 'Option' self._default_label = default_label or self._name self._is_active_callback = is_active or const(True)
def __init__(self, *a, **k): super(PushBase, self).__init__(*a, **k) self.register_slot(self.song.view, self._on_selected_track_changed, 'selected_track') self._device_decorator_factory = self._create_device_decorator_factory() self.register_disconnectable(self._device_decorator_factory) self._double_press_context = DoublePressContext() injecting = self._create_injector() self._push_injector = injecting.everywhere() self._element_injector = inject(element_container=const(None)).everywhere() with self.component_guard(): self._suppress_sysex = False self._skin = self._create_skin() self._clip_creator = ClipCreator() self._note_editor_settings = [] self._notification = None self._user = None with inject(skin=const(self._skin)).everywhere(): self._create_controls() self._element_injector = inject(element_container=const(self.elements)).everywhere()
def query(self, browser): root = super(SourceBrowserQuery, self).query(browser) groups = dict() for item in root: groups.setdefault(item.source, []).append(item) return map( lambda (k, g): VirtualBrowserItem(name=k if k is not None else '', children_query=const(g)), sorted(groups.items(), key=first))
def __init__(self, *a, **k): (super(FA, self).__init__)(*a, **k) with self.component_guard(): with inject(skin=(const(make_default_skin()))).everywhere(): self._create_controls() self._create_transport() self._create_session_recording() self._create_mixer() self._create_navigation() self._create_modes() self._create_drums()
class MockControlSurface(object): instance_identifier = const(0) request_rebuild_midi_map = count_calls() show_message = nop send_midi = nop def __init__(self, *a, **k): super(MockControlSurface, self).__init__(*a, **k) self._song = Live.Song.Song(num_tracks=4, num_returns=2) def song(self): return self._song
def query(self, browser): root = super(SourceBrowserQuery, self).query(browser) groups = dict() for item in root: groups.setdefault(item.source, []).append(item) return list( map( lambda k_g: VirtualBrowserItem(name=(k_g[0] if k_g[0] is not None else ''), children_query=(const(k_g[1]))), sorted((list(groups.items())), key=first)))
def __init__(self, *a, **k): super(Oxygen_Pro, self).__init__(*a, **k) with self.component_guard(): self._elements = Elements() with inject(element_container=const(self._elements)).everywhere(): self._create_transport() self._create_undo_redo() self._create_device_parameters() self._create_session() self._create_mixer() self._create_record_modes() self.__on_main_view_changed.subject = self.application.view
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._main_modes = NullModes() self._element_injector = inject( element_container=const(None)).everywhere() self._message_injector = inject(message=const(None)).everywhere() with self.component_guard(): with inject(skin=const(skin), message_cache=const( self._sysex_message_cache)).everywhere(): self._elements = Elements() self._element_injector = inject( element_container=const(self._elements)).everywhere() with self.component_guard(): self._create_message() self._message_injector = inject( message=const(self._message)).everywhere() self._switch_display_layout(sysex.KNOB_SCREEN_LAYOUT_BYTE) self._device_bank_registry = DeviceBankRegistry() with self.component_guard(): self._create_session() self._create_mixer() self._create_session_recording() self._create_auto_arm() self._create_track_navigation() self._create_device() self._create_device_navigation() self._create_background() self._create_modes() return
def __init__(self, *a, **k): super(ComradeEncoders, self).__init__((), *a, **k) self._main_modes = NullModes() self._element_injector = inject(element_container=const(None)).everywhere() self._message_injector = inject(message=const(None)).everywhere() with self.component_guard(): with inject(skin=const(skin), message_cache=const(self._sysex_message_cache)).everywhere(): self._elements = Elements() self._element_injector = inject(element_container=const(self._elements)).everywhere() with self.component_guard(): self._create_message() self._message_injector = inject(message=const(self._message)).everywhere() self._switch_display_layout(sysex.KNOB_SCREEN_LAYOUT_BYTE) self._device_bank_registry = DeviceBankRegistry() with self.component_guard(): self._create_transport() self._create_auto_arm() self._create_drums() self._create_device() self._create_device_navigation() self._create_actions() self._create_clip_actions() self._create_background() self._create_modes() self._drum_group_finder = self.register_disconnectable(PercussionInstrumentFinder(device_parent=self.song.view.selected_track)) self.__on_drum_group_found.subject = self._drum_group_finder self.__on_drum_group_found() self.__on_selected_track_changed.subject = self.song.view self.__on_selected_track_changed() self.__on_record_mode_changed.subject = self.song self.set_feedback_channels([DRUM_FEEDBACK_CHANNEL]) self._set_feedback_velocity()
class FixedLengthClipSlotComponent(ClipSlotComponentBase): @depends(fixed_length_recording=(const(None))) def __init__(self, fixed_length_recording, *a, **k): (super(FixedLengthClipSlotComponent, self).__init__)(*a, **k) self._fixed_length_recording = fixed_length_recording def _do_launch_clip(self, fire_state): slot = self._clip_slot if self._fixed_length_recording.should_start_recording_in_slot(slot): self._fixed_length_recording.start_recording_in_slot(slot) else: super(FixedLengthClipSlotComponent, self)._do_launch_clip(fire_state)
def _setup_mod(self): self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, shift_button = self.elements.shift_button, alt_button = self.elements.select_button, key_buttons = self.elements.side_buttons) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 6, nav_up_button = self.elements.nav_up_button, nav_down_button = self.elements.nav_down_button, nav_left_button = self.elements.nav_left_button, nav_right_button = self.elements.nav_right_button, channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6] )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 6, device_selector_matrix = self.elements.matrix.submatrix[:, :1], lock_button = self.elements.master_select_button, name_display_line = self.elements.display_line3, value_display_line = self.elements.display_line4 )) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 6, alt_name_display_line = self.elements.display_line3, alt_value_display_line = self.elements.display_line4 ))
def __init__(self, device_bank_registry = None, banking_info = None, info_layer = None, delete_handler = None, session_ring = None, *a, **k): super(DeviceNavigationComponent, self).__init__(*a, **k) self._make_navigation_node = partial(make_navigation_node, session_ring=session_ring, device_bank_registry=device_bank_registry, banking_info=banking_info) self._delete_handler = delete_handler self._device_list = self.register_component(ScrollableListWithTogglesComponent()) self._on_selection_clicked_in_controller.subject = self._device_list self._on_selection_changed_in_controller.subject = self._device_list self._on_state_changed_in_controller.subject = self._device_list self._current_node = None self._message_box = self.register_component(MessageBoxComponent(layer=info_layer, is_enabled=False)) self._message_box.text = consts.MessageBoxText.EMPTY_DEVICE_CHAIN self._selected_track = None self._on_selected_track_changed.subject = self.song.view with inject(selection=const(NamedTuple(selected_device=None))).everywhere(): self._on_selected_track_changed()
def query(self, browser): root = super(SourceBrowserQuery, self).query(browser) groups = dict() for item in root: groups.setdefault(item.source, []).append(item) return map(lambda (k, g): VirtualBrowserItem(name=k if k is not None else '', children_query=const(g)), sorted(groups.items(), key=first))
def _create_injector(self): return inject(double_press_context=const(self._double_press_context), double_click_context=const(self._double_click_context), expect_dialog=const(self.expect_dialog), show_notification=const(self.show_notification), commit_model_changes=const(self._model.commit_changes), register_real_time_data=const(self.register_real_time_data), selection=lambda : PushSelection(application=self.application(), device_component=self._device_component, navigation_component=self._device_navigation))
def _component_guard(self): with super(Push2, self)._component_guard(): with inject(real_time_mapper=const(self._c_instance.real_time_mapper)).everywhere(): yield self._commit_real_time_data_changes() self._model.commit_changes()
def __init__(self, name = None, default_label = None, callback = None, is_active = None): raise callback or AssertionError self.trigger = callback self._name = name or 'Option' self._default_label = default_label or self._name self._is_active_callback = is_active or const(True)
def _create_injector(self): return inject(double_press_context=const(self._double_press_context), expect_dialog=const(self.expect_dialog), show_notification=const(self.show_notification), selection=lambda : PushSelection(application=self.application(), device_component=self._device_component, navigation_component=self._device_navigation))