Browse Source

rearrange settings & add System.Drawing.Common reference?

pull/629/head
JT 9 months ago
parent
commit
e87b5032be
  1. 1
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  2. 1
      StabilityMatrix.Avalonia/ViewModels/OpenArtBrowserViewModel.cs
  3. 9
      StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs
  4. 2
      StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml.cs
  5. 186
      StabilityMatrix.Avalonia/Views/Settings/MainSettingsPage.axaml
  6. 1
      StabilityMatrix.Core/Models/Settings/Settings.cs
  7. 1
      StabilityMatrix.UITests/StabilityMatrix.UITests.csproj

1
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -95,6 +95,7 @@
<PackageReference Include="Sylvan.Common" Version="0.4.3" /> <PackageReference Include="Sylvan.Common" Version="0.4.3" />
<PackageReference Include="Sylvan.Data" Version="0.2.12" /> <PackageReference Include="Sylvan.Data" Version="0.2.12" />
<PackageReference Include="Sylvan.Data.Csv" Version="1.3.5" /> <PackageReference Include="Sylvan.Data.Csv" Version="1.3.5" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.56" /> <PackageReference Include="TextMateSharp.Grammars" Version="1.0.56" />
<PackageReference Include="URISchemeTools" Version="1.0.2" /> <PackageReference Include="URISchemeTools" Version="1.0.2" />
</ItemGroup> </ItemGroup>

1
StabilityMatrix.Avalonia/ViewModels/OpenArtBrowserViewModel.cs

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;

9
StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs

@ -129,6 +129,9 @@ public partial class MainSettingsViewModel : PageViewModelBase
[ObservableProperty] [ObservableProperty]
private HolidayMode holidayModeSetting; private HolidayMode holidayModeSetting;
[ObservableProperty]
private bool infinitelyScrollWorkflowBrowser;
#region System Info #region System Info
private static Lazy<IReadOnlyList<GpuInfo>> GpuInfosLazy { get; } = private static Lazy<IReadOnlyList<GpuInfo>> GpuInfosLazy { get; } =
@ -217,6 +220,12 @@ public partial class MainSettingsViewModel : PageViewModelBase
settings => settings.HolidayModeSetting settings => settings.HolidayModeSetting
); );
settingsManager.RelayPropertyFor(
this,
vm => vm.InfinitelyScrollWorkflowBrowser,
settings => settings.IsWorkflowInfiniteScrollEnabled
);
DebugThrowAsyncExceptionCommand.WithNotificationErrorHandler(notificationService, LogLevel.Warn); DebugThrowAsyncExceptionCommand.WithNotificationErrorHandler(notificationService, LogLevel.Warn);
hardwareInfoUpdateTimer.Tick += OnHardwareInfoUpdateTimerTick; hardwareInfoUpdateTimer.Tick += OnHardwareInfoUpdateTimerTick;

2
StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml.cs

