Beispiel #1
0
	def __init__(self, attribute_tag = None, *a, **k):
		self._attribute_tag = '@'+attribute_tag+':'
		super(TaggedSettingsComponent, self).__init__(*a, **k)
		self._read_tag_task = self._parent_task_group.add(task.sequence(task.wait(.1), task.run(self._read_attribute_tag)))
		self._read_tag_task.kill()
		self._set_tag_task = self._parent_task_group.add(task.sequence(task.wait(.1), task.run(self._set_attribute_tag)))
		self._set_tag_task.kill()
Beispiel #2
0
    def _show_welcome_message(self):
        welcome = 'Welcome to Maschine MKiii'
        live_version = '{}'.format(self.live_version)
        display_welcome = partial(
            self._info_display.display_message_on_maschine, welcome, 0)
        clear_display = partial(self._info_display.clear_display, 0)
        self._tasks.add(
            task.sequence(
                task.run(display_welcome), task.wait(1),
                task.run(clear_display), task.wait(0.2),
                task.run(
                    partial(self._info_display.display_message_on_maschine,
                            self._main_modes.selected_mode.replace('_', ' '),
                            0))))

        display_live_version = partial(
            self._info_display.display_message_on_maschine, live_version, 2)
        clear_display = partial(self._info_display.clear_display, 2)
        self._tasks.add(
            task.sequence(
                task.run(display_live_version), task.wait(1),
                task.run(clear_display), task.wait(0.2),
                task.run(
                    partial(
                        self._info_display.display_message_on_maschine,
                        'Track - {}'.format(
                            self.song.view.selected_track.name), 2))))
Beispiel #3
0
 def __init__(self,
              default_notification_time=2.5,
              blinking_time=0.3,
              display_lines=[],
              *a,
              **k):
     super(NotificationComponent, self).__init__(*a, **k)
     self._display_lines = get_element(display_lines)
     self._token_control = _TokenControlElement()
     self._align_text_fn = self._default_align_text_fn
     self._message_box = MessageBoxComponent(parent=self)
     self._message_box.set_enabled(False)
     self._default_notification_time = default_notification_time
     self._blinking_time = blinking_time
     self._original_text = None
     self._blink_text = None
     self._blink_text_task = self._tasks.add(
         task.loop(
             task.sequence(
                 task.run(lambda: self._message_box.__setattr__(
                     'text', self._original_text)),
                 task.wait(self._blinking_time),
                 task.run(lambda: self._message_box.__setattr__(
                     'text', self._blink_text)),
                 task.wait(self._blinking_time)))).kill()
     return
    def __init__(self, preferences = dict(), commit_model_changes = None, selection = None, *a, **k):
        raise commit_model_changes is not None or AssertionError
        super(BrowserComponent, self).__init__(*a, **k)
        self._lists = []
        self._browser = Live.Application.get_application().browser
        self._current_hotswap_target = self._browser.hotswap_target
        self._updating_root_items = BooleanContext()
        self._focused_list_index = 0
        self._commit_model_changes = commit_model_changes
        self._preferences = preferences
        self._expanded = False
        self._unexpand_with_scroll_encoder = False
        self._delay_preview_list = BooleanContext()
        self._selection = selection
        self._load_next = False
        self._content_filter_type = None
        self._content_hotswap_target = None
        self._preview_list_task = self._tasks.add(task.sequence(task.wait(self.REVEAL_PREVIEW_LIST_TIME), task.run(self._replace_preview_list_by_task))).kill()
        self._update_root_items()
        self._update_navigation_buttons()
        self._update_load_text()
        self._update_context()
        self.prehear_button.is_toggled = preferences.setdefault('browser_prehear', True)
        self._on_selected_track_color_index_changed.subject = self.song.view
        self._on_selected_track_name_changed.subject = self.song.view
        self._on_hotswap_target_changed.subject = self._browser
        self.register_slot(self, self.notify_focused_item, 'focused_list_index')

        def auto_unexpand():
            self.expanded = False
            self._update_list_offset()

        self._unexpand_task = self._tasks.add(task.sequence(task.wait(self.EXPAND_LIST_TIME), task.run(auto_unexpand))).kill()
        return
Beispiel #5
0
 def _blink_task(self):
     blink_on = partial(self._set_blinking_color, self.blink_on_color)
     blink_off = partial(self._set_blinking_color, self.blink_off_color)
     return self.tasks.add(
         task.sequence(
             task.run(blink_on), task.wait(self._blink_period),
             task.run(blink_off), task.wait(self._blink_period),
             task.run(blink_on), task.wait(self._blink_period),
             task.run(blink_off)))
 def __init__(self, identity_control=None, presentation_control=None, dongle_control=None, dongle=(0, 0), *a, **k):
     (super(HandshakeComponent, self).__init__)(*a, **k)
     self._identity_control = identity_control
     self._presentation_control = presentation_control
     self._dongle_one, self._dongle_two = dongle
     self._on_identity_value.subject = identity_control
     self._on_dongle_value.subject = dongle_control
     self._delay_dongle_task = self._tasks.add(task.sequence(task.wait(DONGLE_DELAY), task.run(dongle_control.enquire_value)))
     self._delay_dongle_task.kill()
     self._identification_timeout_task = self._tasks.add(task.sequence(task.wait(HANDSHAKE_TIMEOUT), task.run(self._do_fail)))
     self._identification_timeout_task.kill()
