Browse Source

Merge pull request #183 from ionite34/fixes

pull/55/head
Ionite 1 year ago committed by GitHub
parent
commit
72f7f418cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      CHANGELOG.md
  2. 14
      StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs
  3. 10
      StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs
  4. 8
      StabilityMatrix.Core/Services/SettingsManager.cs

11
CHANGELOG.md

@ -10,8 +10,19 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
- New installable Package - [VoltaML](https://github.com/VoltaML/voltaML-fast-stable-diffusion) - New installable Package - [VoltaML](https://github.com/VoltaML/voltaML-fast-stable-diffusion)
- New installable Package - [InvokeAI](https://github.com/invoke-ai/InvokeAI) - New installable Package - [InvokeAI](https://github.com/invoke-ai/InvokeAI)
- Launch button can now support alternate commands / modes - currently only for InvokeAI - Launch button can now support alternate commands / modes - currently only for InvokeAI
> <img width="249" alt="image" src="https://github.com/LykosAI/StabilityMatrix/assets/13956642/16a8ffdd-a3cb-4f4f-acc5-c062d3ade363">
- Added ControlNet link for vlad/SD.Next
- Settings option to set global environment variables for Packages
> <img width="771" alt="image" src="https://github.com/LykosAI/StabilityMatrix/assets/13956642/d577918e-82bb-46d4-9a3a-9b5318d3d4d8">
### Changed
- Compatible packages (ComfyUI, Vlad/SD.Next) now use config files / launch args instead of symbolic links for shared model folder redirect
### Fixed ### Fixed
- Fixed [#48](https://github.com/LykosAI/StabilityMatrix/issues/48) - model folders not showing in UI when they were empty
- Updater now shows correct current version without trailing `.0` - Updater now shows correct current version without trailing `.0`
- Fixed program sometimes starting off-screen on multi-monitor setups
- Fixed console input box transparency
- Fixed [#52](https://github.com/LykosAI/StabilityMatrix/issues/52) - A1111 default approx-vae model download errors by switching default preview method to TAESD
- Fixes [#50](https://github.com/LykosAI/StabilityMatrix/issues/50) - model browser crash when no model versions exist
## v2.0.4 ## v2.0.4
### Fixed ### Fixed

14
StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AsyncAwaitBestPractices; using AsyncAwaitBestPractices;
using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
@ -48,12 +49,23 @@ public partial class MainWindowViewModel : ViewModelBase
UpdateViewModel = dialogFactory.Get<UpdateViewModel>(); UpdateViewModel = dialogFactory.Get<UpdateViewModel>();
} }
public override async Task OnLoadedAsync() public override void OnLoaded()
{ {
base.OnLoaded();
// Set only if null, since this may be called again when content dialogs open // Set only if null, since this may be called again when content dialogs open
CurrentPage ??= Pages.FirstOrDefault(); CurrentPage ??= Pages.FirstOrDefault();
SelectedCategory ??= Pages.FirstOrDefault(); SelectedCategory ??= Pages.FirstOrDefault();
EventManager.Instance.PageChangeRequested += OnPageChangeRequested; EventManager.Instance.PageChangeRequested += OnPageChangeRequested;
}
public override async Task OnLoadedAsync()
{
await base.OnLoadedAsync();
// Skip if design mode
if (Design.IsDesignMode) return;
if (!await EnsureDataDirectory()) if (!await EnsureDataDirectory())
{ {

10
StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs

@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace StabilityMatrix.Core.Models.FileInterfaces; namespace StabilityMatrix.Core.Models.FileInterfaces;
@ -87,6 +88,15 @@ public class FilePath : FileSystemPath, IPathObject
return File.ReadAllTextAsync(FullPath, ct); return File.ReadAllTextAsync(FullPath, ct);
} }
/// <summary> Write text </summary>
public void WriteAllText(string text) => File.WriteAllText(FullPath, text, Encoding.UTF8);
/// <summary> Write text asynchronously </summary>
public Task WriteAllTextAsync(string text, CancellationToken ct = default)
{
return File.WriteAllTextAsync(FullPath, text, Encoding.UTF8, ct);
}
/// <summary> Read bytes </summary> /// <summary> Read bytes </summary>
public byte[] ReadAllBytes() => File.ReadAllBytes(FullPath); public byte[] ReadAllBytes() => File.ReadAllBytes(FullPath);

8
StabilityMatrix.Core/Services/SettingsManager.cs

@ -213,14 +213,12 @@ public class SettingsManager : ISettingsManager
/// </summary> /// </summary>
public void SetLibraryPath(string path) public void SetLibraryPath(string path)
{ {
var appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); Compat.AppDataHome.Create();
var homeDir = Path.Combine(appDataDir, "StabilityMatrix"); var libraryJsonFile = Compat.AppDataHome.JoinFile("library.json");
Directory.CreateDirectory(homeDir);
var libraryJsonPath = Path.Combine(homeDir, "library.json");
var library = new LibrarySettings { LibraryPath = path }; var library = new LibrarySettings { LibraryPath = path };
var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true }); var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(libraryJsonPath, libraryJson); libraryJsonFile.WriteAllText(libraryJson);
// actually create the LibraryPath directory // actually create the LibraryPath directory
Directory.CreateDirectory(path); Directory.CreateDirectory(path);

Loading…
Cancel
Save