@ -23,7 +23,7 @@ public partial class OpenArtBrowserPage : UserControlBase
if (scrollViewer.Offset.Y == 0) if (scrollViewer.Offset.Y == 0)
return; return;
var isAtEnd = Math.Abs(scrollViewer.Offset.Y - scrollViewer.ScrollBarMaximum.Y) < 0.1f; var isAtEnd = Math.Abs(scrollViewer.Offset.Y - scrollViewer.ScrollBarMaximum.Y) < 1f;
if (isAtEnd && DataContext is IInfinitelyScroll scroll) if (isAtEnd && DataContext is IInfinitelyScroll scroll)
{ {
scroll.LoadNextPageAsync().SafeFireAndForget(); scroll.LoadNextPageAsync().SafeFireAndForget();

186
StabilityMatrix.Avalonia/Views/Settings/MainSettingsPage.axaml

@ -45,77 +45,6 @@
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="8,16" Spacing="8"> <StackPanel Margin="8,16" Spacing="8">
<!-- Theme -->
<Grid RowDefinitions="Auto,*,*,*">
<TextBlock
Margin="0,0,0,8"
FontWeight="Medium"
Text="{x:Static lang:Resources.Label_Appearance}" />
<ui:SettingsExpander
Grid.Row="1"
Margin="8,0,8,4"
Header="{x:Static lang:Resources.Label_Theme}"
IconSource="WeatherMoon">
<ui:SettingsExpander.Footer>
<ComboBox
MinWidth="100"
ItemsSource="{Binding AvailableThemes}"
SelectedItem="{Binding SelectedTheme}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="2"
Margin="8,0,8,4"
Header="{x:Static lang:Resources.Label_Language}"
IconSource="Character">
<ui:SettingsExpander.Footer>
<ComboBox
MinWidth="100"
DisplayMemberBinding="{Binding Converter={StaticResource CultureInfoDisplayConverter}}"
ItemsSource="{Binding AvailableLanguages}"
SelectedItem="{Binding SelectedLanguage}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="3"
Margin="8,0,8,4"
ActionIconSource="ChevronRight"
Command="{Binding NavigateToSubPageCommand}"
CommandParameter="{x:Type vmSettings:InferenceSettingsViewModel}"
Header="Inference (Test)"
IconSource="Code"
IsClickEnabled="True"
IsVisible="{Binding SharedState.IsDebugMode}" />
</Grid>
<!-- Checkpoints Manager Options -->
<Grid RowDefinitions="auto,*,Auto">
<TextBlock
Margin="0,0,0,8"
FontWeight="Medium"
Text="{x:Static lang:Resources.Label_CheckpointManager}" />
<ui:SettingsExpander
Grid.Row="1"
Margin="8,0"
Description="{x:Static lang:Resources.Label_RemoveSymlinksOnShutdown_Details}"
Header="{x:Static lang:Resources.Label_RemoveSymlinksOnShutdown}"
IconSource="Folder">
<ui:SettingsExpander.Footer>
<CheckBox IsChecked="{Binding RemoveSymlinksOnShutdown}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="2"
Margin="8,4"
Description="{x:Static lang:Resources.Label_ResetCheckpointsCache_Details}"
Header="{x:Static lang:Resources.Label_ResetCheckpointsCache}"
IconSource="Refresh">
<ui:SettingsExpander.Footer>
<Button Command="{Binding ResetCheckpointCache}" Content="{x:Static lang:Resources.Label_ResetCheckpointsCache}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
</Grid>
<!-- General --> <!-- General -->
<sg:SpacedGrid RowDefinitions="Auto,*,*,*" RowSpacing="4"> <sg:SpacedGrid RowDefinitions="Auto,*,*,*" RowSpacing="4">
<TextBlock <TextBlock
@ -168,6 +97,68 @@
</ui:SettingsExpander> </ui:SettingsExpander>
</sg:SpacedGrid> </sg:SpacedGrid>
<!-- Integrations -->
<sg:SpacedGrid RowDefinitions="Auto,*,*" RowSpacing="4">
<TextBlock
Margin="0,0,0,4"
FontWeight="Medium"
Text="{x:Static lang:Resources.Label_Integrations}" />
<ui:SettingsExpander
Grid.Row="1"
Margin="8,0"
ActionIconSource="ChevronRight"
Command="{Binding NavigateToSubPageCommand}"
CommandParameter="{x:Type vmSettings:AccountSettingsViewModel}"
Header="{x:Static lang:Resources.Label_Accounts}"
IsClickEnabled="True">
<ui:SettingsExpander.IconSource>
<fluentIcons:SymbolIconSource
FontSize="10"
IsFilled="True"
Symbol="Person" />
</ui:SettingsExpander.IconSource>
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="2"
Margin="8,0,8,4"
Header="{x:Static lang:Resources.Label_DiscordRichPresence}">
<ui:SettingsExpander.IconSource>
<controls:FASymbolIconSource Symbol="fa-brands fa-discord" />
</ui:SettingsExpander.IconSource>
<ui:SettingsExpander.Footer>
<ToggleSwitch IsChecked="{Binding IsDiscordRichPresenceEnabled}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
</sg:SpacedGrid>
<!-- Checkpoints Manager Options -->
<Grid RowDefinitions="auto,*,Auto">
<TextBlock
Margin="0,0,0,8"
FontWeight="Medium"
Text="{x:Static lang:Resources.Label_CheckpointManager}" />
<ui:SettingsExpander
Grid.Row="1"
Margin="8,0"
Description="{x:Static lang:Resources.Label_RemoveSymlinksOnShutdown_Details}"
Header="{x:Static lang:Resources.Label_RemoveSymlinksOnShutdown}"
IconSource="Folder">
<ui:SettingsExpander.Footer>
<CheckBox IsChecked="{Binding RemoveSymlinksOnShutdown}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="2"
Margin="8,4"
Description="{x:Static lang:Resources.Label_ResetCheckpointsCache_Details}"
Header="{x:Static lang:Resources.Label_ResetCheckpointsCache}"
IconSource="Refresh">
<ui:SettingsExpander.Footer>
<Button Command="{Binding ResetCheckpointCache}" Content="{x:Static lang:Resources.Label_ResetCheckpointsCache}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
</Grid>
<!-- Environment Options --> <!-- Environment Options -->
<Grid RowDefinitions="Auto, Auto, Auto"> <Grid RowDefinitions="Auto, Auto, Auto">
<TextBlock <TextBlock
@ -205,39 +196,48 @@
</ui:SettingsExpander> </ui:SettingsExpander>
</Grid> </Grid>
<!-- Integrations --> <!-- Theme -->
<sg:SpacedGrid RowDefinitions="Auto,*,*" RowSpacing="4"> <Grid RowDefinitions="Auto,*,*,*">
<TextBlock <TextBlock
Margin="0,0,0,4" Margin="0,0,0,8"
FontWeight="Medium" FontWeight="Medium"
Text="{x:Static lang:Resources.Label_Integrations}" /> Text="{x:Static lang:Resources.Label_Appearance}" />
<ui:SettingsExpander <ui:SettingsExpander
Grid.Row="1" Grid.Row="1"
Margin="8,0" Margin="8,0,8,4"
ActionIconSource="ChevronRight" Header="{x:Static lang:Resources.Label_Theme}"
Command="{Binding NavigateToSubPageCommand}" IconSource="WeatherMoon">
CommandParameter="{x:Type vmSettings:AccountSettingsViewModel}" <ui:SettingsExpander.Footer>
Header="{x:Static lang:Resources.Label_Accounts}" <ComboBox
IsClickEnabled="True"> MinWidth="100"
<ui:SettingsExpander.IconSource> ItemsSource="{Binding AvailableThemes}"
<fluentIcons:SymbolIconSource SelectedItem="{Binding SelectedTheme}" />
FontSize="10" </ui:SettingsExpander.Footer>
IsFilled="True"
Symbol="Person" />
</ui:SettingsExpander.IconSource>
</ui:SettingsExpander> </ui:SettingsExpander>
<ui:SettingsExpander <ui:SettingsExpander
Grid.Row="2" Grid.Row="2"
Margin="8,0,8,4" Margin="8,0,8,4"
Header="{x:Static lang:Resources.Label_DiscordRichPresence}"> Header="{x:Static lang:Resources.Label_Language}"
<ui:SettingsExpander.IconSource> IconSource="Character">
<controls:FASymbolIconSource Symbol="fa-brands fa-discord" />
</ui:SettingsExpander.IconSource>
<ui:SettingsExpander.Footer> <ui:SettingsExpander.Footer>
<ToggleSwitch IsChecked="{Binding IsDiscordRichPresenceEnabled}" /> <ComboBox
MinWidth="100"
DisplayMemberBinding="{Binding Converter={StaticResource CultureInfoDisplayConverter}}"
ItemsSource="{Binding AvailableLanguages}"
SelectedItem="{Binding SelectedLanguage}" />
</ui:SettingsExpander.Footer> </ui:SettingsExpander.Footer>
</ui:SettingsExpander> </ui:SettingsExpander>
</sg:SpacedGrid> <ui:SettingsExpander
Grid.Row="3"
Margin="8,0,8,4"
ActionIconSource="ChevronRight"
Command="{Binding NavigateToSubPageCommand}"
CommandParameter="{x:Type vmSettings:InferenceSettingsViewModel}"
Header="Inference (Test)"
IconSource="Code"
IsClickEnabled="True"
IsVisible="{Binding SharedState.IsDebugMode}" />
</Grid>
<!-- System Options --> <!-- System Options -->
<sg:SpacedGrid RowDefinitions="Auto,Auto,Auto,Auto,Auto" RowSpacing="4"> <sg:SpacedGrid RowDefinitions="Auto,Auto,Auto,Auto,Auto" RowSpacing="4">

1
StabilityMatrix.Core/Models/Settings/Settings.cs

@ -120,6 +120,7 @@ public class Settings
public Size InferenceImageSize { get; set; } = new(150, 190); public Size InferenceImageSize { get; set; } = new(150, 190);
public Size OutputsImageSize { get; set; } = new(300, 300); public Size OutputsImageSize { get; set; } = new(300, 300);
public HolidayMode HolidayModeSetting { get; set; } = HolidayMode.Automatic; public HolidayMode HolidayModeSetting { get; set; } = HolidayMode.Automatic;
public bool IsWorkflowInfiniteScrollEnabled { get; set; } = true;
[JsonIgnore] [JsonIgnore]
public bool IsHolidayModeActive => public bool IsHolidayModeActive =>

1
StabilityMatrix.UITests/StabilityMatrix.UITests.csproj

@ -19,6 +19,7 @@
<PackageReference Include="DotNet.Bundle" Version="0.9.13" /> <PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" /> <PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
<PackageReference Include="Verify" Version="23.0.0" /> <PackageReference Include="Verify" Version="23.0.0" />
<PackageReference Include="Verify.CommunityToolkit.Mvvm" Version="0.1.0" /> <PackageReference Include="Verify.CommunityToolkit.Mvvm" Version="0.1.0" />
<PackageReference Include="Verify.Avalonia" Version="1.0.1" /> <PackageReference Include="Verify.Avalonia" Version="1.0.1" />

Loading…
Cancel
Save