Beispiel #7
0
 def __init__(self, *a, **k):
     super(SessionRecordingMixin, self).__init__(*a, **k)
     blink_on = partial(self._set_record_button_color,
                        'Recording.CaptureTriggered')
     blink_off = partial(self._set_record_button_color, 'DefaultButton.Off')
     self._blink_task = self._tasks.add(
         task.sequence(task.run(blink_on), task.wait(BLINK_PERIOD),
                       task.run(blink_off), task.wait(BLINK_PERIOD),
                       task.run(blink_on), task.wait(BLINK_PERIOD),
                       task.run(blink_off)))
     self._blink_task.kill()
 def __init__(self, attribute_tag=None, *a, **k):
     self._attribute_tag = "@" + attribute_tag + ":"
     super(TaggedSettingsComponent, self).__init__(*a, **k)
     self._read_tag_task = self._parent_task_group.add(
         task.sequence(task.wait(0.1), task.run(self._read_attribute_tag))
     )
     self._read_tag_task.kill()
     self._set_tag_task = self._parent_task_group.add(
         task.sequence(task.wait(0.1), task.run(self._set_attribute_tag))
     )
     self._set_tag_task.kill()
Beispiel #9
0
    def __init__(self,
                 preferences=dict(),
                 commit_model_changes=None,
                 selection=None,
                 main_modes_ref=None,
                 *a,
                 **k):
        assert commit_model_changes is not None
        super(BrowserComponent, self).__init__(*a, **k)
        self._lists = []
        self._browser = Live.Application.get_application().browser
        self._current_hotswap_target = self._browser.hotswap_target
        self._updating_root_items = BooleanContext()
        self._focused_list_index = 0
        self._commit_model_changes = commit_model_changes
        self._preferences = preferences
        self._expanded = False
        self._unexpand_with_scroll_encoder = False
        self._delay_preview_list = BooleanContext()
        self._selection = selection
        self._main_modes_ref = main_modes_ref if main_modes_ref is not None else nop
        self._load_neighbour_overlay = self.register_component(
            LoadNeighbourOverlayComponent(is_enabled=False))
        self._content_filter_type = None
        self._content_hotswap_target = None
        self._preview_list_task = self._tasks.add(
            task.sequence(task.wait(self.REVEAL_PREVIEW_LIST_TIME),
                          task.run(
                              self._replace_preview_list_by_task))).kill()
        self._update_root_items()
        self._update_navigation_buttons()
        self._update_context()
        self.prehear_button.is_toggled = preferences.setdefault(
            u'browser_prehear', True)
        self._on_selected_track_color_index_changed.subject = self.song.view
        self._on_selected_track_name_changed.subject = self.song.view
        self._on_detail_clip_name_changed.subject = self.song.view
        self._on_hotswap_target_changed.subject = self._browser
        self._on_load_next.subject = self._load_neighbour_overlay
        self._on_load_previous.subject = self._load_neighbour_overlay
        self._on_focused_item_changed.subject = self
        self.register_slot(self, self.notify_focused_item,
                           u'focused_list_index')

        def auto_unexpand():
            self.expanded = False
            self._update_list_offset()

        self._unexpand_task = self._tasks.add(
            task.sequence(task.wait(self.EXPAND_LIST_TIME),
                          task.run(auto_unexpand))).kill()
        return
Beispiel #10
0
 def create_welcome_component(self):
     self._welcome = MaschineWelcome(name='Welcome')
     self._welcome.layer = Layer(pads='pad_matrix',
                                 group_buttons='group_matrix')
     self._tasks.add(
         task.sequence(task.wait(2),
                       task.run(partial(self._welcome.set_enabled, False))))
