Update status detail after leaving overlay
This is currently used for poll voting; after voting in a poll overlay, the status detail will update with the user's vote and the new vote count when they dismiss the overlay. As part of this change, the refresh_status_detail method now maintains the scroll position after refresh, rather than scrolling back to the top automatically
This commit is contained in:
parent
63bc11316b
commit
a937650894
2 changed files with 7 additions and 2 deletions
|
@ -662,6 +662,8 @@ class TUI(urwid.Frame):
|
|||
def close_overlay(self):
|
||||
self.body = self.overlay.bottom_w
|
||||
self.overlay = None
|
||||
if self.timeline:
|
||||
self.timeline.refresh_status_details()
|
||||
|
||||
# --- Keys -----------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -66,11 +66,12 @@ class Timeline(urwid.Columns):
|
|||
])
|
||||
|
||||
def wrap_status_details(self, status_details: "StatusDetails") -> urwid.Widget:
|
||||
"""Wrap StatusDetails widget with a scollbar and footer."""
|
||||
"""Wrap StatusDetails widget with a scrollbar and footer."""
|
||||
self.status_detail_scrollable = Scrollable(urwid.Padding(status_details, right=1))
|
||||
return urwid.Padding(
|
||||
urwid.Frame(
|
||||
body=ScrollBar(
|
||||
Scrollable(urwid.Padding(status_details, right=1)),
|
||||
self.status_detail_scrollable,
|
||||
thumb_char="\u2588",
|
||||
trough_char="\u2591",
|
||||
),
|
||||
|
@ -152,7 +153,9 @@ class Timeline(urwid.Columns):
|
|||
def refresh_status_details(self):
|
||||
"""Redraws the details of the focused status."""
|
||||
status = self.get_focused_status()
|
||||
pos = self.status_detail_scrollable.get_scrollpos()
|
||||
self.draw_status_details(status)
|
||||
self.status_detail_scrollable.set_scrollpos(pos)
|
||||
|
||||
def draw_status_details(self, status):
|
||||
self.status_details = StatusDetails(self, status)
|
||||
|
|
Loading…
Reference in a new issue