mirror of
https://github.com/ihabunek/toot.git
synced 2025-05-18 00:58:30 -04:00
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):
|
def _thread(timeline, status):
|
||||||
self.show_thread(status)
|
self.show_thread(status)
|
||||||
|
|
||||||
def _save(timeline, status):
|
def _toggle_save(timeline, status):
|
||||||
if not timeline.name.startswith("#"):
|
if not timeline.name.startswith("#"):
|
||||||
return
|
return
|
||||||
hashtag = timeline.name[1:]
|
hashtag = timeline.name[1:]
|
||||||
assert isinstance(local, bool), local
|
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)
|
config.save_config(self.config)
|
||||||
|
|
||||||
timeline = Timeline(name, statuses)
|
timeline = Timeline(name, statuses)
|
||||||
@ -227,7 +231,7 @@ class TUI(urwid.Frame):
|
|||||||
urwid.connect_signal(timeline, "next", _next)
|
urwid.connect_signal(timeline, "next", _next)
|
||||||
urwid.connect_signal(timeline, "close", _close)
|
urwid.connect_signal(timeline, "close", _close)
|
||||||
urwid.connect_signal(timeline, "thread", _thread)
|
urwid.connect_signal(timeline, "thread", _thread)
|
||||||
urwid.connect_signal(timeline, "save", _save)
|
urwid.connect_signal(timeline, "save", _toggle_save)
|
||||||
|
|
||||||
return timeline
|
return timeline
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class Help(urwid.Padding):
|
|||||||
yield urwid.Divider()
|
yield urwid.Divider()
|
||||||
yield urwid.Text(h(" [Q] - quit toot"))
|
yield urwid.Text(h(" [Q] - quit toot"))
|
||||||
yield urwid.Text(h(" [G] - go to - switch timelines"))
|
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.Text(h(" [H] - show this help"))
|
||||||
yield urwid.Divider()
|
yield urwid.Divider()
|
||||||
yield urwid.Text(("bold", "Status keys"))
|
yield urwid.Text(("bold", "Status keys"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user