-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomClipSlotComponent.py
76 lines (67 loc) · 2.75 KB
/
CustomClipSlotComponent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# uncompyle6 version 3.7.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.17 (default, Sep 30 2020, 13:38:04)
# [GCC 7.5.0]
# Embedded file name: C:\ProgramData\Ableton\Live 101 Suite\Resources\MIDI Remote Scripts\APC40_MkIIx\CustomClipSlotComponent.py
# Compiled at: 2019-06-18 01:08:33
import Live
from _Framework.ClipSlotComponent import *
class CustomClipSlotComponent(ClipSlotComponent):
_copy_button = None
_clip_slot_copy_handler = None
@subject_slot('value')
def _launch_button_value(self, value):
if self.is_enabled():
# self.log_message('is enabled level')
if self._select_button and self._select_button.is_pressed() and value:
self._do_select_clip(self._clip_slot)
elif self._clip_slot != None:
if self._duplicate_button and self._duplicate_button.is_pressed():
if value:
self._do_duplicate_clip()
elif self._copy_button and self._copy_button.is_pressed():
if value:
if not self._is_copying():
self._do_start_copy_clip()
else:
self._do_perform_copy_clip()
self._do_finish_copy_clip()
elif self._delete_button and self._delete_button.is_pressed():
if value:
self._do_delete_clip()
else:
self._do_launch_clip(value)
return
def _is_copying(self):
return self._clip_slot_copy_handler.is_copying()
def _do_start_copy_clip(self):
if self._clip_slot and self._clip_slot.has_clip:
try:
self._clip_slot_copy_handler._start_copying(self._clip_slot)
except Live.Base.LimitationError:
pass
except RuntimeError:
pass
def _do_finish_copy_clip(self):
if self._clip_slot:
try:
self._clip_slot_copy_handler._finish_copying()
except Live.Base.LimitationError:
pass
except RuntimeError:
pass
def _do_perform_copy_clip(self):
if self._clip_slot:
try:
self._clip_slot_copy_handler._perform_copy(self._clip_slot)
except Live.Base.LimitationError:
pass
except RuntimeError:
pass
def set_delete_button(self, button):
self._delete_button = button
def set_paste_button(self, button):
self._paste_button = button
def set_copy_button(self, button, clip_slot_copy_handler):
self._copy_button = button
self._clip_slot_copy_handler = clip_slot_copy_handler