Beispiel #11
0
 def __init__(self,
              device_provider=None,
              device_bank_registry=None,
              toggle_lock=None,
              *a,
              **k):
     super(SimpleDeviceParameterComponent, self).__init__(*a, **k)
     self._toggle_lock = toggle_lock
     self._device = None
     self._banks = []
     self._bank_index = 0
     self._parameter_controls = None
     self._empty_control_slots = self.register_disconnectable(EventObject())
     self._device_bank_registry = device_bank_registry
     self._device_provider = device_provider
     self._device_name_slot = self.register_slot(
         None, self._update_device_name_display, u'name')
     self.__on_provided_device_changed.subject = device_provider
     self.__on_provided_device_changed()
     self._display_bank_name_task = self._tasks.add(
         task.sequence(task.run(self._display_bank_name),
                       task.wait(BANK_NAME_DISPLAY_DURATION),
                       task.run(self._update_device_name_display)))
     self._display_bank_name_task.kill()
     if toggle_lock:
         self.__on_is_locked_to_device_changed.subject = self._device_provider
         self.__on_is_locked_to_device_changed()
 def __init__(self,
              led_brightness_element=None,
              display_brightness_element=None,
              settings=None,
              *a,
              **k):
     assert led_brightness_element is not None
     assert display_brightness_element is not None
     assert settings is not None
     super(HardwareSettingsComponent, self).__init__(*a, **k)
     self._settings = settings
     self._led_brightness_element = led_brightness_element
     self._display_brightness_element = display_brightness_element
     self._led_brightness_timer = Live.Base.Timer(
         callback=self._on_fade_in_led_brightness_timer,
         interval=LED_FADE_IN_FREQUENCY,
         repeat=True)
     self._target_led_brightness = 0
     self._led_brightness = 0
     self._fade_in_delay_task = self._tasks.add(
         task.sequence(task.wait(LED_FADE_IN_DELAY),
                       task.run(
                           self._led_brightness_timer.restart))).kill()
     self.__on_led_brightness_changed.subject = settings
     self.__on_display_brightness_changed.subject = settings
     return
Beispiel #13
0
 def __init__(self,
              curve_sysex_element=None,
              threshold_sysex_element=None,
              settings=None,
              chunk_size=None,
              *a,
              **k):
     assert curve_sysex_element is not None
     assert threshold_sysex_element is not None
     assert settings is not None
     assert chunk_size is not None
     super(PadVelocityCurveSender, self).__init__(*a, **k)
     self._curve_sysex_element = curve_sysex_element
     self._threshold_sysex_element = threshold_sysex_element
     self._settings = settings
     self._chunk_size = chunk_size
     self._send_task = self._tasks.add(
         task.sequence(task.wait(self.SEND_RATE),
                       task.run(self._on_send_task_finished))).kill()
     self._settings_changed = False
     self.register_slot(settings, self._on_setting_changed, u'sensitivity')
     self.register_slot(settings, self._on_setting_changed, u'gain')
     self.register_slot(settings, self._on_setting_changed, u'dynamics')
     self._update_curve_model()
     return
Beispiel #14
0
 def _create_tasks(self, notification_time):
     duration = notification_time if notification_time is not None else self._default_notification_time
     self._notification_timeout_task = self._tasks.add(
         task.sequence(task.wait(duration), task.run(self.hide_notification)
                       )).kill() if duration != -1 else self._tasks.add(
                           task.Task())
     return
 def _display_message_on_maschine(self, track_type):
     self._tasks.clear()
     self._info_display.clear_display(3)
     message = 'Created New {} Track'.format(track_type)
     display_task = partial(self._info_display.display_message_on_maschine, message, 3)
     clear_display = partial(self._info_display.clear_display, 3)
     self._tasks.add(task.sequence(task.run(display_task), task.wait(1), task.run(clear_display)))
 def __init__(self, clip_creator = None, measure_length = 4.0, follow_detail_clip = False, paginator = None, *a, **k):
     super(LoopSelectorComponent, self).__init__(*a, **k)
     self._clip_creator = clip_creator
     self._sequencer_clip = None
     self._paginator = Paginator()
     self._loop_start = 0
     self._loop_end = 0
     self._loop_length = 0
     self._is_following = False
     self._follow_button = None
     self._select_button = None
     self._short_loop_selector_matrix = None
     self._loop_selector_matrix = None
     self._pressed_pages = []
     self._page_colors = []
     self._measure_length = measure_length
     self._last_playhead_page = -1
     self._follow_task = self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(partial(self._set_is_following, True))))
     self._follow_task.kill()
     if follow_detail_clip:
         self._on_detail_clip_changed.subject = self.song.view
     self._on_session_record_changed.subject = self.song
     self._on_song_playback_status_changed.subject = self.song
     if paginator is not None:
         self.set_paginator(paginator)
Beispiel #17
0
    def __init__(self, clip_creator = None, measure_length = 4.0, follow_detail_clip = False, paginator = None, default_size = None, *a, **k):
        super(LoopSelectorComponent, self).__init__(*a, **k)
        assert default_size is not None
        self._clip_creator = clip_creator
        self._sequencer_clip = None
        self._paginator = Paginator()
        self._loop_start = 0
        self._loop_end = 0
        self._loop_length = 0
        self._default_size = default_size
        self._pressed_pages = []
        self._page_colors = []
        self._measure_length = measure_length
        self._last_playhead_page = -1

        def set_is_following_true():
            self.is_following = True

        self._follow_task = self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(set_is_following_true)))
        self._follow_task.kill()
        self.set_step_duplicator(None)
        self._notification_reference = partial(nop, None)
        self.is_deleting = False
        if follow_detail_clip:
            self._on_detail_clip_changed.subject = self.song.view
            self._on_detail_clip_changed()
        self._on_session_record_changed.subject = self.song
        self._on_song_playback_status_changed.subject = self.song
        if paginator is not None:
            self.set_paginator(paginator)
        return
