mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-11-29 03:16:40 -05:00
Use micron engine for RRC rendering. Added support for links with request vars.
This commit is contained in:
parent
68c26a697b
commit
47afeb2d3b
2 changed files with 87 additions and 21 deletions
|
|
@ -60,7 +60,11 @@ def default_state(fg=None, bg=None):
|
|||
}
|
||||
return state
|
||||
|
||||
def markup_to_attrmaps(markup, url_delegate = None, fg_color=None, bg_color=None):
|
||||
def markup_to_attrmaps(markup, url_delegate = None, fg_color=None, bg_color=None, link_class=None):
|
||||
global LINK_CLASS
|
||||
if link_class: LINK_CLASS = link_class
|
||||
else: LINK_CLASS = LinkableText
|
||||
|
||||
global SELECTED_STYLES
|
||||
if nomadnet.NomadNetworkApp.get_shared_instance().config["textui"]["theme"] == nomadnet.ui.TextUI.THEME_DARK:
|
||||
SELECTED_STYLES = STYLES_DARK
|
||||
|
|
@ -290,7 +294,7 @@ def parse_line(line, state, url_delegate):
|
|||
for o in output:
|
||||
if isinstance(o, tuple):
|
||||
if url_delegate != None:
|
||||
tw = LinkableText(o, align=state["align"], delegate=url_delegate)
|
||||
tw = LINK_CLASS(o, align=state["align"], delegate=url_delegate)
|
||||
tw.in_columns = True
|
||||
else:
|
||||
tw = urwid.Text(o, align=state["align"])
|
||||
|
|
@ -343,7 +347,7 @@ def parse_line(line, state, url_delegate):
|
|||
|
||||
else:
|
||||
if url_delegate != None:
|
||||
text_widget = LinkableText(output, align=state["align"], delegate=url_delegate)
|
||||
text_widget = LINK_CLASS(output, align=state["align"], delegate=url_delegate)
|
||||
else:
|
||||
text_widget = urwid.Text(output, align=state["align"])
|
||||
|
||||
|
|
@ -973,4 +977,6 @@ class LinkableText(urwid.Text):
|
|||
return True
|
||||
|
||||
except Exception as e:
|
||||
return False
|
||||
return False
|
||||
|
||||
LINK_CLASS = LinkableText
|
||||
Loading…
Add table
Add a link
Reference in a new issue