mirror of
https://git.srhtnin.garden/sarah/SaraSort.git
synced 2026-10-14 18:48:11 +02:00
Directory configs outside their directories (SaraSortd 7.2)
SaraSort finds configs and history files where SaraSortd 7.2 keeps them (DirConfDir, [DirConfs]), and Settings > SaraSortd moves the existing ones between "inside each directory" and one folder. Imports keep [DirConfs] entries with moved directories, and Warnings flag a config folder inside an input or a SaraSortd older than 7.2. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
edc2832a0f
commit
28252e3101
5 files changed
+177
-20
No files matched your search
+12
-7
@@ -308,12 +308,17 @@ class ConfigPage(ft.Row):
|
||||
self._OpenCurrent()
|
||||
self.update()
|
||||
|
||||
def _KindOf(self, ConfPath: Path) -> str:
|
||||
def _EntryOf(self, ConfPath: Path) -> tuple[str, str]:
|
||||
"""(Kind, directory) of a config in the list. The directory is what
|
||||
the list shows, since a config can live outside its directory."""
|
||||
for _, Items in self._Entries():
|
||||
for _, ItemPath, Kind in Items:
|
||||
for Label, ItemPath, Kind in Items:
|
||||
if ItemPath == ConfPath:
|
||||
return Kind
|
||||
return "Global"
|
||||
return Kind, Label
|
||||
return "Global", ""
|
||||
|
||||
def _KindOf(self, ConfPath: Path) -> str:
|
||||
return self._EntryOf(ConfPath)[0]
|
||||
|
||||
def _OpenCurrent(self) -> None:
|
||||
ConfPath = self.Current
|
||||
@@ -329,12 +334,12 @@ class ConfigPage(ft.Row):
|
||||
self.Mode = "Raw"
|
||||
self.App.Notify(f"{ConfPath.name} isn't valid TOML ({Error}); showing it raw.", "warning")
|
||||
|
||||
Kind = self._KindOf(ConfPath)
|
||||
Kind, DirPath = self._EntryOf(ConfPath)
|
||||
TheSetup = self.TheSetup
|
||||
OutputStyle = Kind in ("Out", "OutTemplate") or (
|
||||
Kind == "In" and TheSetup.SharedConfName() and ConfPath.parent.as_posix() in TheSetup.Outputs
|
||||
Kind == "In" and DirPath in TheSetup.Outputs and TheSetup.SharesConf(DirPath)
|
||||
)
|
||||
OutputPath = ConfPath.parent.as_posix() if Kind in ("In", "Out") else "/Output"
|
||||
OutputPath = DirPath if Kind in ("In", "Out") else "/Output"
|
||||
|
||||
FormButton = ChipButton("Form", lambda e: self._SetMode("Form"))
|
||||
RawButton = ChipButton("Raw", lambda e: self._SetMode("Raw"))
|
||||
|
||||
Reference in new issue
Block a user