-
Notifications
You must be signed in to change notification settings - Fork 1
/
SpecialChannelStripComponent.py
executable file
·44 lines (30 loc) · 1.37 KB
/
SpecialChannelStripComponent.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
# emacs-mode: -*- python-*-
# -*- coding: utf-8 -*-
from _Framework.ChannelStripComponent import ChannelStripComponent
TRACK_FOLD_DELAY = 5
class SpecialChannelStripComponent(ChannelStripComponent):
' Subclass of channel strip component using select button for (un)folding tracks '
__module__ = __name__
def __init__(self):
ChannelStripComponent.__init__(self)
self._toggle_fold_ticks_delay = -1
self._register_timer_callback(self._on_timer)
def disconnect(self):
self._unregister_timer_callback(self._on_timer)
ChannelStripComponent.disconnect(self)
def _select_value(self, value):
ChannelStripComponent._select_value(self, value)
if (self.is_enabled() and (self._track != None)):
if (self._track.is_foldable and (self._select_button.is_momentary() and (value != 0))):
self._toggle_fold_ticks_delay = TRACK_FOLD_DELAY
else:
self._toggle_fold_ticks_delay = -1
def _on_timer(self):
if (self.is_enabled() and (self._track != None)):
if (self._toggle_fold_ticks_delay > -1):
assert self._track.is_foldable
if (self._toggle_fold_ticks_delay == 0):
self._track.fold_state = (not self._track.fold_state)
self._toggle_fold_ticks_delay -= 1
# local variables:
# tab-width: 4