Retro Bulletin Board Systems on atproto. Web app and TUI. lazy mirror of alyraffauf/atbbs atbbs.xyz
forums python tui atproto bbs
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

tui: add cycling handle examples

+39 -2
+3 -1
tui/screens/home.py
··· 6 6 from textual.screen import Screen 7 7 from textual.widgets import Footer, Input, ListItem, ListView, Static 8 8 9 + from tui.widgets.handle_input import HandleInput 10 + 9 11 from core import lexicon 10 12 from core.models import BBSNotFoundError, NetworkError, NoBBSError 11 13 from core.resolver import resolve_bbs ··· 47 49 ) 48 50 yield Static("") 49 51 yield Static("Dial a BBS", classes="title") 50 - yield Input(placeholder="handle.example.com", id="handle-input") 52 + yield HandleInput(id="handle-input") 51 53 yield Static( 52 54 "OR TRY ONE OF THESE", id="discover-label", classes="section-label" 53 55 )
+3 -1
tui/screens/login.py
··· 9 9 from textual.screen import Screen 10 10 from textual.widgets import Footer, Input, Static 11 11 12 + from tui.widgets.handle_input import HandleInput 13 + 12 14 from core.auth.config import load_secrets 13 15 from core.auth.oauth import ( 14 16 exchange_code, ··· 39 41 "Sign in with your atproto handle. A browser window will open.", 40 42 classes="subtitle", 41 43 ) 42 - yield Input(placeholder="your-handle.bsky.social", id="login-handle") 44 + yield HandleInput(id="login-handle") 43 45 yield Footer() 44 46 45 47 def on_mount(self) -> None:
+33
tui/widgets/handle_input.py
··· 1 + """Input widget with cycling AT Protocol handle placeholders.""" 2 + 3 + from textual.widgets import Input 4 + 5 + PLACEHOLDERS = [ 6 + "handle.blacksky.app", 7 + "handle.bsky.social", 8 + "handle.eurosky.social", 9 + "handle.northsky.social", 10 + "handle.selfhosted.social", 11 + "handle.tngl.sh", 12 + "handle.witchcraft.systems", 13 + "handle.your-domain.com", 14 + ] 15 + 16 + 17 + class HandleInput(Input): 18 + """An Input that cycles through example AT Protocol handles as placeholder text.""" 19 + 20 + def __init__(self, **kwargs) -> None: 21 + kwargs.setdefault("placeholder", PLACEHOLDERS[0]) 22 + super().__init__(**kwargs) 23 + self._placeholder_index = 0 24 + 25 + def on_mount(self) -> None: 26 + self.set_interval(3, self._cycle_placeholder) 27 + 28 + def _cycle_placeholder(self) -> None: 29 + # Don't cycle if the user has typed something. 30 + if self.value: 31 + return 32 + self._placeholder_index = (self._placeholder_index + 1) % len(PLACEHOLDERS) 33 + self.placeholder = PLACEHOLDERS[self._placeholder_index]