summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Connors <benconnors@outlook.com>2019-11-27 18:59:01 -0500
committerBen Connors <benconnors@outlook.com>2019-11-27 18:59:01 -0500
commit4e2e73e1bce3cf51107d7fe1314a92fd519f03f2 (patch)
treeedd42a5f7e13834ecafc973c6457e5ba879a5012
parent20da984d08c414f49f6a64cd3d68be68fd0246bb (diff)
Bugfixes; usability improvements
-rw-r--r--blc2/functions/chaser.py6
-rw-r--r--interface/interface.py37
-rw-r--r--interface/render.py2
3 files changed, 37 insertions, 8 deletions
diff --git a/blc2/functions/chaser.py b/blc2/functions/chaser.py
index 0f7bb89..2f91dcb 100644
--- a/blc2/functions/chaser.py
+++ b/blc2/functions/chaser.py
@@ -230,8 +230,8 @@ class Chaser(Function):
if not self._steps:
return (), (), data
elif not data.steps:
- if data.audio_id != 0:
- raise ValueError("Audio ID must be zero")
+ ##if data.audio_id != 0:
+ ## raise ValueError("Audio ID must be zero")
n = self.first_step
sd = self.steps[n]._get_data(0, 0) #pylint: disable=protected-access
data.audio_id += 1
@@ -245,7 +245,7 @@ class Chaser(Function):
data.audio_id += 1
## Make sure we have all the steps we need
- st = data.steps[-1].actual_duration + data.steps[-1].start_time
+ st = data.steps[-1].step.duration + data.steps[-1].start_time
if st < INFTY and st <= t:
for n in self.next_steps(data):
s = self.steps[n]
diff --git a/interface/interface.py b/interface/interface.py
index da83a19..48f3d24 100644
--- a/interface/interface.py
+++ b/interface/interface.py
@@ -10,7 +10,7 @@ from blc2.functions.audio import Audio
from blc2.functions.scene import Scene
from blc2.functions.chaser import Chaser
from blc2.functions.chaserstep import ChaserStep
-from blc2.constants import SCENE, CHASER, AUDIO, MANUAL, INHERIT
+from blc2.constants import SCENE, CHASER, AUDIO, MANUAL, INHERIT, INFTY
from blc2.topology import Fixture
@@ -510,7 +510,7 @@ class Interface:
s = ChaserStep(c, index=index, name=name, function=f)
self.current_cv.set_chaser(c, s.index)
- self.chaser_edit(s.index+1)
+ #self.chaser_edit(s.index+1)
def chaser_new_new(self, index, name, fname, type_):
with self.w_lock:
@@ -632,10 +632,10 @@ class Interface:
self.base_run()
def run_exit(self):
- with self.w_lock:
- self.rendering = False
- self.renderer.stop()
+ self.rendering = False
+ self.renderer.stop()
+ with self.w_lock:
self.channel_bank.title = "Channels"
self.channel_bank.highlight = False
self.channel_bank.set_scope(())
@@ -643,6 +643,7 @@ class Interface:
if self.chaser_stack:
for i, c in zip(self.chaser_stack.pop(-1), self.chaser_views):
c.selected = i
+ self.current_cv.highlight = True
if self.current_cv.selected is not None:
s = self.current_cv.chaser.steps[self.current_cv.selected]
if s.function is not None and s.function.type in (SCENE, AUDIO,):
@@ -676,6 +677,24 @@ class Interface:
"Output is %sOK: %s" % ("" if self.output.ok else "NOT ", self.output.status),
), True)
+ def chaser_info(self, n):
+ with self.w_lock:
+ if n is None:
+ n = self.current_cv.selected
+ if n is None:
+ return "No step selected"
+ else:
+ n -= 1
+ if n < 0 or n >= len(self.current_cv.chaser.steps):
+ return "Invalid step"
+ f = self.current_cv.chaser.steps[n]
+ self.pager.display_many((
+ f.name,
+ "- Fade in: %7.3f" % (f.fade_in/1000),
+ "- Duration: " + (("%7.3f" % (f.duration/1000)) if f.duration != INFTY else "infty"),
+ "- Fade out: %7.3f" % (f.fade_out/1000),
+ ))
+
def __init__(self, path, output):
## Have to do most of the actual initialization in the main method, as curses isn't
## ready yet.
@@ -757,6 +776,11 @@ class Interface:
("append $quoted_string from new scene $quoted_string", lambda n, s: self.chaser_new_new(-1, n, s, Scene)),
("append $quoted_string from new audio $quoted_string", lambda n, s: self.chaser_new_new(-1, n, s, Audio)),
+ ("append", lambda: self.chaser_new(-1, "")),
+ ("append from $num", lambda s: self.chaser_new(-1, "", s)),
+ ("append from new scene $quoted_string", lambda s: self.chaser_new_new(-1, "", s, Scene)),
+ ("append from new audio $quoted_string", lambda s: self.chaser_new_new(-1, "", s, Audio)),
+
("new $num $quoted_string", self.chaser_new),
("new $num $quoted_string from $num", self.chaser_new),
("new $num $quoted_string from new scene $quoted_string", lambda i, n, s: self.chaser_new_new(i, n, s, Scene)),
@@ -777,6 +801,9 @@ class Interface:
("list chasers", lambda: self.list_functions(CHASER)),
("list audio", lambda: self.list_functions(AUDIO)),
+ ("info", lambda: self.chaser_info(None)),
+ ("info $num", self.chaser_info),
+
("trailer", self.chaser_run),
("pager page", self.page),
diff --git a/interface/render.py b/interface/render.py
index 7f8d3f1..a15b473 100644
--- a/interface/render.py
+++ b/interface/render.py
@@ -44,6 +44,7 @@ class Renderer:
with self._lock:
self._running = False
+
def set_functions(self, *args):
with self._lock:
if self._running:
@@ -138,6 +139,7 @@ class Renderer:
self.w_lock = w_lock
self._lock = threading.RLock()
+ self._stop_lock = threading.Lock()
self._hold = {}
self._channels = frozenset().union(*((c for c in f.channels) for f in w.fixtures.values()))
self._last = {c: 0 for c in self._channels}