mirror of
https://github.com/ihabunek/toot
synced 2024-12-23 07:27:12 +01:00
Add links to help overlay
This commit is contained in:
parent
3a11e470fb
commit
7e04ad55c6
@ -18,6 +18,7 @@ PALETTE = [
|
||||
# Functional
|
||||
('hashtag', 'light cyan,bold', ''),
|
||||
('link', ',italics', ''),
|
||||
('link_focused', ',italics', 'dark magenta'),
|
||||
|
||||
# Colors
|
||||
('bold', ',bold', ''),
|
||||
|
@ -1,11 +1,12 @@
|
||||
import json
|
||||
import traceback
|
||||
import urwid
|
||||
import webbrowser
|
||||
|
||||
from toot import __version__
|
||||
|
||||
from .utils import highlight_keys
|
||||
from .widgets import Button, EditBox
|
||||
from .widgets import Button, EditBox, SelectableText
|
||||
|
||||
|
||||
class StatusSource(urwid.ListBox):
|
||||
@ -80,10 +81,15 @@ class Help(urwid.Padding):
|
||||
super().__init__(listbox, left=1, right=1)
|
||||
|
||||
def generate_contents(self):
|
||||
|
||||
def h(text):
|
||||
return highlight_keys(text, "cyan")
|
||||
|
||||
def link(text, url):
|
||||
attr_map = {"link": "link_focused"}
|
||||
text = SelectableText([text, ("link", url)])
|
||||
urwid.connect_signal(text, "click", lambda t: webbrowser.open(url))
|
||||
return urwid.AttrMap(text, "", attr_map)
|
||||
|
||||
yield urwid.Text(("yellow_bold", "toot {}".format(__version__)))
|
||||
yield urwid.Divider()
|
||||
yield urwid.Text(("bold", "General usage"))
|
||||
@ -111,3 +117,8 @@ class Help(urwid.Padding):
|
||||
yield urwid.Text(h(" [T] - Show status thread (replies)"))
|
||||
yield urwid.Text(h(" [U] - Show the status data in JSON as received from the server"))
|
||||
yield urwid.Text(h(" [V] - Open status in default browser"))
|
||||
yield urwid.Divider()
|
||||
yield urwid.Text(("bold", "Links"))
|
||||
yield urwid.Divider()
|
||||
yield link("Documentation: ", "https://toot.readthedocs.io/")
|
||||
yield link("Project home: ", "https://github.com/ihabunek/toot/")
|
||||
|
Loading…
Reference in New Issue
Block a user