Beispiel #18
0
 def _hide_focus_task(self):
     tasks = self._tasks
     if tasks is not None:
         return tasks.add(
             task.sequence(task.wait(EncoderControl.TOUCH_TIME),
                           task.run(self.try_hide_focus)))
     return
 def __init__(self, note_settings_component = None, automation_component = None, initial_encoder_layer = None, encoder_layer = None, *a, **k):
     super(NoteEditorSettingsComponent, self).__init__(*a, **k)
     assert encoder_layer
     self.settings = self.register_component(note_settings_component)
     self.settings.set_enabled(False)
     self._automation = self.register_component(automation_component)
     self._automation.set_enabled(False)
     self._mode_selector = self.register_component(ModeSelector(is_enabled=False))
     self._visible_detail_view = u'Detail/DeviceChain'
     self._show_settings_task = self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(self._show_settings))).kill()
     self._update_infos_task = self._tasks.add(task.run(self._update_note_infos)).kill()
     self._settings_modes = self.register_component(ModesComponent())
     self._settings_modes.set_enabled(False)
     self._settings_modes.add_mode(u'automation', [self._automation,
      self._mode_selector,
      partial(self._set_envelope_view_visible, True),
      partial(show_clip_view, self.application)])
     self._settings_modes.add_mode(u'note_settings', [self.settings,
      self._update_note_infos,
      self._mode_selector,
      partial(self._set_envelope_view_visible, False),
      partial(show_clip_view, self.application)])
     self._settings_modes.selected_mode = u'note_settings'
     self.__on_selected_setting_mode_changed.subject = self._settings_modes
     self.add_mode(u'disabled', [])
     self.add_mode(u'about_to_show', [AddLayerMode(self, initial_encoder_layer), (self._show_settings_task.restart, self._show_settings_task.kill)])
     self.add_mode(u'enabled', [DetailViewRestorerMode(self.application), AddLayerMode(self, encoder_layer), self._settings_modes])
     self.selected_mode = u'disabled'
     self._editors = []
     self._on_detail_clip_changed.subject = self.song.view
     self._on_selected_track_changed.subject = self.song.view
     self.__on_full_velocity_changed.subject = self.settings
     self.__on_setting_changed.subject = self.settings
Beispiel #20
0
 def __init__(self,
              note_settings_component=None,
              automation_component=None,
              initial_encoder_layer=None,
              encoder_layer=None,
              *a,
              **k):
     super(NoteEditorSettingsComponent, self).__init__(*a, **k)
     raise encoder_layer or AssertionError
     self._request_hide = False
     self.settings = self.register_component(note_settings_component)
     self.settings.set_enabled(False)
     self._automation = self.register_component(automation_component)
     self._automation.set_enabled(False)
     self._mode_selector = self.register_component(
         OptionsComponent(num_options=2,
                          num_labels=0,
                          num_display_segments=8))
     self._mode_selector.set_enabled(False)
     self._on_selected_option.subject = self._mode_selector
     self._update_available_modes()
     self._mode_selector.selected_option = 0
     self._visible_detail_view = 'Detail/DeviceChain'
     self._show_settings_task = self._tasks.add(
         task.sequence(task.wait(defaults.MOMENTARY_DELAY),
                       task.run(self._show_settings))).kill()
     self._update_infos_task = self._tasks.add(
         task.run(self._update_note_infos)).kill()
     self._settings_modes = self.register_component(ModesComponent())
     self._settings_modes.set_enabled(False)
     self._settings_modes.add_mode('automation', [
         self._automation, self._mode_selector,
         partial(self._set_envelope_view_visible, True),
         self._show_clip_view
     ])
     self._settings_modes.add_mode('note_settings', [
         self.settings, self._update_note_infos, self._mode_selector,
         partial(self._set_envelope_view_visible, False),
         self._show_clip_view
     ])
     self._encoders = None
     self._initial_encoders = None
     self.add_mode('disabled', [])
     self.add_mode('about_to_show', [
         AddLayerMode(self, initial_encoder_layer),
         (self._show_settings_task.restart, self._show_settings_task.kill)
     ])
     self.add_mode('enabled', [
         DetailViewRestorerMode(self.application),
         AddLayerMode(self, encoder_layer), self._update_available_modes,
         self._settings_modes
     ])
     self.selected_mode = 'disabled'
     self._editors = []
     self._on_detail_clip_changed.subject = self.song.view
     self._on_selected_track_changed.subject = self.song.view
     self.__on_full_velocity_changed.subject = self.settings
     self.__on_setting_changed.subject = self.settings
     return
