Make [P]in action toggle save of hashtag timeline
If currently viewed timeline is saved, [P] unsaves it.
This commit is contained in:
parent
3e11153640
commit
69f110b474
|
@ -213,12 +213,16 @@ class TUI(urwid.Frame):
|
|||
def _thread(timeline, status):
|
||||
self.show_thread(status)
|
||||
|
||||
def _save(timeline, status):
|
||||
def _toggle_save(timeline, status):
|
||||
if not timeline.name.startswith("#"):
|
||||
return
|
||||
hashtag = timeline.name[1:]
|
||||
assert isinstance(local, bool), local
|
||||
self.config.setdefault("timelines", {})[hashtag] = {"local": local}
|
||||
timelines = self.config.setdefault("timelines", {})
|
||||
if hashtag in timelines:
|
||||
del timelines[hashtag]
|
||||
else:
|
||||
timelines[hashtag] = {"local": local}
|
||||
config.save_config(self.config)
|
||||
|
||||
timeline = Timeline(name, statuses)
|
||||
|
@ -227,7 +231,7 @@ class TUI(urwid.Frame):
|
|||
urwid.connect_signal(timeline, "next", _next)
|
||||
urwid.connect_signal(timeline, "close", _close)
|
||||
urwid.connect_signal(timeline, "thread", _thread)
|
||||
urwid.connect_signal(timeline, "save", _save)
|
||||
urwid.connect_signal(timeline, "save", _toggle_save)
|
||||
|
||||
return timeline
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class Help(urwid.Padding):
|
|||
yield urwid.Divider()
|
||||
yield urwid.Text(h(" [Q] - quit toot"))
|
||||
yield urwid.Text(h(" [G] - go to - switch timelines"))
|
||||
yield urwid.Text(h(" [P] - save (pin) current timeline"))
|
||||
yield urwid.Text(h(" [P] - save/unsave (pin) current timeline"))
|
||||
yield urwid.Text(h(" [H] - show this help"))
|
||||
yield urwid.Divider()
|
||||
yield urwid.Text(("bold", "Status keys"))
|
||||
|
|
Loading…
Reference in New Issue