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: remove silly bare exceptions

+19 -34
+9 -16
tui/screens/activity.py
··· 39 39 def refresh_data(self) -> None: 40 40 for child in list(self.query(Post)): 41 41 child.remove() 42 - try: 43 - self.query_one("#activity-loading").remove() 44 - except Exception: 45 - pass 42 + for w in self.query("#activity-loading"): 43 + w.remove() 46 44 self.query_one("#activity-scroll").mount( 47 45 Static("Loading...", id="activity-loading") 48 46 ) ··· 97 95 async def load_inbox(self) -> None: 98 96 session = self.app.user_session 99 97 if not session: 100 - try: 101 - self.query_one("#activity-loading").update("Log in to see your inbox.") 102 - except Exception: 103 - pass 98 + for w in self.query("#activity-loading"): 99 + w.update("Log in to see your inbox.") 104 100 return 105 101 106 102 from core.records import fetch_inbox ··· 113 109 self.notify("Failed to load inbox.", severity="error") 114 110 return 115 111 116 - try: 117 - self.query_one("#activity-loading").remove() 118 - except Exception: 119 - pass 112 + for w in self.query("#activity-loading"): 113 + w.remove() 120 114 121 115 scroll = self.query_one("#activity-scroll") 122 116 if not self._items: ··· 137 131 ) 138 132 139 133 # select first post 140 - try: 141 - self.query(Post).first().focus() 142 - except Exception: 143 - pass 134 + posts = list(self.query(Post)) 135 + if posts: 136 + posts[0].focus()
+2 -4
tui/screens/board.py
··· 79 79 lv.index = 0 80 80 81 81 # Remove old next page button if present 82 - try: 83 - await self.query_one("#next-page", Button).remove() 84 - except Exception: 85 - pass 82 + for btn in self.query("#next-page"): 83 + await btn.remove() 86 84 87 85 if next_cursor: 88 86 if self.page + 1 >= len(self.cursor_history):
+2 -4
tui/screens/compose.py
··· 160 160 return 161 161 if self.quote: 162 162 self.quote = None 163 - try: 164 - self.query_one("#quote-info").remove() 165 - except Exception: 166 - pass 163 + for w in self.query("#quote-info"): 164 + w.remove() 167 165 else: 168 166 self.quote = self._original_quote 169 167 body_preview = self.quote.body[:60] + (
+6 -10
tui/screens/thread.py
··· 64 64 yield Footer() 65 65 66 66 def on_mount(self) -> None: 67 - try: 68 - self.query(Post).first().focus() 69 - except Exception: 70 - pass 67 + posts = list(self.query(Post)) 68 + if posts: 69 + posts[0].focus() 71 70 self.load_replies(focus_reply=self._focus_reply) 72 71 self._focus_reply = None # only use on first load 73 72 ··· 131 130 ) 132 131 133 132 # Focus first reply 134 - try: 135 - replies = [p for p in self.query(Post) if p.collection == lexicon.REPLY] 136 - if replies: 137 - replies[0].focus() 138 - except Exception: 139 - pass 133 + replies = [p for p in self.query(Post) if p.collection == lexicon.REPLY] 134 + if replies: 135 + replies[0].focus() 140 136 141 137 def action_next_page(self) -> None: 142 138 if self._page < self._total_pages: