def __init__(self, browser = None, *a, **k): super(BrowserComponent, self).__init__(*a, **k) self._browser = browser or self.application().browser self._browser_model = make_fallback_browser_model(self._browser) num_data_sources = self.NUM_COLUMNS * self.COLUMN_SIZE self._data_sources = map(DisplayDataSource, ('',) * num_data_sources) self._last_loaded_item = None self._default_item_formatter = DefaultItemFormatter() self._list_components = self.register_components(*[ ListComponent() for _ in xrange(self.NUM_COLUMNS) ]) for i, component in enumerate(self._list_components): component.do_trigger_action = lambda item: self._do_load_item(item) component.last_action_item = lambda : self._last_loaded_item component.item_formatter = partial(self._item_formatter, i) self._select_buttons = [] self._state_buttons = [] self._encoder_controls = [] self._on_list_item_action.replace_subjects(self._list_components) self._on_hotswap_target_changed.subject = self._browser self._on_filter_type_changed.subject = self._browser self._on_browser_full_refresh.subject = self._browser self._scroll_offset = 0 self._max_scroll_offset = 0 self._max_hierarchy = 0 self._last_filter_type = None self._skip_next_preselection = False self._browser_model_dirty = True self._on_content_lists_changed() return
def __init__(self, *a, **k): super(InstrumentScalesComponent, self).__init__(*a, **k) self._key_center_slots = self.register_slot_manager() self._key_center_buttons = [] self._encoder_touch_button_slots = self.register_slot_manager() self._encoder_touch_buttons = [] self._top_key_center_buttons = None self._bottom_key_center_buttons = None self._absolute_relative_button = None self._diatonic_chromatic_button = None table = consts.MUSICAL_MODES self._info_sources = map(DisplayDataSource, ('Scale selection:', '', '')) self._line_sources = recursive_map(DisplayDataSource, (('', '', '', '', '', '', ''), ('', '', '', '', '', '', ''))) self._modus_sources = map( partial(DisplayDataSource, adjust_string_fn=adjust_string_crop), ('', '', '', '')) self._presets = self.register_component(InstrumentPresetsComponent()) self._presets_enabler = self.register_component( EnablingModesComponent(component=self._presets, toggle_value='Scales.PresetsEnabled')) self._presets_enabler.momentary_toggle = True self._presets.selected_mode = 'scale_p4_vertical' self._modus_list = self.register_component( ListComponent(data_sources=self._modus_sources)) self._modus_list.scrollable_list.fixed_offset = 1 self._modus_list.scrollable_list.assign_items([ Modus(name=table[i], notes=table[i + 1]) for i in xrange(0, len(consts.MUSICAL_MODES), 2) ]) self._on_selected_modus.subject = self._modus_list.scrollable_list self._update_data_sources()