Focus status after posting
This commit is contained in:
parent
4deccee754
commit
5213eb1835
|
@ -280,7 +280,11 @@ class TUI(urwid.Frame):
|
||||||
data = api.post_status(self.app, self.user, content,
|
data = api.post_status(self.app, self.user, content,
|
||||||
spoiler_text=warning, visibility=visibility)
|
spoiler_text=warning, visibility=visibility)
|
||||||
status = Status(data, self.app.instance)
|
status = Status(data, self.app.instance)
|
||||||
|
|
||||||
|
# TODO: instead of this, fetch new items from the timeline?
|
||||||
self.timeline.prepend_status(status)
|
self.timeline.prepend_status(status)
|
||||||
|
self.timeline.focus_status(status)
|
||||||
|
|
||||||
self.footer.set_message("Status posted {} \\o/".format(status.id))
|
self.footer.set_message("Status posted {} \\o/".format(status.id))
|
||||||
self.close_overlay()
|
self.close_overlay()
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,10 @@ class Timeline(urwid.Columns):
|
||||||
return n
|
return n
|
||||||
raise ValueError("Status with ID {} not found".format(id))
|
raise ValueError("Status with ID {} not found".format(id))
|
||||||
|
|
||||||
|
def focus_status(self, status):
|
||||||
|
index = self.get_status_index(status.id)
|
||||||
|
self.status_list.body.set_focus(index)
|
||||||
|
|
||||||
def update_status(self, status):
|
def update_status(self, status):
|
||||||
"""Overwrite status in list with the new instance and redraw."""
|
"""Overwrite status in list with the new instance and redraw."""
|
||||||
index = self.get_status_index(status.id)
|
index = self.get_status_index(status.id)
|
||||||
|
|
Loading…
Reference in New Issue