-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpseudocues.py
119 lines (92 loc) · 3.38 KB
/
pseudocues.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This file is a derivation of work on - and as such shares the same
# licence as - Linux Show Player
#
# Linux Show Player:
# Copyright 2012-2022 Francesco Ceruti <ceppofrancy@gmail.com>
#
# This file:
# Copyright 2022 s0600204
#
# Linux Show Player is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Linux Show Player is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Linux Show Player. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=missing-docstring, invalid-name, too-few-public-methods
"""
Whilst there are some minor differences, cue layouts within QLab are functionally the same as
QLab's "Group" cue-type, and are handled similarly.
In LiSP cue layouts contain cues, but are not analogous to cues.
The classes in the file map LiSP's cue layouts to our implementention of QLab's OSC api,
allowing the layouts to be interacted with via the same commands as normal cues.
"""
# pylint: disable=import-error
from lisp.cues.cue import Cue
from lisp.ui.ui_utils import translate
class CueCart(Cue):
def __init__(self, layout, index, *args, **kwargs):
super().__init__(*args, **kwargs)
# `self.index` (inherited Property) is presented to Remote Apps (as the "cue number");
# `self._index` is used internally within LiSP
self._index = -1
self._layout = layout
self.set_index(index)
def deinit(self):
del self._layout
@property
def columns(self):
return self._layout.view.widget(self._index).columns
@property
def rows(self):
return self._layout.view.widget(self._index).rows
def set_index(self, index):
self._index = index
@property
def index(self):
return 'P' + str(self._index + 1)
@property
def name(self):
return self._layout.view.tabText(self._index)
def selected_cue(self):
return -1
def stop(self, **_):
self._layout.stop_all()
class CueList(Cue):
def __init__(self, layout, *args, **kwargs):
super().__init__(*args, **kwargs)
self.name = translate('CueName', 'Main Cue List')
self.index = 'L'
self._layout = layout
def deinit(self):
del self._layout
def selected_cue(self):
return self._layout.standby_index()
def standby_cue_id(self):
cue_num = self.selected_cue()
if cue_num == -1:
return 'none'
return self._layout.cue_at(cue_num).id
def standby_cue_num(self):
cue_num = self.selected_cue()
if cue_num == -1:
return 'none'
return str(cue_num)
def set_standby_id(self, cue_id):
for cue in self._layout.cues():
if cue.id == cue_id:
self._layout.set_standby_index(cue.index)
return True
return False
def set_standby_num(self, cue_num):
self._layout.set_standby_index(cue_num)
def start(self, **_):
self._layout.go()
def stop(self, **_):
self._layout.stop_all()