Browse Source

Add Tkinter prerequisite and handle it

pull/438/head^2
JT 10 months ago
parent
commit
19ec7e0612
  1. 1
      CHANGELOG.md
  2. 21
      StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs
  3. 30
      StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs
  4. 3
      StabilityMatrix.Core/Models/PackagePrerequisite.cs
  5. 8
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs
  6. 2
      StabilityMatrix.Core/Models/Packages/OneTrainer.cs

1
CHANGELOG.md

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
- Fixed failing InvokeAI install on macOS due to missing nodejs
- Increased timeout on Recommended Models call to prevent potential timeout errors on slow connections
- Fixed SynchronizationLockException when saving settings
- Fixed missing tkinter dependency for OneTrainer on Windows
## v2.8.0
### Added

21
StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

@ -23,14 +23,14 @@ namespace StabilityMatrix.Avalonia.Helpers;
[SupportedOSPlatform("macos")]
[SupportedOSPlatform("linux")]
public class UnixPrerequisiteHelper : IPrerequisiteHelper
public class UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;
private DirectoryPath HomeDir => settingsManager.LibraryDir;
private DirectoryPath AssetsDir => HomeDir.JoinDir("Assets");
@ -46,17 +46,6 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
// Cached store of whether or not git is installed
private bool? isGitInstalled;
public UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}
private async Task<bool> CheckIsGitInstalled()
{
var result = await ProcessRunner.RunBashCommand("git --version");

30
StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs

@ -20,14 +20,16 @@ using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.Helpers;
[SupportedOSPlatform("windows")]
public class WindowsPrerequisiteHelper : IPrerequisiteHelper
public class WindowsPrerequisiteHelper(
IGitHubClient gitHubClient,
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IGitHubClient gitHubClient;
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;
private readonly IGitHubClient gitHubClient = gitHubClient;
private const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe";
private const string TkinterDownloadUrl =
@ -62,19 +64,6 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper
public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin");
public bool IsPythonInstalled => File.Exists(PythonDllPath);
public WindowsPrerequisiteHelper(
IGitHubClient gitHubClient,
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.gitHubClient = gitHubClient;
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}
public async Task RunGit(
ProcessArgs args,
Action<ProcessOutput>? onProcessOutput,
@ -166,6 +155,11 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper
{
await InstallNodeIfNecessary(progress);
}
if (prerequisites.Contains(PackagePrerequisite.Tkinter))
{
await InstallTkinterIfNecessary(progress);
}
}
public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = null)

3
StabilityMatrix.Core/Models/PackagePrerequisite.cs

@ -7,5 +7,6 @@ public enum PackagePrerequisite
Git,
Node,
Dotnet7,
Dotnet8
Dotnet8,
Tkinter,
}

8
StabilityMatrix.Core/Models/Packages/KohyaSs.cs

@ -50,6 +50,8 @@ public class KohyaSs(
public override IEnumerable<TorchVersion> AvailableTorchVersions => [TorchVersion.Cuda];
public override IEnumerable<SharedFolderMethod> AvailableSharedFolderMethods =>
new[] { SharedFolderMethod.None };
public override IEnumerable<PackagePrerequisite> Prerequisites =>
base.Prerequisites.Concat([PackagePrerequisite.Tkinter]);
public override List<LaunchOptionDefinition> LaunchOptions =>
[
@ -114,12 +116,6 @@ public class KohyaSs(
Action<ProcessOutput>? onConsoleOutput = null
)
{
if (Compat.IsWindows)
{
progress?.Report(new ProgressReport(-1f, "Installing prerequisites...", isIndeterminate: true));
await PrerequisiteHelper.InstallTkinterIfNecessary(progress).ConfigureAwait(false);
}
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));

2
StabilityMatrix.Core/Models/Packages/OneTrainer.cs

@ -41,6 +41,8 @@ public class OneTrainer(
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Nightmare;
public override bool OfferInOneClickInstaller => false;
public override bool ShouldIgnoreReleases => true;
public override IEnumerable<PackagePrerequisite> Prerequisites =>
base.Prerequisites.Concat([PackagePrerequisite.Tkinter]);
public override async Task InstallPackage(
string installLocation,

Loading…
Cancel
Save