Beispiel #21
0
 def _display_message_on_maschine(self, enabled):
     message = 'Note Repeate is {}'.format('Off' if enabled else 'Active')
     display_task = partial(self._info_display.display_message_on_maschine,
                            message, 3)
     clear_task = partial(self._info_display.clear_display, 3)
     self._tasks.add(
         task.sequence(task.run(display_task), task.wait(2.5),
                       task.run(clear_task)))
Beispiel #22
0
 def _on_scroll(self):
     if self._trigger_action_on_scrolling:
         trigger_selected = partial(self._trigger_action,
                                    self.selected_item)
         self._action_on_scroll_task.kill()
         self._action_on_scroll_task = self._tasks.add(
             task.sequence(task.wait(defaults.MOMENTARY_DELAY),
                           task.delay(1), task.run(trigger_selected)))
 def __init__(self, *a, **k):
     (super(PrintToClipComponent, self).__init__)(*a, **k)
     self._clip_data = {}
     self._last_packet_id = -1
     self._reset_last_packet_id_task = self._tasks.add(task.sequence(task.wait(RESET_PACKET_ID_TASK_DELAY), task.run(self._reset_last_packet_id)))
     self._reset_last_packet_id_task.kill()
     self._PrintToClipComponent__on_selected_track_changed.subject = self.song.view
     self._PrintToClipComponent__on_selected_track_changed()
    def start(self):
        raise self.state == 'welcome' or AssertionError
        self.set_enabled(True)

        def set_state():
            self.state = 'start'

        self._tasks.add(task.sequence(task.wait(WELCOME_STATE_TIME), task.run(set_state)))
 def _remove_changed_object_delayed(self, identifier):
     tasks = self._tasks
     if tasks is not None:
         tasks.add(
             task.sequence(
                 task.wait(self.CHANGE_OBJECT_TIME),
                 task.run(partial(self._remove_changed_object,
                                  identifier))))
Beispiel #26
0
 def __init__(self, show_notification=None, *a, **k):
     assert show_notification is not None
     self._show_notification = show_notification
     super(DeviceComponent, self).__init__(*a, **k)
     self._show_on_scroll_task = self._tasks.add(
         task.sequence(task.wait(0.1),
                       task.run(self.show_device_name_and_bank)))
     return
Beispiel #27
0
 def _display_message_on_maschine(self, view):
     self._tasks.clear()
     message = 'In {} View'.format(view)
     display_task = partial(self._info_display.display_message_on_maschine,
                            message, 3)
     clear_task = partial(self._info_display.clear_display, 3)
     self._tasks.add(
         task.sequence(task.run(display_task), task.wait(1.5),
                       task.run(clear_task)))
    def start(self):
        raise self.state == 'welcome' or AssertionError
        self.set_enabled(True)

        def set_state():
            self.state = 'start'

        self._tasks.add(
            task.sequence(task.wait(WELCOME_STATE_TIME), task.run(set_state)))
 def __init__(self, identity_control = None, presentation_control = None, dongle_control = None, dongle = (0, 0), *a, **k):
     super(HandshakeComponent, self).__init__(*a, **k)
     self._identity_control = identity_control
     self._presentation_control = presentation_control
     self._dongle_control = dongle_control
     self._dongle_one, self._dongle_two = dongle
     self._on_identity_value.subject = identity_control
     self._on_dongle_value.subject = dongle_control
     self._identification_timeout_task = self._tasks.add(task.sequence(task.wait(HANDSHAKE_TIMEOUT), task.run(self._do_fail)))
     self._identification_timeout_task.kill()
 def _init_handshake(self):
     dongle_message, dongle = make_dongle_message(sysex.DONGLE_ENQUIRY_PREFIX)
     identity_control = create_sysex_element(sysex.IDENTITY_PREFIX, sysex.IDENTITY_ENQUIRY)
     dongle_control = create_sysex_element(sysex.DONGLE_PREFIX, dongle_message)
     presentation_control = create_sysex_element(sysex.DONGLE_PREFIX, sysex.make_presentation_message(self.application()))
     self._handshake = HandshakeComponent(identity_control=identity_control, dongle_control=dongle_control, presentation_control=presentation_control, dongle=dongle, is_root=True)
     self._on_handshake_success.subject = self._handshake
     self._on_handshake_failure.subject = self._handshake
     self._start_handshake_task = self._tasks.add(task.sequence(task.wait(HANDSHAKE_DELAY), task.run(self._start_handshake)))
     self._start_handshake_task.kill()
