mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-14 18:38:11 +02:00
New/Upload buttons with the file tree, above or below
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6750f7927f
commit
0450fee42b
6 files changed
+27
-100
No files matched your search
+11
-4
@@ -124,15 +124,22 @@ class Filetree(ft.Container):
|
||||
self.PathNodes: list[_FiletreeNode] = [] # the directories you're in, marked
|
||||
self.TreeList = ft.ListView(expand=True)
|
||||
self.SourceLabel = ft.Text("", size=12, color=Palette.Overlay0, overflow=ft.TextOverflow.ELLIPSIS, max_lines=1)
|
||||
self.Header = ft.Container(self.SourceLabel, padding=ft.Padding.only(left=12, right=12, top=10, bottom=4))
|
||||
self.Layout = ft.Column([self.Header, self.TreeList], spacing=0, expand=True)
|
||||
super().__init__(
|
||||
content=ft.Column([
|
||||
ft.Container(self.SourceLabel, padding=ft.Padding.only(left=12, right=12, top=10, bottom=4)),
|
||||
self.TreeList,
|
||||
], spacing=0, expand=True),
|
||||
content=self.Layout,
|
||||
width=TheApp.Config.SidebarWidth,
|
||||
bgcolor=Palette.Mantle,
|
||||
)
|
||||
|
||||
def SetEntryButtons(self, Buttons: ft.Control, AtTop: bool, Update: bool = True) -> None:
|
||||
"""New File / New Directory / Upload, above or below the tree (Config.NewEntryButtonsAtTop)."""
|
||||
Divider = ft.Divider(height=1, color=Palette.Surface1)
|
||||
self.Layout.controls = ([self.Header, Buttons, Divider, self.TreeList] if AtTop
|
||||
else [self.Header, self.TreeList, Divider, Buttons])
|
||||
if Update:
|
||||
self.update()
|
||||
|
||||
def Reload(self) -> None:
|
||||
"""Rebuilds the tree from the current source (after connecting,
|
||||
logging in or out, or a change that moved things around)."""
|
||||
|
||||
Reference in new issue
Block a user