summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/src/meshbay_cli/tui/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/tui/app.py')
-rw-r--r--packages/meshbay-cli/src/meshbay_cli/tui/app.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/tui/app.py b/packages/meshbay-cli/src/meshbay_cli/tui/app.py
index dbb773c..fe7fa2c 100644
--- a/packages/meshbay-cli/src/meshbay_cli/tui/app.py
+++ b/packages/meshbay-cli/src/meshbay_cli/tui/app.py
@@ -3,7 +3,8 @@
Textual, because it runs on the same asyncio loop as aiortc and httpx rather
than beside them, and on Linux terminals and Windows' consoles alike. Signed in
-already, it opens on the two panes; otherwise on the sign-in screen first.
+already, it opens on the two panes — or, for `meshbay-cli chat` with no group,
+on the groups to chat in (`tui/chat.py`); otherwise on the sign-in screen first.
Nothing is printed while it runs — a line on stderr would tear the screen — so
the log goes to a file in the CLI's data directory instead.
@@ -24,10 +25,12 @@ from .screens import DeviceCode, MainScreen, SignInScreen
class MeshBayApp(App):
TITLE = "MeshBay"
- def __init__(self, ctx: Context):
+ def __init__(self, ctx: Context, home=MainScreen):
super().__init__()
self.ctx = ctx
self.hub = ctx.hub
+ # The screen a signed-in account lands on, made from the account.
+ self.home = home
async def use_hub(self, url: str) -> None:
if url != self.hub.url:
@@ -51,9 +54,9 @@ class MeshBayApp(App):
def start(self, account: Account) -> None:
account.on_device_code = DeviceCode(self)
if isinstance(self.screen, SignInScreen):
- self.switch_screen(MainScreen(account))
+ self.switch_screen(self.home(account))
else:
- self.push_screen(MainScreen(account))
+ self.push_screen(self.home(account))
def _log_to_file() -> None:
@@ -70,7 +73,7 @@ def _log_to_file() -> None:
root.addHandler(handler)
-async def run_interactive(ctx: Context) -> int:
+async def run_interactive(ctx: Context, home=MainScreen) -> int:
_log_to_file()
- await MeshBayApp(ctx).run_async()
+ await MeshBayApp(ctx, home).run_async()
return 0