Beispiel #31
0
 def __init__(self, router = None, parent_task_group = None, *a, **k):
     assert router is not None
     super(RoutingTargetList, self).__init__(*a, **k)
     self._router = router
     self._targets = []
     self._selected_target = None
     self._apply_selection_task = parent_task_group.add(task.sequence(task.wait(self.APPLY_SELECTION_DELAY), task.run(self._apply_selected_target)))
     self.__on_current_target_index_changed.subject = router
     self.__on_routing_targets_changed.subject = router
     self._update_targets()
     self._update_selected_target()
 def on_process_state_changed(self, state):
     StateEnum = MidiRemoteScript.Push2ProcessState
     self._connected = state == StateEnum.connected
     if state == StateEnum.died:
         self._c_instance.launch_external_process()
     elif state == StateEnum.connected:
         with self.component_guard():
             self._try_initialize()
         self._model.commit_changes(send_all=True)
     elif state in (StateEnum.defunct_process_terminated, StateEnum.defunct_process_killed):
         self._tasks.add(task.sequence(task.wait(self.DEFUNCT_EXTERNAL_PROCESS_RELAUNCH_TIMEOUT), task.run(self._c_instance.launch_external_process)))
Beispiel #33
0
 def __init__(self, router = None, parent_task_group = None, *a, **k):
     raise router is not None or AssertionError
     super(RoutingTargetList, self).__init__(*a, **k)
     self._router = router
     self._targets = []
     self._selected_target = None
     self._apply_selection_task = parent_task_group.add(task.sequence(task.wait(self.APPLY_SELECTION_DELAY), task.run(self._apply_selected_target)))
     self.__on_current_target_index_changed.subject = router
     self.__on_routing_targets_changed.subject = router
     self._update_targets()
     self._update_selected_target()
