diff options
author | Ben Connors <benconnors@outlook.com> | 2019-12-03 10:24:42 -0500 |
---|---|---|
committer | Ben Connors <benconnors@outlook.com> | 2019-12-03 10:24:42 -0500 |
commit | 1ea9b37468b2cffc6c6c62dd767ab4d3956e54c7 (patch) | |
tree | 6d758d241de75229cbb1696ea1f38821fa856cef | |
parent | 7b8505af6c74abd98462662acda0b2dbb46c328d (diff) |
Interface fixes
- Don't use italics if unavailable
- Add more command-line options
- Fix channels indexing from 1 in interface (now 0)
-rw-r--r-- | interface/__main__.py | 46 | ||||
-rwxr-xr-x | interface/input/tabcomp.py | 2 | ||||
-rw-r--r-- | interface/interface.py | 7 |
3 files changed, 45 insertions, 10 deletions
diff --git a/interface/__main__.py b/interface/__main__.py index 878b263..b1267c8 100644 --- a/interface/__main__.py +++ b/interface/__main__.py @@ -1,12 +1,48 @@ +#!/usr/bin/env python3 + +import argparse as ap import datetime as dt import os import sys from .interface import Interface -from .ola import OLAOutput -#from .dummy import DummyOutput -if len(sys.argv) > 2: - raise ValueError("Usage: %s [workspace file]" % sys.argv[0]) +parser = ap.ArgumentParser(description="Curses interface for BLC2") +parser.add_argument("-o", "--output", default="ola", action="store", help="Select the output") +parser.add_argument("workspace", nargs='?', default=None, help="Workspace file to use") + +args = parser.parse_args() + +output = args.output.lower() +if output == "none": + class NoOutput: + name = "None" + + def set_values(self, values): + pass + + @property + def ok(self): + return True + + @property + def status(self): + return "Nothing's good" + + def __init__(self): + pass + + output = NoOutput() + +elif output == "dummy": + from .dummy import DummyOutput + + output = DummyOutput() +elif output == "ola": + from .ola import OLAOutput + + output = OLAOutput() +else: + raise ValueError("Unknown output \"%s\"" % output) -Interface(sys.argv[1] if len(sys.argv) == 2 else None, OLAOutput()).main() +Interface(args.workspace, output).main() diff --git a/interface/input/tabcomp.py b/interface/input/tabcomp.py index 4cce602..7479f97 100755 --- a/interface/input/tabcomp.py +++ b/interface/input/tabcomp.py @@ -152,7 +152,7 @@ class Input: self.win.addstr(1, 1, ' '*(self._width-2)) self.win.addstr(2, 1, ' '*(self._width-2)) self.win.addstr(1, 1, l1) - self.win.addstr(2, 1, l2, curses.A_ITALIC) + self.win.addstr(2, 1, l2, (curses.A_ITALIC if hasattr(curses, "A_ITALIC") else 0)) self.win.move(1, len(l1)+1) self.win.refresh() diff --git a/interface/interface.py b/interface/interface.py index 832663e..6f68b2f 100644 --- a/interface/interface.py +++ b/interface/interface.py @@ -224,7 +224,7 @@ class Interface: else: continue - for n, c in enumerate(f.channels, 1): + for n, c in enumerate(f.channels): for s, e in cr[1]: if (s <= n <= e) or (e == -1 and n >= s): channels.append(c) @@ -725,7 +725,7 @@ class Interface: self.current_cv.chaser.advance_mode = mode self.current_cv.set_chaser(self.current_cv.chaser, self.current_cv.selected) - def base_copy(self, num, name=None): + def base_copy(self, name, num): with self.w_lock: ## TODO: Implement this in BLC if num not in self.w.functions: @@ -786,8 +786,7 @@ class Interface: ("list audio", lambda: self.list_functions(AUDIO)), ("list joins", lambda: self.list_functions(JOIN)), - ("copy $num", self.base_copy), - ("copy $num $quoted_string", self.base_copy), + ("new scene $quoted_string from $num", self.base_copy), ("currentstatus", self.current_status), |