本文整理汇总了Python中_Framework.ModesComponent.ModesComponent.set_mode_button方法的典型用法代码示例。如果您正苦于以下问题:Python ModesComponent.set_mode_button方法的具体用法?Python ModesComponent.set_mode_button怎么用?Python ModesComponent.set_mode_button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_Framework.ModesComponent.ModesComponent
的用法示例。
在下文中一共展示了ModesComponent.set_mode_button方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OhmModHandler
# 需要导入模块: from _Framework.ModesComponent import ModesComponent [as 别名]
# 或者: from _Framework.ModesComponent.ModesComponent import set_mode_button [as 别名]
class OhmModHandler(ModHandler):
def __init__(self, *a, **k):
super(OhmModHandler, self).__init__(*a, **k)
self._shift_mode = ModesComponent()
self._color_type = 'RGB'
self._shift_mode.add_mode('shift', tuple([self._enable_shift, self._disable_shift]), behaviour = CancellableBehaviourWithRelease())
self.nav_box = self.register_component(NavigationBox(self, 16, 16, 8, 8, self.set_offset))
self._mod_button = None
def _enable_shift(self):
self._shift_value(1)
def _disable_shift(self):
self._shift_value(0)
def set_shift_button(self, button):
self._shift_mode.set_mode_button('shift', button)
def set_nav_matrix(self, matrix):
self.nav_box.set_matrix(matrix)
def _receive_grid(self, x, y, value, *a, **k):
#self._receive_grid(x, y, value, *a, **k)
legacy = self.active_mod().legacy
if self._active_mod:
if not self._grid_value.subject is None:
if legacy:
x = x - self.x_offset
y = y - self.y_offset
if x in range(8) and y in range(8):
try:
self._grid_value.subject.send_value(x, y, self._colors[value], True)
except:
pass
def set_device_selector_matrix(self, matrix):
self._device_selector.set_matrix(matrix)
@subject_slot('value')
def _grid_value(self, value, x, y, *a, **k):
#self.log_message('_base_grid_value ' + str(x) + str(y) + str(value))
if self.active_mod():
if self.active_mod().legacy:
x += self.x_offset
y += self.y_offset
self._active_mod.send('grid', x, y, value)
@subject_slot('value')
def _shift_value(self, value, *a, **k):
self._is_shifted = not value is 0
mod = self.active_mod()
if mod:
mod.send('shift', value)
if self._is_shifted:
self.shift_mode.enter_mode()
if mod and mod.legacy:
self.legacy_shift_mode.enter_mode()
else:
self.legacy_shift_mode.leave_mode()
self.shift_mode.leave_mode()
self.update()
def set_mod_button(self, button):
self._mod_button = button
def update(self, *a, **k):
mod = self.active_mod()
if self.is_enabled():
if not mod is None:
mod.restore()
else:
if not self._grid_value.subject is None:
self._grid_value.subject.reset()
if not self._keys_value.subject is None:
self._keys_value.subject.reset()
self._alt_value.subject and self._alt_value.subject.send_value(2 + int(self.is_alted())*7, True)
if self._on_lock_value.subject:
self._on_lock_value.subject.send_value(1 + (int(self.is_locked())*4), True)
else:
self._mod_button and self._mod_button.send_value(7 + (not self.active_mod() is None)*7, True)
else:
self._mod_button and self._mod_button.send_value((not self.active_mod() is None)*3, True)
示例2: AumTroll
# 需要导入模块: from _Framework.ModesComponent import ModesComponent [as 别名]
# 或者: from _Framework.ModesComponent.ModesComponent import set_mode_button [as 别名]
class AumTroll(Cntrlr):
__module__ = __name__
__doc__ = " MonOhmod companion controller script "
def __init__(self, *a, **k):
self._monohm = None
self._aumpush = None
self._shifted = False
self._use_pedal = True
self._suppress_next_mod_display = False
self._monomod_version = 'b996'
self._codec_version = 'b996'
super(AumTroll, self).__init__(*a, **k)
self._host_name = "AumTroll"
with self.component_guard():
self._setup_alt_device_control()
self._setup_alt_mixer()
#self._setup_device_selector() # Not sure why this was HERE, but removed 051314 because it was overriding mod grid updates
#self._setup_alt_device_control()
#self.schedule_message(3, self._session._do_show_highlight)
self._send_midi(tuple(request_snapshot))
"""script initialization methods"""
def _open_log(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<= " + str(self._host_name) + " " + str(self._monomod_version) + " log opened =>>>>>>>>>>>>>>>>>>>")
self.show_message(str(self._host_name) + ' Control Surface Loaded')
def _setup_modes(self):
super(AumTroll, self)._setup_modes()
self._alt_shift_mode = ModesComponent()
self._alt_shift_mode.add_mode('alt_shift', tuple([self._enable_alt_shift, self._disable_alt_shift]), behaviour = CancellableBehaviourWithRelease())
self._alt_shift_mode.set_mode_button('alt_shift', self._grid[15])
def _enable_alt_shift(self):
self._alt_shift_enabled = True
self._on_shift_button_value(1)
def _disable_alt_shift(self):
self._alt_shift_enabled = False
self._on_shift_button_value(0)
def deassign_live_controls(self):
self._leds_last = None
self._device_selector.set_enabled(False)
self._device._parameter_controls = None
self._device1._parameter_controls = None
self._device2._parameter_controls = None
for index in range(8):
self._mixer2.channel_strip(index).set_select_button(None)
self._mixer2.channel_strip(index).set_volume_control(None)
for index in range(4):
self._mixer3.channel_strip(index).set_select_button(None)
self._mixer3.channel_strip(index).set_volume_control(None)
self._mixer3.return_strip(index).set_volume_control(None)
#if self._aumpush:
# self._aumpush._host._set_bank_buttons(None)
#self._on_shift_button_value.subject = None
self._alt_shift_mode.set_mode_button('alt_shift', None)
self._mixer.set_crossfader_control(None)
"""THIS SECTION IS MISSING FROM THE ORIGINAL SCRIPT AND NEEDS TO BE FIXED...THE ASSIGNMENTS WERE MADE AT __init__"""
for index in range(4):
self._mixer.channel_strip(index).set_volume_control(None) #Since we gave our mixer 4 tracks above, we'll now assign our fader controls to it
for index in range(2):
self._mixer.return_strip(index).set_volume_control(None) #assign the right faders to control the volume of our return strips
self._mixer.master_strip().set_volume_control(None) #assign the far right fader to control our master channel strip
self._mixer.set_prehear_volume_control(None) #assign the remaining fader to control our prehear volume of the the master channel strip
for index in range(4): #for the left side of the mixer
self._mixer.channel_strip(index).set_solo_button(None) #remove the solo button assignments
self._mixer.channel_strip(index).set_arm_button(None) #remove the arm button assignments
self._mixer.channel_strip(index).set_mute_button(None) #remove the mute button assignments
self._mixer.channel_strip(index).set_select_button(None) #remove the select button assignments
for column in range(4):
for row in range(4):
self._scene[row].clip_slot(column).set_launch_button(None) #remove the clip launch assignments
self._send_reset.set_buttons(tuple([None for index in range(4)])) #remove the send_reset button assignments - this has to be sent as a tuple
self._session.set_stop_track_clip_buttons(None) #remove the clip_stop button assignments
self._session.set_track_bank_buttons(None, None) #set the track bank buttons for the Session navigation controls
self._session.set_scene_bank_buttons(None, None) #set the scnee bank buttons for the Session navigation controls
self._transport.set_play_button(None) #remove the play button assignment
self._transport.set_record_button(None) #remove the record button assignment
self._transport.set_stop_button(None) #remove the stop button assignment
for index in range(16):
self._grid[index].set_on_off_values(127, 0) #reset the on/off values of the grid buttons
self._grid[index].reset() #turn the buttons LEDs off
for index in range(32):
self._button[index].set_on_off_values(127, 0) #reset the on/off values for the key buttons
self._button[index].release_parameter() #remove the parameter assignment that was assigned to the keys
self._button[index].send_value(0, True) #turn the buttons LEDs off
#.........这里部分代码省略.........