本文整理汇总了Python中_Framework.DisplayDataSource.DisplayDataSource类的典型用法代码示例。如果您正苦于以下问题:Python DisplayDataSource类的具体用法?Python DisplayDataSource怎么用?Python DisplayDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DisplayDataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NoteSetting
class NoteSetting(SlotManager, Subject):
__subject_events__ = ('setting_changed',)
attribute_index = -1
def __init__(self, grid_resolution = None, *a, **k):
super(NoteSetting, self).__init__(*a, **k)
self._encoder = None
self._grid_resolution = grid_resolution
self.value_source = DisplayDataSource()
self.label_source = DisplayDataSource()
self.label_source.set_display_string(self.get_label())
def get_label(self):
raise NotImplementedError
def encoder_value_to_attribute(self, value):
raise NotImplementedError
def attribute_min_max_to_string(self, min_value, max_value):
raise NotImplementedError
@property
def step_length(self):
return self._grid_resolution.step_length if self._grid_resolution else 1.0
def set_encoder(self, encoder):
self._encoder = encoder
self._on_value.subject = encoder
def set_min_max(self, min_max_value):
self.value_source.set_display_string(self.attribute_min_max_to_string(min_max_value[0], min_max_value[1]) if min_max_value else '-')
@subject_slot('normalized_value')
def _on_value(self, value):
self.notify_setting_changed(self.attribute_index, self.encoder_value_to_attribute(value))
示例2: __init__
def __init__(self, grid_resolution = None, *a, **k):
super(NoteSetting, self).__init__(*a, **k)
self._encoder = None
self._grid_resolution = grid_resolution
self.value_source = DisplayDataSource()
self.label_source = DisplayDataSource()
self.label_source.set_display_string(self.get_label())
示例3: _setup_displays
def _setup_displays(self):
self._name_display = PhysicalDisplayElement(12, 1)
self._name_display.name = "Name_Display"
self._name_display.set_message_parts(SYSEX_START + (21,), (0, 247))
self._name_display.set_clear_all_message(CLEAR_NAME)
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
self._value_display = NumericalDisplayElement(3, 1)
self._value_display.name = "Value_Display"
self._value_display.set_message_parts(SYSEX_START + (20, 48), (0, 247))
self._value_display.set_clear_all_message(CLEAR_VALUE)
self._value_display_data_source = DisplayDataSource()
self._value_display.segment(0).set_data_source(self._value_display_data_source)
self._bank_display = NumericalDisplayElement(3, 1)
self._bank_display.name = "Bank_Display"
self._bank_display.set_message_parts(SYSEX_START + (19,), (0, 247))
self._bank_display.set_clear_all_message(CLEAR_BANK)
self._bank_display_data_source = DisplayDataSource()
self._bank_display.segment(0).set_data_source(self._bank_display_data_source)
self._pad_display = NumericalDisplayElement(2, 1)
self._pad_display.name = "Pad_Display"
self._pad_display.set_message_parts(SYSEX_START + (18,), (0, 247))
self._pad_display.set_clear_all_message(CLEAR_PAD)
self._pad_display_data_source = DisplayDataSource()
self._pad_display.segment(0).set_data_source(self._pad_display_data_source)
示例4: __init__
def __init__(self, display_label = ' ', display_seg_start = 0, *a, **k):
super(ValueDisplayComponentBase, self).__init__(*a, **k)
self._label_data_source = DisplayDataSource(display_label)
self._value_data_source = DisplayDataSource()
self._graphic_data_source = DisplayDataSource()
self._display_label = display_label
self._display_seg_start = display_seg_start
示例5: __init__
def __init__(self, mixer_modes, device, encoders, page_buttons):
raise isinstance(mixer_modes, EncoderMixerModeSelector) or AssertionError
raise isinstance(device, PageableDeviceComponent) or AssertionError
raise isinstance(encoders, tuple) or AssertionError
raise isinstance(page_buttons, tuple) or AssertionError
ModeSelectorComponent.__init__(self)
self._mixer_modes = mixer_modes
self._device = device
self._encoders = encoders
self._page_buttons = page_buttons
self._peek_button = None
self._encoders_display = None
self._value_display = None
self._device_display = None
self._page_displays = None
self._device_dummy_source = DisplayDataSource()
self._parameter_source = DisplayDataSource()
self._device_dummy_source.set_display_string('Mixer')
self._clean_value_display_in = -1
self._must_update_encoder_display = False
self._register_timer_callback(self._on_timer)
identify_sender = True
for encoder in self._encoders:
encoder.add_value_listener(self._parameter_value, identify_sender)
self.set_mode(0)
return
示例6: UserSettingsComponent
class UserSettingsComponent(ControlSurfaceComponent):
""" Component for changing a list of settings """
def __init__(self, *a, **k):
super(UserSettingsComponent, self).__init__(*a, **k)
self._name_sources = [ DisplayDataSource() for _ in xrange(4) ]
self._value_sources = [ DisplayDataSource() for _ in xrange(4) ]
self._info_source = DisplayDataSource()
self._settings = []
self._encoders = []
def set_display_line1(self, display):
if display:
display.set_data_sources(self._value_sources)
def set_display_line2(self, display):
if display:
display.set_data_sources(self._name_sources)
def set_display_line3(self, display):
if display:
display.reset()
def set_display_line4(self, display):
if display:
display.set_data_sources([self._info_source])
def set_encoders(self, encoders):
self._encoders = encoders or []
self._on_encoder_value.replace_subjects(self._encoders[::2], count())
def _set_settings(self, settings):
self._settings = settings.values()
self._update_display()
def _get_settings(self):
return self._settings
settings = property(_get_settings, _set_settings)
def set_info_text(self, info_text):
self._info_source.set_display_string(info_text)
@subject_slot_group('normalized_value')
def _on_encoder_value(self, value, index):
if index >= 0 and index < len(self._settings) and self._settings[index].change_relative(value):
self._update_display()
def _update_display(self):
for index, setting in enumerate(self._settings):
self._name_sources[index].set_display_string(setting.name)
self._value_sources[index].set_display_string(str(setting))
def update(self):
super(UserSettingsComponent, self).update()
if self.is_enabled():
self._update_display()
示例7: ValueDisplayComponentBase
class ValueDisplayComponentBase(ControlSurfaceComponent):
def __init__(self, display_label = ' ', display_seg_start = 0, *a, **k):
super(ValueDisplayComponentBase, self).__init__(*a, **k)
self._label_data_source = DisplayDataSource(display_label)
self._value_data_source = DisplayDataSource()
self._graphic_data_source = DisplayDataSource()
self._display_label = display_label
self._display_seg_start = display_seg_start
def get_value_string(self):
raise NotImplementedError
def get_graphic_string(self):
raise NotImplementedError
def set_label_display(self, display):
self._set_display(display, self._label_data_source)
def set_value_display(self, display):
self._set_display(display, self._value_data_source)
def set_graphic_display(self, display):
self._set_display(display, self._graphic_data_source)
def set_clear_display1(self, display):
self._clear_display(display)
def set_clear_display2(self, display):
self._clear_display(display)
def set_clear_display3(self, display):
self._clear_display(display)
def set_clear_display4(self, display):
self._clear_display(display)
def _set_display(self, display, source):
if display:
display.set_data_sources((None,) * NUM_SEGMENTS)
display.segment(self._display_seg_start).set_data_source(source)
return None
def _clear_display(self, display):
if display:
display.set_data_sources((None,))
display.reset()
return None
def update(self):
super(ValueDisplayComponentBase, self).update()
if self.is_enabled():
self._value_data_source.set_display_string(self.get_value_string())
self._graphic_data_source.set_display_string(self.get_graphic_string())
示例8: InfoComponent
class InfoComponent(BackgroundComponent):
"""
Component that will show an info text and grab all components that should be unusable.
"""
def __init__(self, info_text = '', *a, **k):
super(InfoComponent, self).__init__(*a, **k)
self._data_source = DisplayDataSource()
self._data_source.set_display_string(info_text)
def set_display(self, display):
if display:
display.set_data_sources([self._data_source])
示例9: __init__
def __init__(self, *a, **k):
super(UserSettingsComponent, self).__init__(*a, **k)
self._name_sources = [ DisplayDataSource() for _ in xrange(4) ]
self._value_sources = [ DisplayDataSource() for _ in xrange(4) ]
self._info_source = DisplayDataSource()
self._settings = []
self._encoders = []
示例10: __init__
def __init__(self, mixer):
raise isinstance(mixer, NotifyingMixerComponent) or AssertionError
ModeSelectorComponent.__init__(self)
self._mixer = mixer
self._controls = None
self._page_names = ('Vol', 'Pan', 'SendA', 'SendB', 'SendC')
self._page_name_sources = None
self._current_page_data_source = DisplayDataSource()
self._parameter_sources = [ DisplayDataSource() for index in range(8) ]
self._show_volume_page = False
self._mixer.set_update_callback(self._mixer_assignments_changed)
示例11: __init__
def __init__(self):
DeviceComponent.__init__(self)
self._parameter_value_data_source = DisplayDataSource()
self._parameter_name_data_sources = []
self._page_name_data_sources = []
self._page_index = [0,
0,
0,
0]
for new_index in range(8):
self._parameter_name_data_sources.append(DisplayDataSource())
self._page_name_data_sources.append(DisplayDataSource())
self._parameter_name_data_sources[-1].set_display_string(' - ')
self._page_name_data_sources[-1].set_display_string(' - ')
示例12: _create_display
def _create_display(self):
self._display_line1, self._display_line2 = DisplayElement(16, 1), DisplayElement(16, 1)
for index, display_line in enumerate((self._display_line1, self._display_line2)):
display_line.set_message_parts(SETUP_MSG_PREFIX + (4, 0, 96), SETUP_MSG_SUFFIX)
display_line.segment(0).set_position_identifier((index + 1,))
def adjust_null_terminated_string(string, width):
return string.ljust(width, ' ') + '\x00'
self._display_line1_data_source, self._display_line2_data_source = DisplayDataSource(adjust_string_fn=adjust_null_terminated_string), DisplayDataSource(adjust_string_fn=adjust_null_terminated_string)
self._display_line1.segment(0).set_data_source(self._display_line1_data_source)
self._display_line2.segment(0).set_data_source(self._display_line2_data_source)
self._display_line1_data_source.set_display_string('KeyLab')
self._display_line2_data_source.set_display_string('Ableton Live')
示例13: __init__
def __init__(self, *a, **k):
super(BestBankDeviceComponent, self).__init__(*a, **k)
new_banks = {}
new_bank_names = {}
self._device_banks = DEVICE_DICT
self._device_bank_names = BANK_NAME_DICT
self._device_best_banks = DEVICE_BOB_DICT
for device_name, current_banks in self._device_banks.iteritems():
if len(current_banks) > 1:
raise device_name in self._device_best_banks.keys() or AssertionError("Could not find best-of-banks for '%s'" % device_name)
raise device_name in self._device_bank_names.keys() or AssertionError("Could not find bank names for '%s'" % device_name)
current_banks = self._device_best_banks[device_name] + current_banks
new_bank_names[device_name] = (BOP_BANK_NAME,) + self._device_bank_names[device_name]
new_banks[device_name] = current_banks
self._device_banks = new_banks
self._device_bank_names = new_bank_names
self._bank_name_data_source = DisplayDataSource()
示例14: __init__
def __init__(self):
DeviceComponent.__init__(self)
new_banks = {}
new_bank_names = {}
self._device_banks = DEVICE_DICT
self._device_bank_names = BANK_NAME_DICT
self._device_best_banks = DEVICE_BOB_DICT
for device_name, current_banks in self._device_banks.iteritems():
raise len(current_banks) > 1 and (device_name in self._device_best_banks.keys() or AssertionError), "Could not find best-of-banks for '%s'" % device_name
if not device_name in self._device_bank_names.keys():
raise AssertionError, "Could not find bank names for '%s'" % device_name
current_banks = self._device_best_banks[device_name] + current_banks
new_bank_names[device_name] = (BOP_BANK_NAME,) + self._device_bank_names[device_name]
new_banks[device_name] = current_banks
self._device_banks = new_banks
self._device_bank_names = new_bank_names
self._bank_name_data_source = DisplayDataSource()
示例15: EncoderMixerModeSelector
class EncoderMixerModeSelector(ModeSelectorComponent):
""" Class that reassigns encoders on the AxiomPro to different mixer functions """
def __init__(self, mixer):
raise isinstance(mixer, NotifyingMixerComponent) or AssertionError
ModeSelectorComponent.__init__(self)
self._mixer = mixer
self._controls = None
self._page_names = ("Vol", "Pan", "SendA", "SendB", "SendC")
self._page_name_sources = None
self._current_page_data_source = DisplayDataSource()
self._parameter_sources = [DisplayDataSource() for index in range(8)]
self._show_volume_page = False
self._mixer.set_update_callback(self._mixer_assignments_changed)
return
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._mixer = None
self._controls = None
self._page_names = None
self._page_name_sources = None
self._current_page_data_source = None
self._parameter_sources = None
ModeSelectorComponent.disconnect(self)
return
def set_modes_buttons(self, buttons):
raise buttons == None or isinstance(buttons, tuple) or len(buttons) == self.number_of_modes() or AssertionError
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._modes_buttons = []
if buttons != None:
for button in buttons:
raise isinstance(button, ButtonElement) or AssertionError
self._modes_buttons.append(button)
button.add_value_listener(self._mode_value, identify_sender)
self.set_mode(0)
self.update()
return
def set_controls(self, controls):
raise controls == None or isinstance(controls, tuple) and len(controls) == 8 or AssertionError
self._controls = controls
self.set_mode(0)
self.update()
return
def set_show_volume_page(self, show):
if not isinstance(show, type(False)):
raise AssertionError
if show != self._show_volume_page:
self._show_volume_page = show
if self._page_name_sources != None:
offset = 0
offset = self._show_volume_page or 1
for idx in range(4):
self._page_name_sources[idx].set_display_string(self._page_names[idx + offset])
self.update()
return
def page_name_data_source(self, index):
if not index in range(4):
raise AssertionError
if self._page_name_sources == None:
self._page_name_sources = []
offset = 0
offset = self._show_volume_page or 1
for idx in range(4):
self._page_name_sources.append(DisplayDataSource())
self._page_name_sources[idx].set_display_string(self._page_names[idx + offset])
return self._page_name_sources[index]
def parameter_data_source(self, index):
raise self._controls != None or AssertionError
raise index in range(len(self._controls)) or AssertionError
return self._mixer.channel_strip(index).track_name_data_source()
def current_page_data_source(self):
return self._current_page_data_source
def number_of_modes(self):
return 4
def update(self):
super(EncoderMixerModeSelector, self).update()
if not self._modes_buttons != None:
raise AssertionError
if self.is_enabled() and self._controls != None:
mode = self._mode_index
self._show_volume_page or mode += 1
self._current_page_data_source.set_display_string(self._page_names[mode])
for index in range(len(self._controls)):
#.........这里部分代码省略.........