mirror of
https://github.com/ihabunek/toot
synced 2025-01-11 17:13:58 +01:00
Implement [P]oll command to view/vote on poll
Note that this change also switches some key meanings: E -> X for View E[x]ception P -> E for Sav[e] Timeline to accomodate P for [P]oll
This commit is contained in:
parent
c2faa7e2b6
commit
d399eec6f5
@ -31,6 +31,7 @@ class Timeline(urwid.Columns):
|
|||||||
"media", # Display media attachments
|
"media", # Display media attachments
|
||||||
"menu", # Show a context menu
|
"menu", # Show a context menu
|
||||||
"next", # Fetch more statuses
|
"next", # Fetch more statuses
|
||||||
|
"poll", # Vote in a poll
|
||||||
"reblog", # Reblog status
|
"reblog", # Reblog status
|
||||||
"reply", # Compose a reply to a status
|
"reply", # Compose a reply to a status
|
||||||
"source", # Show status source
|
"source", # Show status source
|
||||||
@ -102,6 +103,8 @@ class Timeline(urwid.Columns):
|
|||||||
if not status:
|
if not status:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
poll = status.data.get("poll")
|
||||||
|
|
||||||
options = [
|
options = [
|
||||||
"[A]ccount" if not status.is_mine else "",
|
"[A]ccount" if not status.is_mine else "",
|
||||||
"[B]oost",
|
"[B]oost",
|
||||||
@ -112,6 +115,7 @@ class Timeline(urwid.Columns):
|
|||||||
"[T]hread" if not self.is_thread else "",
|
"[T]hread" if not self.is_thread else "",
|
||||||
"[L]inks",
|
"[L]inks",
|
||||||
"[R]eply",
|
"[R]eply",
|
||||||
|
"[P]oll" if poll and not poll["expired"] else "",
|
||||||
"So[u]rce",
|
"So[u]rce",
|
||||||
"[Z]oom",
|
"[Z]oom",
|
||||||
"Tra[n]slate" if self.can_translate else "",
|
"Tra[n]slate" if self.can_translate else "",
|
||||||
@ -240,7 +244,7 @@ class Timeline(urwid.Columns):
|
|||||||
self._emit("clear-screen")
|
self._emit("clear-screen")
|
||||||
return
|
return
|
||||||
|
|
||||||
if key in ("p", "P"):
|
if key in ("e", "E"):
|
||||||
self._emit("save", status)
|
self._emit("save", status)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -248,6 +252,12 @@ class Timeline(urwid.Columns):
|
|||||||
self._emit("zoom", self.status_details)
|
self._emit("zoom", self.status_details)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if key in ("p", "P"):
|
||||||
|
poll = status.data.get("poll")
|
||||||
|
if poll and not poll["expired"]:
|
||||||
|
self._emit("poll", status)
|
||||||
|
return
|
||||||
|
|
||||||
return super().keypress(size, key)
|
return super().keypress(size, key)
|
||||||
|
|
||||||
def append_status(self, status):
|
def append_status(self, status):
|
||||||
|
Loading…
Reference in New Issue
Block a user