Ejemplo n.º 1
0
    def __init__(self, scrollable_list=None, data_sources=tuple(), *a, **k):
        super(ListComponent, self).__init__(*a, **k)
        self._data_sources = data_sources
        self._activation_task = Task.Task()
        self._action_on_scroll_task = Task.Task()
        self._scrollable_list = None
        self._scroller = self.register_component(ScrollComponent())
        self._pager = self.register_component(ScrollComponent())
        self.last_action_item = lambda: self._last_action_item
        self.item_formatter = DefaultItemFormatter()
        for c in (self._scroller, self._pager):
            for button in (c.scroll_up_button, c.scroll_down_button):
                button.color = 'List.ScrollerOn'
                button.pressed_color = None
                button.disabled_color = 'List.ScrollerOff'

        if scrollable_list == None:
            self.scrollable_list = ActionList(
                num_visible_items=len(data_sources))
        else:
            self.scrollable_list = scrollable_list
        self._scrollable_list.num_visible_items = len(data_sources)
        self._delay_activation = BooleanContext()
        self._selected_index_float = 0.0
        self._in_encoder_selection = BooleanContext(False)
        self._execute_action_task = self._tasks.add(
            Task.sequence(Task.delay(1), Task.run(self._execute_action)))
        self._execute_action_task.kill()
Ejemplo n.º 2
0
 def __init__(self, play_toggle_model_transform=const(True), *a, **k):
     super(TransportComponent, self).__init__(*a, **k)
     self._ffwd_button = None
     self._rwd_button = None
     self._tap_tempo_button = None
     self._tempo_control = None
     self._tempo_fine_control = None
     self._song_position_control = None
     self._rwd_task = Task.Task()
     self._ffwd_task = Task.Task()
     self._fine_tempo_needs_pickup = True
     self._prior_fine_tempo_value = -1
     self._end_undo_step_task = self._tasks.add(
         Task.sequence(Task.wait(1.5), Task.run(self.song().end_undo_step)))
     self._end_undo_step_task.kill()
     song = self.song()
     self._loop_toggle, self._punch_in_toggle, self._punch_out_toggle, self._record_toggle, self._play_toggle, self._stop_toggle, self._nudge_down_toggle, self._nudge_up_toggle, self._metronome_toggle, self._arrangement_overdub_toggle, self._overdub_toggle = self.register_components(
         ToggleComponent('loop', song),
         ToggleComponent('punch_in', song, is_momentary=True),
         ToggleComponent('punch_out', song, is_momentary=True),
         ToggleComponent('record_mode', song),
         ToggleComponent('is_playing',
                         song,
                         model_transform=play_toggle_model_transform),
         ToggleComponent('is_playing',
                         song,
                         model_transform=const(False),
                         view_transform=const(False)),
         ToggleComponent('nudge_down', song, is_momentary=True),
         ToggleComponent('nudge_up', song, is_momentary=True),
         ToggleComponent('metronome', song),
         ToggleComponent('arrangement_overdub', song),
         ToggleComponent('overdub', song))
     return
 def __init__(self,
              notification_time=2.5,
              blinking_time=0.3,
              display_lines=[],
              *a,
              **k):
     super(NotificationComponent, self).__init__(*a, **k)
     self._display_lines = display_lines
     self._token_control = _TokenControlElement()
     self._align_text_fn = self._default_align_text_fn
     self._message_box = self.register_component(MessageBoxComponent())
     self._message_box.set_enabled(False)
     self._notification_timeout_task = self._tasks.add(
         Task.sequence(Task.wait(notification_time),
                       Task.run(self.hide_notification))
     ).kill() if notification_time != -1 else self._tasks.add(Task.Task())
     self._blink_text_task = self._tasks.add(
         Task.loop(
             Task.sequence(
                 Task.run(lambda: self._message_box.
                          __setattr__('text', self._original_text)),
                 Task.wait(blinking_time),
                 Task.run(lambda: self._message_box.__setattr__(
                     'text', self._blink_text)),
                 Task.wait(blinking_time)))).kill()
     self._original_text = None
     self._blink_text = None
 def __init__(self, scrollable_list=None, data_sources=tuple(), *a, **k):
     super(ListComponent, self).__init__(*a, **k)
     self._data_sources = data_sources
     self._activation_task = Task.Task()
     self._action_on_scroll_task = Task.Task()
     self._scrollable_list = None
     self._scroller = self.register_component(ScrollComponent())
     self.last_action_item = lambda: self._last_action_item
     if scrollable_list == None:
         self.scrollable_list = ActionList(
             num_visible_items=len(data_sources))
     else:
         self.scrollable_list = scrollable_list
     self._scrollable_list.num_visible_items = len(data_sources)
     self._delay_activation = BooleanContext()
     self._selected_index_float = 0.0
     self._in_encoder_selection = BooleanContext(False)
     self._execute_action_task = self._tasks.add(
         Task.sequence(Task.delay(1), Task.run(self._execute_action)))
     self._execute_action_task.kill()
Ejemplo n.º 5
0
    def enable_push_emulation(self, scripts):
        """ Try to enable Push's test mode to allow for emulation. 
	If emulating for APC, set scripts on combiner component """
        for script in scripts:
            script_name = script.__class__.__name__
            if script_name == 'Push':
                script._handshake._identification_timeout_task.kill()
                script._handshake._identification_timeout_task = Task.Task()
                #script.enable_test_mode()
                break
        if self._push_apc_combiner:
            self._push_apc_combiner.set_up_scripts(self._control_surfaces())
 def __init__(self, name='Transport_Control', *a, **k):
     super(SpecialTransportComponent, self).__init__(name=name, *a, **k)
     self._relative_tempo_control = None
     self._relative_tempo_fine_control = None
     self._ffwd_button = None
     self._rwd_button = None
     self._rwd_task = Task.Task()
     self._ffwd_task = Task.Task()
     self._nudge_down_button = None
     self._nudge_up_button = None
     self._last_record_quantization = RQ.rec_q_sixtenth
     self._on_is_playing_changed.subject = self.song()
     self._on_overdub_changed.subject = self.song()
     self._on_record_mode_changed.subject = self.song()
     self._on_metronome_changed.subject = self.song()
     self._on_loop_changed.subject = self.song()
     self._on_record_quantize_changed.subject = self.song()
     self._on_can_jump_to_prev_cue_changed.subject = self.song()
     self._on_can_jump_to_next_cue_changed.subject = self.song()
     self._end_undo_step_task = self._tasks.add(Task.sequence(Task.wait(1.5), Task.run(self.song().end_undo_step)))
     self._end_undo_step_task.kill()
     return
Ejemplo n.º 7
0
    def enable_push_emulation(self, scripts):
	""" Try to disable Push's handshake to allow for emulation. 
	If emulating for APC, set scripts on combiner component """
	for script in scripts:
	    script_name = script.__class__.__name__  
	    if script_name == 'Push':
		if IS_LIVE_9_5:
		    with script._component_guard():
			script._start_handshake_task = MockHandshakeTask()
			script._handshake = MockHandshake()
		    if self._push_apc_combiner:
			self._push_apc_combiner.set_up_scripts(self._control_surfaces())
		else:
		    script._handshake._identification_timeout_task.kill()
		    script._handshake._identification_timeout_task = Task.Task()
		break
Ejemplo n.º 8
0
 def __init__(self, *a, **k):
     super(ActionWithSettingsComponent, self).__init__(*a, **k)
     self._is_showing_settings = False
     self._action_button = None
     self._settings_task = Task.Task()