mirror of
https://github.com/ihabunek/toot.git
synced 2024-06-30 06:35:24 +00:00
Add links to help overlay
This commit is contained in:
parent
3a11e470fb
commit
7e04ad55c6
|
@ -18,6 +18,7 @@ PALETTE = [
|
||||||
# Functional
|
# Functional
|
||||||
('hashtag', 'light cyan,bold', ''),
|
('hashtag', 'light cyan,bold', ''),
|
||||||
('link', ',italics', ''),
|
('link', ',italics', ''),
|
||||||
|
('link_focused', ',italics', 'dark magenta'),
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
('bold', ',bold', ''),
|
('bold', ',bold', ''),
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
import urwid
|
import urwid
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
from toot import __version__
|
from toot import __version__
|
||||||
|
|
||||||
from .utils import highlight_keys
|
from .utils import highlight_keys
|
||||||
from .widgets import Button, EditBox
|
from .widgets import Button, EditBox, SelectableText
|
||||||
|
|
||||||
|
|
||||||
class StatusSource(urwid.ListBox):
|
class StatusSource(urwid.ListBox):
|
||||||
|
@ -80,10 +81,15 @@ class Help(urwid.Padding):
|
||||||
super().__init__(listbox, left=1, right=1)
|
super().__init__(listbox, left=1, right=1)
|
||||||
|
|
||||||
def generate_contents(self):
|
def generate_contents(self):
|
||||||
|
|
||||||
def h(text):
|
def h(text):
|
||||||
return highlight_keys(text, "cyan")
|
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.Text(("yellow_bold", "toot {}".format(__version__)))
|
||||||
yield urwid.Divider()
|
yield urwid.Divider()
|
||||||
yield urwid.Text(("bold", "General usage"))
|
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(" [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(" [U] - Show the status data in JSON as received from the server"))
|
||||||
yield urwid.Text(h(" [V] - Open status in default browser"))
|
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