Settings dialog, per-program install defaults, Options after install; Update only when needed

This commit is contained in:
sarah committed 2026-10-07 21:47:15 +02:00
1 parent 7018d57dbc
commit 08c9071b48
8 files changed
+360 -30

No files matched your search

+13 -3
View File
@@ -16,6 +16,7 @@ class ProgramCard(ft.Container):
OnInstall: Callable[["ProgramCard"], None],
OnUpdate: Callable[["ProgramCard"], None],
OnRemove: Callable[["ProgramCard"], None],
OnOptions: Callable[["ProgramCard"], None],
) -> None:
self.Program = Program
self.CurrentStatus: Optional[Status] = None
@@ -37,6 +38,9 @@ class ProgramCard(ft.Container):
self.UpdateButton = ft.OutlinedButton(
content="Update", style=ChipButtonStyle(), visible=False, on_click=lambda e: OnUpdate(self),
)
self.OptionsButton = ft.OutlinedButton(
content="Options", style=ChipButtonStyle(), visible=False, on_click=lambda e: OnOptions(self),
)
self.RemoveButton = ft.OutlinedButton(
content="Remove", style=ChipButtonStyle(Palette.Red), visible=False, on_click=lambda e: OnRemove(self),
)
@@ -54,6 +58,7 @@ class ProgramCard(ft.Container):
self.Spinner,
self.InstallButton,
self.UpdateButton,
self.OptionsButton,
self.RemoveButton,
],
),
@@ -102,9 +107,14 @@ class ProgramCard(ft.Container):
self.InstallButton.visible = not Current.Installed
self.InstallButton.disabled = Busy or not Current.LatestCommit
self.UpdateButton.visible = Current.Installed
self.UpdateButton.disabled = Busy or not Current.UpdateAvailable or not Current.LatestCommit
# Only there when there's something to update (or repair).
self.UpdateButton.visible = Current.UpdateAvailable
self.UpdateButton.disabled = Busy or not Current.LatestCommit
self.UpdateButton.content = "Repair" if Current.Broken else "Update"
# Change options (e.g. the file picker) after installing. Needs the
# git host, since it reapplies the installed commit.
self.OptionsButton.visible = Current.Installed and bool(self.Program.Options)
self.OptionsButton.disabled = Busy or not Current.LatestCommit
# Not installed but configs/runtime files were kept: still removable.
self.RemoveButton.visible = Current.Installed or bool(Leftovers.Items)
self.RemoveButton.content = "Remove" if Current.Installed else "Clean up"
@@ -114,6 +124,6 @@ class ProgramCard(ft.Container):
def SetBusy(self, Busy: bool, Working: bool = False) -> None:
"""Busy greys out the buttons (only one operation runs at a time);
Working also shows this card's spinner."""
for Button in (self.InstallButton, self.UpdateButton, self.RemoveButton):
for Button in (self.InstallButton, self.UpdateButton, self.OptionsButton, self.RemoveButton):
Button.disabled = Busy
self.Spinner.visible = Working