mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-14 18:38:11 +02:00
Client: variables resolved in the live editor and reading view
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
eec8fd4b79
commit
ee904540c6
7 files changed
+169
-16
No files matched your search
@@ -169,9 +169,11 @@ def PropertiesView(Found: Parsed, FontSize: int, MakeMarkdown: Callable[[str], f
|
||||
|
||||
|
||||
def WithCheckboxes(Text: str, FirstLine: int, MakeMarkdown: Callable[[str], ft.Control],
|
||||
Toggle: OnToggle, FontSize: int) -> list[ft.Control]:
|
||||
Toggle: OnToggle, FontSize: int, LineMap: Optional[list[Optional[int]]] = None) -> list[ft.Control]:
|
||||
"""Markdown with its task lines as real checkboxes: the lines between
|
||||
them render as usual. FirstLine is where Text starts in the note."""
|
||||
them render as usual. FirstLine is where Text starts in the note; LineMap
|
||||
(Variables.Substitute) says which of its lines each shown line is, None
|
||||
for one from a variable's result (its checkbox can't be ticked)."""
|
||||
Controls: list[ft.Control] = []
|
||||
Pending: list[str] = []
|
||||
InFence = False
|
||||
@@ -190,8 +192,9 @@ def WithCheckboxes(Text: str, FirstLine: int, MakeMarkdown: Callable[[str], ft.C
|
||||
continue
|
||||
Flush()
|
||||
Indent = len(Task.group(1)) - len(Task.group(1).lstrip())
|
||||
SourceLine = Offset if LineMap is None else LineMap[Offset]
|
||||
Controls.append(ft.Row(
|
||||
[_Checkbox(Task.group(2) != " ", FirstLine + Offset, Toggle),
|
||||
[_Checkbox(Task.group(2) != " ", FirstLine + (SourceLine or 0), Toggle if SourceLine is not None else None),
|
||||
ft.Container(MakeMarkdown(Line[Task.end():].strip() or " "), expand=True)],
|
||||
spacing=4,
|
||||
vertical_alignment=ft.CrossAxisAlignment.CENTER,
|
||||
|
||||
Reference in new issue
Block a user