forked from LykosAI/StabilityMatrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request LykosAI#458 from ionite34/checkpoint-updates-n-stuff
add Find in Model Browser button on Checkpoints page context menu
- Loading branch information
Showing
18 changed files
with
395 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 28 additions & 9 deletions
37
StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,51 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Avalonia; | ||
using System.Threading.Tasks; | ||
using Avalonia.Controls; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using FluentAvalonia.Core; | ||
using FluentAvalonia.UI.Controls; | ||
using StabilityMatrix.Avalonia.ViewModels.Base; | ||
using StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser; | ||
using StabilityMatrix.Avalonia.Views; | ||
using StabilityMatrix.Core.Attributes; | ||
using StabilityMatrix.Core.Helper; | ||
using Symbol = FluentIcons.Common.Symbol; | ||
using SymbolIconSource = FluentIcons.FluentAvalonia.SymbolIconSource; | ||
|
||
namespace StabilityMatrix.Avalonia.ViewModels; | ||
|
||
[View(typeof(CheckpointBrowserPage))] | ||
[Singleton] | ||
public partial class CheckpointBrowserViewModel( | ||
CivitAiBrowserViewModel civitAiBrowserViewModel, | ||
HuggingFacePageViewModel huggingFaceViewModel | ||
) : PageViewModelBase | ||
public partial class CheckpointBrowserViewModel : PageViewModelBase | ||
{ | ||
public override string Title => "Model Browser"; | ||
public override IconSource IconSource => new SymbolIconSource { Symbol = Symbol.BrainCircuit, IsFilled = true }; | ||
public override IconSource IconSource => | ||
new SymbolIconSource { Symbol = Symbol.BrainCircuit, IsFilled = true }; | ||
|
||
public IReadOnlyList<TabItem> Pages { get; } = | ||
new List<TabItem>( | ||
public IReadOnlyList<TabItem> Pages { get; } | ||
|
||
[ObservableProperty] | ||
private TabItem? selectedPage; | ||
|
||
/// <inheritdoc/> | ||
public CheckpointBrowserViewModel( | ||
CivitAiBrowserViewModel civitAiBrowserViewModel, | ||
HuggingFacePageViewModel huggingFaceViewModel | ||
) | ||
{ | ||
Pages = new List<TabItem>( | ||
new List<TabViewModelBase>([civitAiBrowserViewModel, huggingFaceViewModel]).Select( | ||
vm => new TabItem { Header = vm.Header, Content = vm } | ||
) | ||
); | ||
SelectedPage = Pages.FirstOrDefault(); | ||
EventManager.Instance.NavigateAndFindCivitModelRequested += OnNavigateAndFindCivitModelRequested; | ||
} | ||
|
||
private void OnNavigateAndFindCivitModelRequested(object? sender, int e) | ||
{ | ||
SelectedPage = Pages.FirstOrDefault(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.