nomadnet
Advanced tools
| Metadata-Version: 2.4 | ||
| Name: nomadnet | ||
| Version: 0.9.4 | ||
| Version: 0.9.5 | ||
| Summary: Communicate Freely | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/markqvist/nomadnet |
@@ -1,1 +0,1 @@ | ||
| __version__ = "0.9.4" | ||
| __version__ = "0.9.5" |
@@ -1458,2 +1458,32 @@ import RNS | ||
| >Partials | ||
| You can include partials in pages, which will load asynchronously once the page itself has loaded. | ||
| `Faaa | ||
| `= | ||
| `{f64a846313b874ee4a357040807f8c77:/page/partial_1.mu} | ||
| `= | ||
| `` | ||
| It's also possible to set an auto-refresh interval for partials. Omit or set to 0 to disable. The following partial will update every 10 seconds. | ||
| `Faaa | ||
| `= | ||
| `{f64a846313b874ee4a357040807f8c77:/page/refreshing_partial.mu`10} | ||
| `= | ||
| `` | ||
| You can include field values and variables in partial updates, and by setting the `!pid`! variable, you can create links that update one or more specific partials. | ||
| `Faaa | ||
| `= | ||
| Name: `B444`<user_name`>`b | ||
| `F38a`[Say hello`p:32]`f | ||
| `{f64a846313b874e84a357039807f8c77:/page/hello_partial.mu`0`pid=32|user_name} | ||
| `= | ||
| `` | ||
| >Literals | ||
@@ -1460,0 +1490,0 @@ |
@@ -5,2 +5,3 @@ import nomadnet | ||
| import time | ||
| import RNS | ||
| from urwid.util import is_mouse_press | ||
@@ -89,2 +90,50 @@ from urwid.text_layout import calc_coords | ||
| def parse_partial(line): | ||
| try: | ||
| endpos = line.find("}") | ||
| if endpos == -1: return None | ||
| else: | ||
| partial_data = line[0:endpos] | ||
| partial_id = None | ||
| partial_components = partial_data.split("`") | ||
| if len(partial_components) == 1: | ||
| partial_url = partial_components[0] | ||
| partial_refresh = None | ||
| partial_fields = "" | ||
| elif len(partial_components) == 2: | ||
| partial_url = partial_components[0] | ||
| partial_refresh = float(partial_components[1]) | ||
| partial_fields = "" | ||
| elif len(partial_components) == 3: | ||
| partial_url = partial_components[0] | ||
| partial_refresh = float(partial_components[1]) | ||
| partial_fields = partial_components[2] | ||
| else: | ||
| partial_url = "" | ||
| partial_fields = "" | ||
| partial_refresh = None | ||
| if partial_refresh != None and partial_refresh < 1: partial_refresh = None | ||
| pf = partial_fields.split("|") | ||
| if len(pf) > 0: | ||
| partial_fields = pf | ||
| for f in pf: | ||
| if f.startswith("pid="): | ||
| pcs = f.split("=") | ||
| partial_id = pcs[1] | ||
| if len(partial_url): | ||
| pile = urwid.Pile([urwid.Text(f"⧖")]) | ||
| partial_descriptor = "|".join(partial_components) | ||
| pile.partial_id = partial_id | ||
| pile.partial_hash = RNS.hexrep(RNS.Identity.full_hash(partial_descriptor.encode("utf-8")), delimit=False) | ||
| pile.partial_url = partial_url | ||
| pile.partial_fields = partial_fields | ||
| pile.partial_refresh = partial_refresh | ||
| return [pile] | ||
| except Exception as e: return None | ||
| def parse_line(line, state, url_delegate): | ||
@@ -111,2 +160,6 @@ pre_escape = False | ||
| # Check for partials | ||
| elif line.startswith("`{"): | ||
| return parse_partial(line[2:]) | ||
| # Check for section heading reset | ||
@@ -289,10 +342,7 @@ elif first_char == "<": | ||
| val = int(color[1:2]) | ||
| if val < 25: | ||
| result = "black" | ||
| elif val < 50: | ||
| result = "dark gray" | ||
| elif val < 75: | ||
| result = "light gray" | ||
| else: | ||
| result = "white" | ||
| if val < 25: result = "black" | ||
| elif val < 50: result = "dark gray" | ||
| elif val < 75: result = "light gray" | ||
| else: result = "white" | ||
| else: | ||
@@ -305,10 +355,6 @@ r = int(color[0], 16) | ||
| val = int(color[0], 16)*6 | ||
| if val < 12: | ||
| result = "black" | ||
| elif val < 50: | ||
| result = "dark gray" | ||
| elif val < 80: | ||
| result = "light gray" | ||
| else: | ||
| result = "white" | ||
| if val < 12: result = "black" | ||
| elif val < 50: result = "dark gray" | ||
| elif val < 80: result = "light gray" | ||
| else: result = "white" | ||
@@ -318,49 +364,31 @@ else: | ||
| if r > g: | ||
| if r > t: | ||
| result = "light magenta" | ||
| else: | ||
| result = "dark magenta" | ||
| if r > t: result = "light magenta" | ||
| else: result = "dark magenta" | ||
| else: | ||
| if g > t: | ||
| result = "light green" | ||
| else: | ||
| result = "dark green" | ||
| if g > t: result = "light green" | ||
| else: result = "dark green" | ||
| if b == g: | ||
| if b > r: | ||
| if b > t: | ||
| result = "light cyan" | ||
| else: | ||
| result = "dark cyan" | ||
| if b > t: result = "light cyan" | ||
| else: result = "dark cyan" | ||
| else: | ||
| if r > t: | ||
| result = "light red" | ||
| else: | ||
| result = "dark red" | ||
| if r > t: result = "light red" | ||
| else: result = "dark red" | ||
| if g == r: | ||
| if g > b: | ||
| if g > t: | ||
| result = "yellow" | ||
| else: | ||
| result = "brown" | ||
| if g > t: result = "yellow" | ||
| else: result = "brown" | ||
| else: | ||
| if b > t: | ||
| result = "light blue" | ||
| else: | ||
| result = "dark blue" | ||
| if b > t: result = "light blue" | ||
| else: result = "dark blue" | ||
| if r > g and r > b: | ||
| if r > t: | ||
| result = "light red" | ||
| else: | ||
| result = "dark red" | ||
| if r > t: result = "light red" | ||
| else: result = "dark red" | ||
| if g > r and g > b: | ||
| if g > t: | ||
| result = "light green" | ||
| else: | ||
| result = "dark green" | ||
| if g > t: result = "light green" | ||
| else: result = "dark green" | ||
| if b > g and b > r: | ||
| if b > t: | ||
| result = "light blue" | ||
| else: | ||
| result = "dark blue" | ||
| if b > t: result = "light blue" | ||
| else: result = "dark blue" | ||
@@ -431,8 +459,5 @@ except Exception as e: | ||
| format_string = "" | ||
| if bold: | ||
| format_string += ",bold" | ||
| if underline: | ||
| format_string += ",underline" | ||
| if italic: | ||
| format_string += ",italics" | ||
| if bold: format_string += ",bold" | ||
| if underline: format_string += ",underline" | ||
| if italic: format_string += ",italics" | ||
@@ -498,9 +523,6 @@ name = "micron_"+fg+"_"+bg+"_"+format_string | ||
| if state["align"] != "center": state["align"] = "center" | ||
| # else: state["align"] = state["default_align"] | ||
| elif c == "l": | ||
| if state["align"] != "left": state["align"] = "left" | ||
| # else: state["align"] = state["default_align"] | ||
| elif c == "r": | ||
| if state["align"] != "right": state["align"] = "right" | ||
| # else: state["align"] = state["default_align"] | ||
| elif c == "a": | ||
@@ -662,6 +684,4 @@ state["align"] = state["default_align"] | ||
| else: | ||
| output.append(make_part(state, link_label)) | ||
| output.append(make_part(state, link_label)) | ||
| mode = "text" | ||
@@ -668,0 +688,0 @@ if len(part) > 0: |
+5
-0
| import re | ||
| import unicodedata | ||
| invalid_rendering = ["🕵️", "☝"] | ||
| def strip_modifiers(text): | ||
@@ -22,2 +24,5 @@ def process_characters(text): | ||
| return ''.join(result) | ||
| for char in invalid_rendering: | ||
| text = text.replace(char, " ") | ||
@@ -24,0 +29,0 @@ stripped = process_characters(text) |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: nomadnet | ||
| Version: 0.9.4 | ||
| Version: 0.9.5 | ||
| Summary: Communicate Freely | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/markqvist/nomadnet |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
1151663
1.22%13327
1.83%