Text
Text shows the latest markdown of its source.
import dachshund
from dachshund.widgets import Text
with dachshund.row():
dachshund.add(Text("changelog", title="Release Notes"))
dachshund.emit("changelog", value="**v1.2** fixed the thing.")
dachshund.widgets.text.text.Text
dataclass
Text(name, *, source='', title=None, actions=list(), action_args=dict(), persist=False, y='value')
Bases: PersistableWidget
The latest markdown of its source, rendered to sanitized HTML.
Raw HTML in the markdown is escaped, and only http, https and mailto
links are kept.
Example
with dachshund.row():
dachshund.add(Text("changelog", title="Release Notes"))
dachshund.emit("changelog", value="**v1.2** fixed the thing.")
Options
y(str) - The field read. Defaults to"value".persist(bool) - Keeps the latest text across restarts. Needs the dashboard'sstorage. Defaults toFalse.
y
class-attribute
instance-attribute
y = 'value'
kept
class-attribute
instance-attribute
kept = field(default=None, init=False, repr=False, compare=False)
type
class-attribute
type = 'text'
op
class-attribute
op = 'replace'
script
class-attribute
script = Path(__file__).parent / 'text.js'
style
class-attribute
style = Path(__file__).parent / 'text.css'
render
render(events)
The most recent markdown of y, rendered to HTML.
A persisting widget reads its own kept text instead, since that covers more than whatever events are still around to re-read.
Source code in dachshund/widgets/text/text.py
45 46 47 48 49 50 51 52 53 54 55 56 | |
accumulate
accumulate(event)
Keep the latest markdown of y.
Source code in dachshund/widgets/text/text.py
58 59 60 61 62 63 64 65 | |
snapshot
snapshot()
The kept text.
Source code in dachshund/widgets/text/text.py
67 68 69 | |
restore
restore(data)
Pick up where the last persisted snapshot left off.
Source code in dachshund/widgets/text/text.py
71 72 73 | |