summaryrefslogtreecommitdiff
path: root/interface/chaserview.py
diff options
context:
space:
mode:
Diffstat (limited to 'interface/chaserview.py')
-rwxr-xr-xinterface/chaserview.py33
1 files changed, 28 insertions, 5 deletions
diff --git a/interface/chaserview.py b/interface/chaserview.py
index 2c88343..e5b0c2b 100755
--- a/interface/chaserview.py
+++ b/interface/chaserview.py
@@ -4,8 +4,7 @@ import curses
import math
import threading
-import blc2
-from blc2.constants import INFTY
+from blc2.constants import INFTY, MANUAL
CURSES_LOCK = threading.RLock()
@@ -57,6 +56,17 @@ class ChaserView:
self._x = x
self.win.noutrefresh()
+ @property
+ def highlight(self):
+ return self._highlight
+
+ @highlight.setter
+ def highlight(self, value):
+ with self._lock:
+ if self._highlight != value:
+ self._highlight = value
+ self._redraw()
+
def _redraw(self):
self.win.erase()
self.win.border()
@@ -70,7 +80,7 @@ class ChaserView:
c = self._chaser
w = self._width - 2
- self.win.addstr(1, 1, self.fit(("%d: "% c.id) + c.name, w-2))
+ self.win.addstr(1, 1, self.fit(("%d: "% c.id) + c.name, w-2, True), curses.A_REVERSE if self._highlight else 0)
maxsteps = self._height - 4
if maxsteps < len(c.steps):
@@ -91,8 +101,15 @@ class ChaserView:
attrs = curses.A_REVERSE
else:
attrs = 0
- t = "%s:%s:%s" % (format_time(s.fade_in), format_time(s.duration), format_time(s.fade_out))
- self.win.addstr(n+2, 1, self.fit((self._numformat % (s.index+1)) + ": " + s.name, w-8, pad=True)+t, attrs)
+ if s.function is not None:
+ ft = s.function.type[0].upper()
+ fid = str(s.function.id)
+ else:
+ ft = "-"
+ fid = "---"
+
+ t = "%s%3s%s|%s:%s:%s" % (ft, fid, '*' if s.duration_mode == MANUAL else ' ', format_time(s.fade_in), format_time(s.duration), format_time(s.fade_out))
+ self.win.addstr(n+2, 1, self.fit((self._numformat % (s.index+1)) + ": " + s.name, w-len(t), pad=True)+t, attrs)
if first > 0:
self.win.addch(3, self._width//2, '⯅')
@@ -122,6 +139,11 @@ class ChaserView:
self._numformat = "%%%dd" % math.ceil(math.log10(len(chaser.steps)))
self._redraw()
+ @property
+ def chaser(self):
+ with self._lock:
+ return self._chaser
+
def __init__(self, y, x, height, width):
with CURSES_LOCK:
self.win = curses.newwin(height, width, y, x)
@@ -133,6 +155,7 @@ class ChaserView:
self._x = -1
self._chaser = None
+ self._highlight = False
self._numformat = ""
self._selected = -1