remove CLI mode

This commit is contained in:
Gabby Morgan
2026-05-30 19:15:25 -05:00
parent feed1145f8
commit b4cd86ed78
2 changed files with 5 additions and 81 deletions
+3 -76
View File
@@ -35,7 +35,7 @@ class ChannelClient:
STATE_IN_CALL = 4
def __init__(self, configdir=None, rnsconfigdir=None, whitelist_path=None,
verbosity=0, announce_interval=0, use_whisplay=False):
verbosity=0, announce_interval=0):
self.state = self.STATE_IDLE
self.channels = []
self.telephone = None
@@ -52,8 +52,7 @@ class ChannelClient:
self.whisplay_interface = None
self._gesture_thread = None
if use_whisplay:
self._init_whisplay()
self._init_whisplay()
if configdir is None:
if os.path.isdir("/etc/lxst-client"):
@@ -555,10 +554,7 @@ class ChannelClient:
signal.signal(signal.SIGTERM, self._sigterm_handler)
self.should_run = True
if self.whisplay_interface.board:
self._run_gui()
else:
self._run_cli()
self._run_gui()
def _run_gui(self):
self._flash_screen()
@@ -576,69 +572,6 @@ class ChannelClient:
continue
time.sleep(0.1)
def _run_cli(self):
print(
f"\n{Terminal.BOLD}"
f"LXST Channel Client"
f"{Terminal.END}"
)
print(f" Identity: {RNS.prettyhexrep(self.identity.hash)}")
print(f" Whitelist: {self.whitelist_path}")
print()
self.discover(timeout=15)
self.show_channels()
self.show_help()
while self.should_run:
if self.state == self.STATE_IN_CALL:
try:
input(" In call, press Enter to hang up > ")
self.telephone.hangup()
self.state = self.STATE_READY
except (EOFError, KeyboardInterrupt):
break
continue
if self.state == self.STATE_CALLING:
time.sleep(0.5)
continue
if self.state == self.STATE_DISCOVERING:
time.sleep(0.5)
continue
try:
inp = input("> ").strip().lower()
except (EOFError, KeyboardInterrupt):
print()
break
if not inp:
continue
if inp == "q":
break
elif inp in ("h", "?"):
self.show_help()
elif inp == "d":
self.discover()
self.show_channels()
elif inp == "l":
self.show_channels()
else:
try:
idx = int(inp) - 1
if 0 <= idx < len(self.channels):
self.call_channel(idx)
else:
print(
f"Invalid index. "
f"Enter a number between 1 and {len(self.channels)}"
)
except ValueError:
print(f"Unknown command: {inp}. Type 'h' for help.")
def cleanup(self):
if self.telephone and self.state == self.STATE_IN_CALL:
self.telephone.hangup()
@@ -682,11 +615,6 @@ def main():
help="seconds between LXMF destination announces (0 = announce once at startup, default)",
type=int,
)
parser.add_argument(
"--whisplay", "-W",
action="store_true",
help="enable Whisplay HAT GUI mode",
)
args = parser.parse_args()
client = ChannelClient(
@@ -695,7 +623,6 @@ def main():
whitelist_path=args.whitelist,
verbosity=args.verbose,
announce_interval=args.announce_interval,
use_whisplay=args.whisplay,
)
try: