本文整理汇总了Python中SubSelectorComponent.set_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python SubSelectorComponent.set_enabled方法的具体用法?Python SubSelectorComponent.set_enabled怎么用?Python SubSelectorComponent.set_enabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubSelectorComponent
的用法示例。
在下文中一共展示了SubSelectorComponent.set_enabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
self._setup_mixer(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(as_active)
self._update_control_channels()
self._mode_index = 5
elif mode == "user 2":
self._setup_session(not as_active, not as_enabled)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(not as_active)
self._setup_mixer(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_user_mode(False, False, False, False)
self._update_control_channels()
self._mode_index = 2
self._osd.clear()
self._osd.mode = "User 2"
self._osd.update()
def _setup_session(self, as_active, as_enabled):
assert isinstance(as_active, type(False))
for button in self._nav_buttons:
if as_enabled:
button.set_on_off_values(self._skin.GREEN_FULL, self._skin.GREEN_THIRD)
else:
button.set_on_off_values(127, self._skin.off)
# matrix
self._activate_matrix(True)
for scene_index in range(self._session._num_scenes):
scene = self._session.scene(scene_index)
if as_active:
scene_button = self._side_buttons[scene_index]
scene_button.set_enabled(as_active)
scene_button.set_on_off_values(127, self._skin.off)
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(self._session._num_tracks):
if as_active:
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, self._skin.off)
button.set_enabled(as_active)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
if as_active:
if self._session._stop_clip_buttons != None:
for button in self._session._stop_clip_buttons:
button.set_enabled(as_active)
button.set_on_off_values(self._skin.session.track_stop, self._skin.off)
self._session.set_stop_track_clip_buttons(self._session._stop_clip_buttons)
self._side_buttons[self._session._num_scenes].set_enabled(as_active)
self._side_buttons[self._session._num_scenes].set_on_off_values(self._skin.session._stop_clip_buttons, self._skin.off)
self._session.set_stop_all_clips_button(self._side_buttons[self._session._num_scenes])
else:
self._session.set_stop_track_clip_buttons(None)
self._session.set_stop_all_clips_button(None)
else:
self._session.set_stop_track_clip_buttons(None)
self._session.set_stop_all_clips_button(None)
# zoom
if as_active:
示例2: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
self._zooming.set_button_matrix(self._matrix)
self._zooming.set_scene_bank_buttons(self._side_buttons)
self._zooming.set_nav_buttons(self._nav_buttons[0], self._nav_buttons[1], self._nav_buttons[2], self._nav_buttons[3])
self._zooming.update()
else:
self._zooming.set_zoom_button(None)
self._zooming.set_button_matrix(None)
self._zooming.set_scene_bank_buttons(None)
self._zooming.set_nav_buttons(None, None, None, None)
#nav buttons
if as_enabled:
self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
self._session.set_scene_bank_buttons(self._nav_buttons[1], self._nav_buttons[0])
else:
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
def _setup_instrument_controller(self, enabled):
if self._instrument_controller != None:
if enabled:
self._activate_matrix(False)
self._activate_scene_buttons(True)
self._activate_navigation_buttons(True)
else:
for scene_index in range(8):
scene_button = self._side_buttons[scene_index]
scene_button.use_default_message()
scene_button.force_next_send()
for track_index in range(8):
button = self._matrix.get_button(track_index, scene_index)
button.use_default_message()
button.force_next_send()
self._instrument_controller.set_enabled(enabled)
def _setup_device_controller(self, as_active):
if self._device_controller!=None:
if as_active:
self._activate_scene_buttons(True)
self._activate_matrix(True)
self._activate_navigation_buttons(True)
self._device_controller._is_active = True
self._config_button.send_value(32)
self._device_controller.set_enabled(True)
self._device_controller.update()
else:
self._device_controller._is_active = False
self._device_controller.set_enabled(False)
def _setup_user_mode(self, release_matrix=True, release_side_buttons=True, release_nav_buttons = True, drum_rack_mode = True):
for scene_index in range(8):
scene_button = self._side_buttons[scene_index]
scene_button.set_on_off_values(127, LED_OFF)
scene_button.force_next_send()
scene_button.turn_off()
scene_button.set_enabled((not release_side_buttons))
for track_index in range(8):
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.turn_off()
示例3: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
if self._mode_index == 0:
return 0
elif self._mode_index == 1:
if self._sub_mode_index[self._mode_index] == 0:
new_channel = 4 # user 1
else:
new_channel = 1 # device ctrl
elif self._mode_index == 2:
if self._sub_mode_index[self._mode_index] == 0:
new_channel = 5 # user 2
else:
new_channel = 1 + self._sub_mode_index[self._mode_index] # step seq
elif self._mode_index == 3: # mixer modes
new_channel = 6 + self._sub_modes.mode()
# if (new_channel > 0):
# new_channel += 3
return new_channel
def update(self):
assert self._modes_buttons != None
if self.is_enabled():
# for index in range(len(self._modes_buttons)):
# self._modes_buttons[index].set_force_next_value()
# if index == self._mode_index:
# self._modes_buttons[index].turn_on()
# else:
# self._modes_buttons[index].turn_off()
self._update_mode_buttons()
# update matrix and side buttons
for scene_index in range(8):
# update scene button
self._side_buttons[scene_index].set_enabled(True)
for track_index in range(8):
# update matrix
self._matrix.get_button(track_index, scene_index).set_enabled(True)
for button in self._nav_buttons:
button.set_enabled(True)
as_active = True
as_enabled = True
self._session.set_allow_update(False)
self._zooming.set_allow_update(False)
self._config_button.send_value(40)
self._config_button.send_value(1)
release_buttons = self._mode_index == 1
if self._mode_index == 0:
# session
self._setup_mixer((not as_active))
self._setup_device_controller((not as_active))
self._setup_step_sequencer((not as_active), 0)
self._setup_device_controller((not as_active))
self._setup_session(as_active, as_enabled)
elif self._mode_index == 1:
# user mode + device controller
self._setup_mixer((not as_active))
if self._sub_mode_index[self._mode_index] == 0:
self._setup_step_sequencer((not as_active), 0)
self._setup_device_controller((not as_active))
self._setup_session((not as_active), (as_enabled))
self._setup_user1(True, True, True)
else:
self._setup_session(not as_active, not as_enabled)
self._setup_step_sequencer(not as_active, 0)
self._setup_device_controller(as_active)
示例4: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
self.set_mode(0)
def number_of_modes(self):
return 5
def on_enabled_changed(self):
self.update()
def set_mode(self, mode):
assert mode in range(self.number_of_modes())
if (self._mode_index != mode) or (mode == 3):
self._mode_index = mode
self.update()
def channel_for_current_mode(self):
new_channel = self._mode_index + self._sub_modes.mode()
if new_channel > 0:
new_channel += 3
return new_channel
def update(self):
assert self._modes_buttons != None
if self.is_enabled():
# for index in range(len(self._modes_buttons)):
# self._modes_buttons[index].set_force_next_value()
# if index == self._mode_index:
# self._modes_buttons[index].turn_on()
# else:
# self._modes_buttons[index].turn_off()
for scene_index in range(8):
self._side_buttons[scene_index].set_enabled(True)
for track_index in range(8):
self._matrix.get_button(track_index, scene_index).set_enabled(True)
for button in self._nav_buttons:
button.set_enabled(True)
as_active = True
as_enabled = True
self._session.set_allow_update(False)
self._zooming.set_allow_update(False)
self._config_button.send_value(40)
self._config_button.send_value(1)
release_buttons = self._mode_index == 1
if self._mode_index < 4:
self._script._suppress_session_highlight = False
self._session.set_show_highlight(True)
# self._script.set_highlighting_session_component(self.session_component())
self._script._host._set_key_buttons(None)
self._script._host.set_enabled(False)
self._script._host._set_button_matrix(None)
self._script._host._set_alt_button(None)
self._script._host._set_shift_button(None)
self._script._host._set_nav_buttons(None)
for button in self._modes_buttons:
button.set_on_off_values(127, 4)
if self._mode_index == 0:
self._setup_mixer(not as_active)
self._setup_session(as_active, as_enabled)
elif self._mode_index == 1:
self._setup_session(not as_active, not as_enabled)
self._setup_mixer(not as_active)
示例5: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
class MainSelectorComponent(ModeSelectorComponent):
""" Class that reassigns the button on the launchpad to different functions """
def __init__(self, matrix, top_buttons, side_buttons, config_button):
raise isinstance(matrix, ButtonMatrixElement) or AssertionError
raise matrix.width() == 8 and matrix.height() == 8 or AssertionError
raise isinstance(top_buttons, tuple) or AssertionError
raise len(top_buttons) == 8 or AssertionError
raise isinstance(side_buttons, tuple) or AssertionError
raise len(side_buttons) == 8 or AssertionError
raise isinstance(config_button, ButtonElement) or AssertionError
ModeSelectorComponent.__init__(self)
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
self._zooming = DeprecatedSessionZoomingComponent(self._session)
self._session.name = 'Session_Control'
self._zooming.name = 'Session_Overview'
self._matrix = matrix
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._zooming.set_empty_value(LED_OFF)
self._all_buttons = []
for button in self._side_buttons + self._nav_buttons:
self._all_buttons.append(button)
self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session)
self._sub_modes.name = 'Mixer_Modes'
self._sub_modes.set_update_callback(self._update_control_channels)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self.set_modes_buttons(top_buttons[4:])
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._session = None
self._zooming = None
for button in self._all_buttons:
button.set_on_off_values(127, LED_OFF)
self._config_button.turn_off()
self._matrix = None
self._side_buttons = None
self._nav_buttons = None
self._config_button = None
ModeSelectorComponent.disconnect(self)
return
def session_component(self):
return self._session
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)
return
def number_of_modes(self):
return 4
def on_enabled_changed(self):
self.update()
def set_mode(self, mode):
if not mode in range(self.number_of_modes()):
raise AssertionError
self._mode_index = (self._mode_index != mode or mode == 3) and mode
self.update()
def channel_for_current_mode(self):
new_channel = self._mode_index + self._sub_modes.mode()
if new_channel > 0:
new_channel += 3
return new_channel
def update(self):
super(MainSelectorComponent, self).update()
if not self._modes_buttons != None:
raise AssertionError
if self.is_enabled():
for index in range(len(self._modes_buttons)):
self._modes_buttons[index].set_force_next_value()
if index == self._mode_index:
self._modes_buttons[index].turn_on()
else:
self._modes_buttons[index].turn_off()
for scene_index in range(8):
self._side_buttons[scene_index].set_enabled(True)
#.........这里部分代码省略.........
示例6: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
else:
self._script.show_message('Monomodular Script not inserted')
else:
self.set_mode(self._modes_buttons.index(sender))
else:
if self._modes_buttons.index(sender) == 3 and value > 0:
self.set_mode(0)
def number_of_modes(self):
return 5
def on_enabled_changed(self):
self.update()
def set_mode(self, mode):
assert (mode in range(self.number_of_modes()))
if ((self._mode_index != mode) or (mode == 3)):
self._mode_index = mode
self.update()
def update(self):
assert (self._modes_buttons != None)
if self.is_enabled():
for scene_index in range(8):
self._side_buttons[scene_index].set_enabled(True)
for track_index in range(8):
self._matrix.get_button(track_index, scene_index).set_enabled(True)
for button in self._nav_buttons:
button.set_enabled(True)
as_active = True
as_enabled = True
self._session.set_allow_update(False)
self._zooming.set_allow_update(False)
self._config_button.send_value(40)
self._config_button.send_value(1)
release_buttons = (self._mode_index == 1)
if (self._mode_index < 4):
self._script._host._set_key_buttons(None)
self._script._host.set_enabled(False)
self._script._host._set_button_matrix(None)
self._script._host._set_alt_button(None)
self._script._host._set_shift_button(None)
self._script._host._set_nav_buttons(None)
for button in self._modes_buttons:
button.set_on_off_values(5, 0)
if (self._mode_index == 0):
self._setup_mixer((not as_active))
self._setup_session(as_active, as_enabled)
elif (self._mode_index == 1):
self._setup_session((not as_active), (not as_enabled))
self._setup_mixer((not as_active))
self._setup_user(release_buttons)
elif (self._mode_index == 2):
self._setup_session((not as_active), (not as_enabled))
示例7: MainSelectorComponent
# 需要导入模块: import SubSelectorComponent [as 别名]
# 或者: from SubSelectorComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
self._m4lmode_index = 7
self.refresh_map_display()
self._setup_device_controller(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_session(not as_active, as_enabled)
self._setup_mixer(as_active)
self._update_control_channels()
else:
assert False
self._compute_mode_index()
self._previous_mode_index=self._main_mode_index
self._session.set_allow_update(True)
self._zooming.set_allow_update(True)
def _setup_session(self, as_active, as_enabled):
assert isinstance(as_active, type(False))
for button in self._nav_buttons:
if as_enabled:
button.set_on_off_values(GREEN_FULL, GREEN_THIRD)
else:
button.set_on_off_values(127, LED_OFF)
#matrix
self._activate_matrix(True)
for scene_index in range(8):
scene = self._session.scene(scene_index)
if as_active:
scene_button = self._side_buttons[scene_index]
scene_button.set_enabled(as_active)
scene_button.set_on_off_values(127, LED_OFF)
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(8):
if as_active:
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.set_enabled(as_active)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
#zoom
if as_active:
self._zooming.set_zoom_button(self._modes_buttons[0])
self._zooming.set_button_matrix(self._matrix)
self._zooming.set_scene_bank_buttons(self._side_buttons)
self._zooming.set_nav_buttons(self._nav_buttons[0], self._nav_buttons[1], self._nav_buttons[2], self._nav_buttons[3])
self._zooming.update()
else:
self._zooming.set_zoom_button(None)
self._zooming.set_button_matrix(None)
self._zooming.set_scene_bank_buttons(None)
self._zooming.set_nav_buttons(None, None, None, None)
#nav buttons
if as_enabled:
self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
self._session.set_scene_bank_buttons(self._nav_buttons[1], self._nav_buttons[0])
else:
self._session.set_track_bank_buttons(None, None)