Beispiel #34
0
 def __init__(self, *a, **k):
     super(UndoComponent, self).__init__(*a, **k)
     self._light_undo_button_task = self._tasks.add(
         task.sequence(
             task.run(
                 partial(self._set_undo_button_light, 'DefaultButton.On')),
             task.wait(1.0),
             task.run(
                 partial(self._set_undo_button_light,
                         'DefaultButton.Off'))))
     self._light_undo_button_task.kill()
 def __init__(self, all_pads = tuple(), parameter_sender = nop, default_profile = None, update_delay = 0, *a, **k):
     assert find_if(lambda pad: pad < 0 or pad > 63, all_pads or []) == None
     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 = {u'default': default_profile}
     self._profile_for = dict(list(zip(all_pads, repeat(u'default'))))
     self._profile_count = {u'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 _create_new_return_track(self):
     if len(self.song.return_tracks) < 12:
         self.song.create_return_track()
         self._display_message_on_maschine('return')
     else:
         self._info_display.clear_display(3)
         self._tasks.clear()
         message = 'Only 12 sends allowed'
         display_task = partial(self._info_display.display_message_on_maschine, message, 3)
         clear_display = partial(self._info_display.clear_display, 3)
         self._tasks.add(task.sequence(task.run(display_task), task.wait(1), task.run(clear_display)))
 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()
Beispiel #38
0
	def __init__(self, *a, **k):
		super(MonoChannelStripComponent, self).__init__(*a, **k)
		self._device_provider = ChannelStripStaticDeviceProvider()
		self._device_component = ChaanelStripDeviceComponent(device_provider = self._device_provider, device_bank_registry = DeviceBankRegistry(), *a, **k)
		self._device_component._show_msg_callback = lambda message: None
		self._track_state = self.register_disconnectable(TrackArmState())
		self._fold_task = self._tasks.add(Task.sequence(Task.wait(TRACK_FOLD_DELAY), Task.run(self._do_fold_track))).kill()
		self._on_arm_state_changed.subject = self._track_state
		self._ChannelStripComponent__on_selected_track_changed.subject = None
		self._ChannelStripComponent__on_selected_track_changed = self.__on_selected_track_changed
		self.__on_selected_track_changed.subject = self.song.view
		self.__on_selected_track_changed()
Beispiel #39
0
    def start(self, firmware):
        raise firmware is not None or AssertionError
        raise self.state == 'welcome' or AssertionError
        logger.info('Start firmware update using %r', firmware.filename)
        self._firmware = firmware
        self.notify_firmware_file()
        self.set_enabled(True)

        def set_state():
            self.state = 'start'

        self._tasks.add(task.sequence(task.wait(WELCOME_STATE_TIME), task.run(set_state)))
 def __init__(self, *a, **k):
     super(SpecialChanStripComponent, self).__init__(*a, **k)
     self.empty_color = 'Option.Unused'
     self._invert_mute_feedback = True
     self._duplicate_button = None
     self._selector_button = None
     self._delete_handler = None
     self._track_parameter_name_sources = [ DisplayDataSource(' ') for _ in xrange(14) ]
     self._track_parameter_data_sources = [ DisplayDataSource(' ') for _ in xrange(14) ]
     self._track_parameter_graphic_sources = [ DisplayDataSource(' ') for _ in xrange(14) ]
     self._on_return_tracks_changed.subject = self.song
     self._on_selected_track_changed.subject = self.song.view
     self._fold_task = self._tasks.add(task.sequence(task.wait(TRACK_FOLD_DELAY), task.run(self._do_fold_track))).kill()
     self._cue_volume_slot = self.register_disconnectable(ParameterSlot())
 def __init__(self, led_brightness_element = None, display_brightness_element = None, settings = None, *a, **k):
     raise led_brightness_element is not None or AssertionError
     raise display_brightness_element is not None or AssertionError
     raise settings is not None or AssertionError
     super(HardwareSettingsComponent, self).__init__(*a, **k)
     self._settings = settings
     self._led_brightness_element = led_brightness_element
     self._display_brightness_element = display_brightness_element
     self._led_brightness_timer = Live.Base.Timer(callback=self._on_fade_in_led_brightness_timer, interval=LED_FADE_IN_FREQUENCY, repeat=True)
     self._target_led_brightness = 0
     self._led_brightness = 0
     self._fade_in_delay_task = self._tasks.add(task.sequence(task.wait(LED_FADE_IN_DELAY), task.run(self._led_brightness_timer.restart))).kill()
     self.__on_led_brightness_changed.subject = settings
     self.__on_display_brightness_changed.subject = settings
 def _on_selected_item_changed(self):
     self._scroller.update()
     self._pager.update()
     self._update_display()
     self._update_action_feedback()
     self._activation_task.kill()
     self._action_on_scroll_task.kill()
     if self.SELECTION_DELAY and self._delay_activation:
         self._activation_task = self._tasks.add(task.sequence(task.wait(self.SELECTION_DELAY), task.run(self._scrollable_list.request_notify_item_activated)))
     else:
         self._scrollable_list.request_notify_item_activated()
     if not self._in_encoder_selection:
         self._selected_index_float = float(self._scrollable_list.selected_item_index)
     self.notify_selected_item(self._scrollable_list.selected_item)
 def __init__(self, solo_layer = None, mute_layer = None, *a, **k):
     super(MixerComponent, self).__init__(*a, **k)
     self._allow_released_immediately_action = True
     self.mixer_button_state = self.register_disconnectable(MixerButtonStateManager())
     self._mixer_button_state_task = self._tasks.add(task.sequence(task.wait(self.MIXER_BUTTON_STATE_DELAY), task.run(self._update_mixer_button_state))).kill()
     self.add_mode('default', None)
     self.add_mode('solo', AddLayerMode(self, solo_layer))
     self.add_mode('mute', AddLayerMode(self, mute_layer))
     self.selected_mode = 'default'
     self._on_items_changed.subject = self._provider
     self._on_selected_item_changed.subject = self._provider
     self._on_selected_item_changed()
     self._update_channel_strip_button_colors()
     self.__on_channel_strip_mute_or_solo_changed.replace_subjects(self._channel_strips)
     return
 def __init__(self, curve_sysex_element = None, threshold_sysex_element = None, settings = None, chunk_size = None, *a, **k):
     raise curve_sysex_element is not None or AssertionError
     raise threshold_sysex_element is not None or AssertionError
     raise settings is not None or AssertionError
     raise chunk_size is not None or AssertionError
     super(PadVelocityCurveSender, self).__init__(*a, **k)
     self._curve_sysex_element = curve_sysex_element
     self._threshold_sysex_element = threshold_sysex_element
     self._settings = settings
     self._chunk_size = chunk_size
     self._send_task = self._tasks.add(task.sequence(task.wait(self.SEND_RATE), task.run(self._on_send_task_finished))).kill()
     self._settings_changed = False
     self.register_slot(settings, self._on_setting_changed, 'sensitivity')
     self.register_slot(settings, self._on_setting_changed, 'gain')
     self.register_slot(settings, self._on_setting_changed, 'dynamics')
     self._update_curve_model()
 def __init__(self, note_settings_component = None, automation_component = None, initial_encoder_layer = None, encoder_layer = None, *a, **k):
     super(NoteEditorSettingsComponent, self).__init__(*a, **k)
     raise encoder_layer or AssertionError
     self._request_hide = False
     self.settings = self.register_component(note_settings_component)
     self.settings.set_enabled(False)
     self._automation = self.register_component(automation_component)
     self._automation.set_enabled(False)
     self._mode_selector = self.register_component(OptionsComponent(num_options=2, num_labels=0, num_display_segments=8))
     self._mode_selector.set_enabled(False)
     self._on_selected_option.subject = self._mode_selector
     self._update_available_modes()
     self._mode_selector.selected_option = 0
     self._visible_detail_view = 'Detail/DeviceChain'
     self._show_settings_task = self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(self._show_settings))).kill()
     self._update_infos_task = self._tasks.add(task.run(self._update_note_infos)).kill()
     self._settings_modes = self.register_component(ModesComponent())
     self._settings_modes.set_enabled(False)
     self._settings_modes.add_mode('automation', [self._automation,
      self._mode_selector,
      partial(self._set_envelope_view_visible, True),
      self._show_clip_view])
     self._settings_modes.add_mode('note_settings', [self.settings,
      self._update_note_infos,
      self._mode_selector,
      partial(self._set_envelope_view_visible, False),
      self._show_clip_view])
     self._encoders = None
     self._initial_encoders = None
     self.add_mode('disabled', [])
     self.add_mode('about_to_show', [AddLayerMode(self, initial_encoder_layer), (self._show_settings_task.restart, self._show_settings_task.kill)])
     self.add_mode('enabled', [DetailViewRestorerMode(self.application),
      AddLayerMode(self, encoder_layer),
      self._update_available_modes,
      self._settings_modes])
     self.selected_mode = 'disabled'
     self._editors = []
     self._on_detail_clip_changed.subject = self.song.view
     self._on_selected_track_changed.subject = self.song.view
     self.__on_full_velocity_changed.subject = self.settings
     self.__on_setting_changed.subject = self.settings
 def __init__(
     self,
     value_dict=[False, True],
     parent_task_group=None,
     number_channels=16,
     default_value_index=0,
     default_channel=0,
     channel_list=CHANNELS,
     *a,
     **k
 ):
     self._value_dict = value_dict
     self._range = len(value_dict)
     self._number_channels = number_channels
     self._channel = default_channel
     self._values = [default_value_index for x in range(number_channels)]
     self._channel_list = channel_list
     self._parent_task_group = parent_task_group
     super(ChannelizedSettingsBase, self).__init__(*a, **k)
     self._on_selected_track_changed.subject = self.song.view
     self._update_task = parent_task_group.add(task.sequence(task.wait(0.01), task.run(self.update)))
     self._update_task.kill()
 def action_button(self, button):
     self._settings_task.kill()
     self._settings_task = self._tasks.add(task.sequence(task.wait(self.SETTINGS_DELAY), task.run(self._do_show_settings)))
     self.trigger_action()
 def _remove_changed_object_delayed(self, identifier):
     tasks = self._tasks
     if tasks is not None:
         tasks.add(task.sequence(task.wait(self.CHANGE_OBJECT_TIME), task.run(partial(self._remove_changed_object, identifier))))
	def __init__(self, *a, **k):
		super(MonoStepSeqComponent, self).__init__(*a, **k)
		self._update_delay_task = self._tasks.add(task.sequence(task.wait(.1), task.run(self._update_delayed)))
		self._update_delay_task.kill()
 def _create_tasks(self, notification_time):
     duration = notification_time if notification_time is not None else self._default_notification_time
     self._notification_timeout_task = self._tasks.add(task.sequence(task.wait(duration), task.run(self.hide_notification))).kill() if duration != -1 else self._tasks.add(task.Task())
 def __init__(self, default_notification_time = 2.5, blinking_time = 0.3, display_lines = [], *a, **k):
     super(NotificationComponent, self).__init__(*a, **k)
     self._display_lines = get_element(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._default_notification_time = default_notification_time
     self._blinking_time = blinking_time
     self._original_text = None
     self._blink_text = None
     self._blink_text_task = self._tasks.add(task.loop(task.sequence(task.run(lambda : self._message_box.__setattr__('text', self._original_text)), task.wait(self._blinking_time), task.run(lambda : self._message_box.__setattr__('text', self._blink_text)), task.wait(self._blinking_time)))).kill()
 def trigger_modification_task(x, y):
     trigger = partial(self._trigger_modification, (x, y), done=True)
     return self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.run(trigger))).kill()
 def _create_notification_timeout_task(self, duration):
     self._notification_timeout_task = self._tasks.add(
         task.sequence(task.wait(duration), task.run(self.hide_notification))
     )
 def _on_scroll(self):
     if self._trigger_action_on_scrolling:
         trigger_selected = partial(self._trigger_action, self.selected_item)
         self._action_on_scroll_task.kill()
         self._action_on_scroll_task = self._tasks.add(task.sequence(task.wait(defaults.MOMENTARY_DELAY), task.delay(1), task.run(trigger_selected)))
 def _disabled_encoders(self):
     self._disable_all_encoders()
     yield
     self._tasks.add(task.sequence(task.wait(self.MOVE_DELAY), task.run(self._enable_all_encoders)))
 def _hide_focus_task(self):
     tasks = self._tasks
     if tasks is not None:
         return tasks.add(task.sequence(task.wait(EncoderControl.TOUCH_TIME), task.run(self.try_hide_focus)))