diff --git a/CHANGELOG.md b/CHANGELOG.md index 0607e5d0..b043a14d 100644 --- a/CHANGELOG.md +++ b/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 - [InvokeAI](https://github.com/invoke-ai/InvokeAI) - Launch button can now support alternate commands / modes - currently only for InvokeAI + > image +- Added ControlNet link for vlad/SD.Next +- Settings option to set global environment variables for Packages + > image +### Changed +- Compatible packages (ComfyUI, Vlad/SD.Next) now use config files / launch args instead of symbolic links for shared model folder redirect ### 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` +- 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 ### Fixed diff --git a/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs index 34a0f196..bf2bc61f 100644 --- a/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AsyncAwaitBestPractices; +using Avalonia.Controls; using Avalonia.Controls.Primitives; using CommunityToolkit.Mvvm.ComponentModel; using FluentAvalonia.UI.Controls; @@ -47,14 +48,25 @@ public partial class MainWindowViewModel : ViewModelBase ProgressManagerViewModel = dialogFactory.Get(); UpdateViewModel = dialogFactory.Get(); } - - 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 CurrentPage ??= Pages.FirstOrDefault(); SelectedCategory ??= Pages.FirstOrDefault(); + EventManager.Instance.PageChangeRequested += OnPageChangeRequested; + } + public override async Task OnLoadedAsync() + { + await base.OnLoadedAsync(); + + // Skip if design mode + if (Design.IsDesignMode) return; + if (!await EnsureDataDirectory()) { // False if user exited dialog, shutdown app diff --git a/StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs b/StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs index 37f072ae..d8a54fcd 100644 --- a/StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs +++ b/StabilityMatrix.Core/Models/FileInterfaces/FilePath.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Text; namespace StabilityMatrix.Core.Models.FileInterfaces; @@ -87,6 +88,15 @@ public class FilePath : FileSystemPath, IPathObject return File.ReadAllTextAsync(FullPath, ct); } + /// Write text + public void WriteAllText(string text) => File.WriteAllText(FullPath, text, Encoding.UTF8); + + /// Write text asynchronously + public Task WriteAllTextAsync(string text, CancellationToken ct = default) + { + return File.WriteAllTextAsync(FullPath, text, Encoding.UTF8, ct); + } + /// Read bytes public byte[] ReadAllBytes() => File.ReadAllBytes(FullPath); diff --git a/StabilityMatrix.Core/Services/SettingsManager.cs b/StabilityMatrix.Core/Services/SettingsManager.cs index 9be66c4a..46328446 100644 --- a/StabilityMatrix.Core/Services/SettingsManager.cs +++ b/StabilityMatrix.Core/Services/SettingsManager.cs @@ -213,14 +213,12 @@ public class SettingsManager : ISettingsManager /// public void SetLibraryPath(string path) { - var appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - var homeDir = Path.Combine(appDataDir, "StabilityMatrix"); - Directory.CreateDirectory(homeDir); - var libraryJsonPath = Path.Combine(homeDir, "library.json"); + Compat.AppDataHome.Create(); + var libraryJsonFile = Compat.AppDataHome.JoinFile("library.json"); var library = new LibrarySettings { LibraryPath = path }; var libraryJson = JsonSerializer.Serialize(library, new JsonSerializerOptions { WriteIndented = true }); - File.WriteAllText(libraryJsonPath, libraryJson); + libraryJsonFile.WriteAllText(libraryJson); // actually create the LibraryPath directory Directory.CreateDirectory(path);