mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-15 10:43:17 +02:00
Client: links and images open, line breaks like the web, directory notes setting
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
55ee8e2f23
commit
0513d94c6a
8 files changed
+134
-23
No files matched your search
+5
-4
@@ -55,8 +55,8 @@ class _FileLeaf:
|
||||
|
||||
|
||||
class _FiletreeNode:
|
||||
def __init__(self, TheApp: App, Root: str, RelativePath: str, OnNavigate: Callable[[str, str], None],
|
||||
OnOpenFile: Callable[[str, str], None], Depth: int):
|
||||
def __init__(self, TheApp: App, Root: str, RelativePath: str, OnNavigate: Callable[..., None],
|
||||
OnOpenFile: Callable[[str, str], None], Depth: int, Note: Optional[dict] = None):
|
||||
self.TheApp = TheApp
|
||||
self.Root = Root
|
||||
self.RelativePath = RelativePath
|
||||
@@ -68,7 +68,8 @@ class _FiletreeNode:
|
||||
self.FileLeaves: dict[str, _FileLeaf] = {}
|
||||
|
||||
Name = RelativePath.rsplit("/", 1)[-1] if RelativePath else Root
|
||||
self.NameLabel, self.NameContainer = _TreeLabel(Name, lambda: self.OnNavigate(self.Root, self.RelativePath))
|
||||
# OnNavigate(Root, Path, Note): the browser's OpenDirectory, which may open the .sv_ note too.
|
||||
self.NameLabel, self.NameContainer = _TreeLabel(Name, lambda: self.OnNavigate(self.Root, self.RelativePath, Note))
|
||||
self.Tile = ft.ExpansionTile(
|
||||
title=self.NameContainer,
|
||||
leading=ft.Icon(ft.Icons.STORAGE_OUTLINED if not RelativePath else ft.Icons.FOLDER_OUTLINED,
|
||||
@@ -98,7 +99,7 @@ class _FiletreeNode:
|
||||
ChildPath = JoinPath(self.RelativePath, Item.Name)
|
||||
if Item.IsDirectory:
|
||||
self.ChildNodes[Item.Name] = _FiletreeNode(self.TheApp, self.Root, ChildPath, self.OnNavigate,
|
||||
self.OnOpenFile, self.Depth + 1)
|
||||
self.OnOpenFile, self.Depth + 1, Item.Note)
|
||||
elif self.TheApp.Config.ShowFilesInTree:
|
||||
self.FileLeaves[Item.Name] = _FileLeaf(self.Root, ChildPath, Item.FileType, self.OnOpenFile, self.Depth + 1)
|
||||
# Directories first, then files, like the file list.
|
||||
|
||||
Reference in new issue
Block a user