mirror of
https://git.srhtnin.garden/sarah/SaraSuite.git
synced 2026-10-13 18:18:12 +02:00
Add SaraSort, listed under SaraSortd
Manifests can name a Parent program; it's listed (indented) right under it, in the window and in `list`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
08c9071b48
commit
6e4c571e38
7 files changed
+62
-2
No files matched your search
@@ -52,7 +52,8 @@ def Run(Arguments: list[str]) -> int:
|
||||
for Program in Programs.values():
|
||||
Current = GetStatus(Program)
|
||||
State = "update available" if Current.UpdateAvailable else "installed" if Current.Installed else "not installed"
|
||||
print(f"{Program.Name:12} {State:16} {Current.Error}")
|
||||
Name = f" {Program.Name}" if Program.Parent else Program.Name
|
||||
print(f"{Name:12} {State:16} {Current.Error}")
|
||||
return 0
|
||||
|
||||
Program = Programs.get(Args.Name.lower())
|
||||
|
||||
+13
-1
@@ -102,6 +102,7 @@ class Program:
|
||||
Name: str
|
||||
Description: str
|
||||
Folder: Path # the manifest's own folder
|
||||
Parent: str = "" # a program this one belongs to (e.g. SaraSort -> SaraSortd): listed indented under it
|
||||
Git: str = "" # e.g. "{GitHost}/SaraSortd"
|
||||
Branch: str = "" # empty = the repo's default branch
|
||||
Include: list[str] = field(default_factory=lambda: ["**"])
|
||||
@@ -192,6 +193,7 @@ def LoadProgram(Folder: Path) -> Program:
|
||||
Name=Data["Name"],
|
||||
Description=Data.get("Description", ""),
|
||||
Folder=Folder,
|
||||
Parent=Data.get("Parent", ""),
|
||||
Git=Source["Git"],
|
||||
Branch=Source.get("Branch", ""),
|
||||
Include=Source.get("Include", ["**"]),
|
||||
@@ -213,8 +215,18 @@ def LoadProgram(Folder: Path) -> Program:
|
||||
|
||||
|
||||
def LoadPrograms() -> list[Program]:
|
||||
return [
|
||||
"""Alphabetical, with each program's children (Parent = its Name) right
|
||||
after it. A child whose parent isn't there keeps its own place."""
|
||||
Loaded = [
|
||||
LoadProgram(Folder)
|
||||
for Folder in sorted(ManifestsDir.iterdir())
|
||||
if (Folder / "Manifest.toml").exists()
|
||||
]
|
||||
Names = {Current.Name for Current in Loaded}
|
||||
Ordered = []
|
||||
for Current in Loaded:
|
||||
if Current.Parent in Names:
|
||||
continue
|
||||
Ordered.append(Current)
|
||||
Ordered.extend(Child for Child in Loaded if Child.Parent == Current.Name)
|
||||
return Ordered
|
||||
@@ -8,6 +8,8 @@ from Core import ChipButtonStyle, Palette
|
||||
from Installer import RemovalPlan, Status
|
||||
from Manifests import Program
|
||||
|
||||
ChildIndent = 40
|
||||
|
||||
|
||||
class ProgramCard(ft.Container):
|
||||
def __init__(
|
||||
@@ -70,6 +72,8 @@ class ProgramCard(ft.Container):
|
||||
border=ft.Border.all(1, Palette.Surface1),
|
||||
border_radius=8,
|
||||
padding=16,
|
||||
# A program that belongs to another (Parent) sits indented under it.
|
||||
margin=ft.Margin.only(left=ChildIndent) if Program.Parent else None,
|
||||
)
|
||||
|
||||
def _SetChip(self, Text: str, Color: str) -> None:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# Kept in sync between SaraSuite/Programs/SaraSort/ and SaraSort/Packaging/SaraSuite/.
|
||||
Name = "SaraSort"
|
||||
Parent = "SaraSortd" # a GUI for SaraSortd, listed under it
|
||||
Description = "A GUI for configuring SaraSortd: a flowchart of what goes where, its service and logs, configs and templates."
|
||||
|
||||
[Source]
|
||||
Git = "{GitHost}/SaraSort"
|
||||
Include = ["*.py", "requirements.txt", "assets/**"]
|
||||
Exclude = ["Packaging"]
|
||||
|
||||
[Python]
|
||||
RequirementsFile = "requirements.txt"
|
||||
|
||||
[[Templates]]
|
||||
Source = "Launch.sh"
|
||||
Target = "{AppDir}/Packaging/Launch.sh"
|
||||
Executable = true
|
||||
|
||||
[[Templates]]
|
||||
Source = "SaraSort.desktop"
|
||||
Target = "{ApplicationsDir}/SaraSort.desktop"
|
||||
|
||||
# Made by SaraSort itself: Config.toml, Layout.toml, Templates/.
|
||||
[[Leftovers]]
|
||||
Path = "{ConfigDir}"
|
||||
Kind = "Config"
|
||||
Note = "SaraSort's settings, flowchart layout and your templates"
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Desktop-entry launcher: resolves the venv relative to this script rather
|
||||
# than the caller's cwd, since .desktop Exec= lines are invoked with no
|
||||
# guaranteed working directory.
|
||||
cd "$(dirname "$(readlink -f "$0")")/.." || exit 1
|
||||
exec .venv/bin/python Main.py "$@"
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=SaraSort
|
||||
Comment=Configure SaraSortd, the file sorting daemon
|
||||
Exec={AppDir}/Packaging/Launch.sh
|
||||
Icon={AppDir}/assets/Icon.png
|
||||
Terminal=false
|
||||
Categories=Utility;
|
||||
StartupNotify=true
|
||||
@@ -105,6 +105,7 @@ Targets, templates and `Set` values can use `{Variables}`: `Name`, `GitHost`, `H
|
||||
```toml
|
||||
Name = "Example"
|
||||
Description = "Shown on the program's card."
|
||||
Parent = "SaraSortd" # optional: listed (indented) under that program
|
||||
RestartUnits = ["xdg-desktop-portal.service"] # try-restarted after install/update/remove
|
||||
|
||||
[Version] # optional, shown on the card
|
||||
|
||||
Reference in new issue
Block a user