You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
479 lines
23 KiB
479 lines
23 KiB
<controls:UserControlBase |
|
x:Class="StabilityMatrix.Avalonia.Views.SettingsPage" |
|
xmlns="https://github.com/avaloniaui" |
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" |
|
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls" |
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" |
|
xmlns:ui="using:FluentAvalonia.UI.Controls" |
|
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels" |
|
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" |
|
d:DataContext="{x:Static mocks:DesignData.SettingsViewModel}" |
|
d:DesignHeight="700" |
|
d:DesignWidth="800" |
|
x:CompileBindings="True" |
|
x:DataType="vm:SettingsViewModel" |
|
mc:Ignorable="d"> |
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto"> |
|
<StackPanel Margin="8,16" Spacing="8"> |
|
<!-- Theme --> |
|
<Grid RowDefinitions="Auto,*,*"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="Appearance" /> |
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0,8,4" |
|
Header="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" |
|
IsVisible="{Binding SharedState.IsDebugMode}" |
|
Margin="8,0,8,4" |
|
Header="{x:Static lang:Resources.Label_Language}" |
|
IconSource="Character"> |
|
<ui:SettingsExpander.Footer> |
|
<ComboBox |
|
MinWidth="100" |
|
ItemsSource="{Binding AvailableLanguages}" |
|
DisplayMemberBinding="{Binding NativeName}" |
|
SelectedItem="{Binding SelectedLanguage}" /> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- Checkpoints Manager Options --> |
|
<Grid RowDefinitions="auto,*,Auto"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="Checkpoint Manager" /> |
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0" |
|
Description="Select this option if you're having problems moving Stability Matrix to another drive" |
|
Header="Remove shared checkpoints directory symbolic links on shutdown" |
|
IconSource="Folder"> |
|
<ui:SettingsExpander.Footer> |
|
<CheckBox Margin="8" IsChecked="{Binding RemoveSymlinksOnShutdown}" /> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
<ui:SettingsExpander |
|
Grid.Row="2" |
|
Margin="8,4" |
|
Description="Rebuilds the installed checkpoints cache. Use if checkpoints are incorrectly labeled in the Model Browser." |
|
Header="Reset Checkpoints Cache" |
|
IconSource="Refresh"> |
|
<ui:SettingsExpander.Footer> |
|
<Button Command="{Binding ResetCheckpointCache}" Content="Reset Checkpoints Cache" /> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- Inference UI --> |
|
<Grid Margin="0,8,0,0" RowDefinitions="auto,*,*"> |
|
<TextBlock |
|
FontWeight="Medium" |
|
Text="Inference UI" |
|
Margin="0,0,0,8" /> |
|
<!-- Auto Completion --> |
|
<ui:SettingsExpander Grid.Row="1" |
|
Header="Prompt Auto Completion" |
|
Margin="8,0,8,4"> |
|
<ui:SettingsExpander.IconSource> |
|
<controls:FASymbolIconSource Symbol="fa-solid fa-wand-magic-sparkles"/> |
|
</ui:SettingsExpander.IconSource> |
|
|
|
<!-- Enable toggle --> |
|
<ui:SettingsExpanderItem Content="Enable"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<ToggleSwitch |
|
IsChecked="{Binding IsPromptCompletionEnabled}" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<!-- Tag csv selection --> |
|
<ui:SettingsExpanderItem Content="Tag Source" |
|
IconSource="Tag" |
|
IsEnabled="{Binding IsPromptCompletionEnabled}" |
|
Description="Tags to use for completion in .csv format (Compatible with a1111-sd-webui-tagcomplete)"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<ui:FAComboBox |
|
ItemsSource="{Binding AvailableTagCompletionCsvs}" |
|
SelectedItem="{Binding SelectedTagCompletionCsv}"/> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<!-- Tag csv import --> |
|
<ui:SettingsExpanderItem Content="Import Tag Source .csv" |
|
IconSource="Add" |
|
IsEnabled="{Binding IsPromptCompletionEnabled}"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button |
|
Command="{Binding ImportTagCsvCommand}" |
|
Content="Import"/> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<!-- Remove underscores --> |
|
<ui:SettingsExpanderItem |
|
Content="Replace underscores with spaces when inserting completions" |
|
IconSource="Underline" |
|
IsEnabled="{Binding IsPromptCompletionEnabled}"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<CheckBox Margin="8" |
|
IsChecked="{Binding IsCompletionRemoveUnderscoresEnabled}"/> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
</ui:SettingsExpander> |
|
|
|
<!-- Image Viewer --> |
|
<ui:SettingsExpander Grid.Row="2" |
|
Header="Image Viewer" |
|
IconSource="Image" |
|
Margin="8,0,8,4"> |
|
|
|
<!-- Pixel grid --> |
|
<ui:SettingsExpanderItem |
|
Content="Show pixel grid at high zoom levels" |
|
IconSource="ViewAll"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<CheckBox Margin="8" |
|
IsChecked="{Binding IsImageViewerPixelGridEnabled}"/> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- Environment Options --> |
|
<Grid RowDefinitions="Auto, Auto, Auto"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="Package Environment" /> |
|
|
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0" |
|
Header="Environment Variables" |
|
IconSource="OtherUser"> |
|
<ui:SettingsExpander.Footer> |
|
<Button Command="{Binding OpenEnvVarsDialogCommand}" Content="Edit" /> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
|
|
<ui:SettingsExpander |
|
Grid.Row="2" |
|
Margin="8,4" |
|
Header="Embedded Python"> |
|
<ui:SettingsExpander.IconSource> |
|
<controls:FASymbolIconSource Symbol="fa-brands fa-python" /> |
|
</ui:SettingsExpander.IconSource> |
|
<ui:SettingsExpander.Footer> |
|
<StackPanel Orientation="Horizontal" Spacing="16"> |
|
<controls:ProgressRing |
|
BorderThickness="3" |
|
IsEnabled="{Binding CheckPythonVersionCommand.IsRunning}" |
|
IsIndeterminate="True" |
|
IsVisible="{Binding CheckPythonVersionCommand.IsRunning}" /> |
|
<Button Command="{Binding CheckPythonVersionCommand}" Content="Check Version" /> |
|
</StackPanel> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- Integrations --> |
|
<Grid RowDefinitions="auto,*"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="Integrations" /> |
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0,8,4" |
|
Header="Discord Rich Presence"> |
|
<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> |
|
</Grid> |
|
|
|
<!-- System Options --> |
|
<Grid RowDefinitions="auto, auto, auto"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="System" /> |
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0,8,4" |
|
Description="Uses the current app location, you can run this again if you move the app" |
|
Header="Add Stability Matrix to the Start Menu" |
|
IconSource="StarAdd" |
|
ToolTip.Tip="{OnPlatform Default='Only available on Windows', |
|
Windows={x:Null}}"> |
|
<ui:SettingsExpander.Footer> |
|
<StackPanel Orientation="Horizontal" Spacing="8"> |
|
<controls:ProgressRing |
|
BorderThickness="3" |
|
IsEnabled="{Binding IsVisible, RelativeSource={RelativeSource Self}}" |
|
IsIndeterminate="True"> |
|
<controls:ProgressRing.IsVisible> |
|
<MultiBinding Converter="{x:Static BoolConverters.Or}"> |
|
<Binding Path="AddToStartMenuCommand.IsRunning" /> |
|
<Binding Path="AddToGlobalStartMenuCommand.IsRunning" /> |
|
</MultiBinding> |
|
</controls:ProgressRing.IsVisible> |
|
</controls:ProgressRing> |
|
|
|
<SplitButton |
|
Command="{Binding AddToStartMenuCommand}" |
|
Content="Add for Current User" |
|
IsEnabled="{OnPlatform Default=False, |
|
Windows=True}"> |
|
<SplitButton.Flyout> |
|
<ui:FAMenuFlyout Placement="Bottom"> |
|
<ui:MenuFlyoutItem |
|
Command="{Binding AddToGlobalStartMenuCommand}" |
|
IconSource="Admin" |
|
Text="Add for All Users" /> |
|
</ui:FAMenuFlyout> |
|
</SplitButton.Flyout> |
|
</SplitButton> |
|
</StackPanel> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
<ui:SettingsExpander |
|
Grid.Row="2" |
|
Margin="8,0" |
|
Description="Does not move existing data" |
|
Header="Select New Data Directory" |
|
IconSource="MoveToFolder"> |
|
<ui:SettingsExpander.Footer> |
|
<Button Command="{Binding PickNewDataDirectory}"> |
|
<Grid ColumnDefinitions="Auto, Auto"> |
|
<avalonia:Icon |
|
Grid.Row="0" |
|
Margin="0,0,8,0" |
|
VerticalAlignment="Center" |
|
Value="fa-solid fa-folder-open" /> |
|
<TextBlock |
|
Grid.Column="1" |
|
VerticalAlignment="Center" |
|
Text="Select Directory" /> |
|
</Grid> |
|
</Button> |
|
</ui:SettingsExpander.Footer> |
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- Debug Options --> |
|
<Grid |
|
IsVisible="{Binding SharedState.IsDebugMode}" |
|
RowDefinitions="auto,*"> |
|
<TextBlock |
|
Margin="0,0,0,8" |
|
FontWeight="Medium" |
|
Text="Debug Options" /> |
|
<ui:SettingsExpander |
|
Grid.Row="1" |
|
Margin="8,0,8,0" |
|
Command="{Binding LoadDebugInfo}" |
|
Header="Debug Options" |
|
IconSource="Code"> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Description="Paths" |
|
IconSource="Folder"> |
|
<SelectableTextBlock |
|
Foreground="{DynamicResource TextControlPlaceholderForeground}" |
|
Text="{Binding DebugPaths}" |
|
TextWrapping="WrapWithOverflow" /> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Description="Compat Info" |
|
IconSource="StarFilled"> |
|
<SelectableTextBlock |
|
Foreground="{DynamicResource TextControlPlaceholderForeground}" |
|
Text="{Binding DebugCompatInfo}" |
|
TextWrapping="WrapWithOverflow" /> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Description="GPU Info" |
|
IconSource="FullScreenMaximize"> |
|
<SelectableTextBlock |
|
Foreground="{DynamicResource TextControlPlaceholderForeground}" |
|
Text="{Binding DebugGpuInfo}" |
|
TextWrapping="WrapWithOverflow" /> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Content="Animation Scale" |
|
Description="Lower values = faster animations. 0x means animations are instant." |
|
IconSource="Clock"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<ComboBox ItemsSource="{Binding AnimationScaleOptions}" SelectedItem="{Binding SelectedAnimationScale}"> |
|
<ComboBox.ItemTemplate> |
|
<DataTemplate> |
|
<TextBlock> |
|
<Run Text="{Binding}" /><Run Text="x" /> |
|
</TextBlock> |
|
</DataTemplate> |
|
</ComboBox.ItemTemplate> |
|
</ComboBox> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Content="Notification" |
|
IconSource="CommentAdd"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button Command="{Binding DebugNotificationCommand}" Content="New Notification" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Content="Content Dialog" |
|
IconSource="NewWindow"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button Command="{Binding DebugContentDialogCommand}" Content="Show Dialog" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0" |
|
Content="Exceptions" |
|
IconSource="Flag"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button Command="{Binding DebugThrowExceptionCommand}" Content="Unhandled Exception" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0,4,4" |
|
Content="Download Manager tests" |
|
IconSource="Flag"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button |
|
Margin="0,8" |
|
Command="{Binding DebugTrackedDownloadCommand}" |
|
Content="Add Tracked Download" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0,4,4" |
|
Content="Refresh Models Index" |
|
IconSource="SyncFolder"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button |
|
Margin="0,8" |
|
Command="{Binding DebugRefreshModelsIndexCommand}" |
|
Content="Refresh Index" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0,4,4" |
|
Content="Make image grid" |
|
IconSource="Image"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button |
|
Margin="0,8" |
|
Command="{Binding DebugMakeImageGridCommand}" |
|
Content="Select images" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
<ui:SettingsExpanderItem |
|
Margin="4,0,4,4" |
|
Content="Image metadata parser" |
|
IconSource="Flag"> |
|
<ui:SettingsExpanderItem.Footer> |
|
<Button |
|
Margin="0,8" |
|
Command="{Binding DebugImageMetadataCommand}" |
|
Content="Choose image" /> |
|
</ui:SettingsExpanderItem.Footer> |
|
</ui:SettingsExpanderItem> |
|
|
|
</ui:SettingsExpander> |
|
</Grid> |
|
|
|
<!-- TODO: Directories card --> |
|
|
|
<Grid RowDefinitions="auto,*"> |
|
<StackPanel |
|
Grid.Row="1" |
|
HorizontalAlignment="Left" |
|
Orientation="Vertical"> |
|
<TextBlock |
|
Margin="0,8" |
|
FontSize="15" |
|
FontWeight="Bold" |
|
Text="About" /> |
|
<Image |
|
Width="112" |
|
Height="112" |
|
Margin="8" |
|
HorizontalAlignment="Left" |
|
Source="/Assets/Icon.png" /> |
|
<TextBlock |
|
Margin="8" |
|
FontWeight="Medium" |
|
Text="Stability Matrix" /> |
|
<Panel> |
|
<Button |
|
Name="VersionButton" |
|
Margin="8,0,8,8" |
|
Padding="2,0,2,0" |
|
BorderThickness="0" |
|
Classes="transparent" |
|
Command="{Binding OnVersionClick}" |
|
Content="{Binding AppVersion}" /> |
|
<ui:TeachingTip |
|
Title="{Binding VersionFlyoutText}" |
|
IsOpen="{Binding IsVersionTapTeachingTipOpen}" |
|
PreferredPlacement="RightTop" |
|
Target="{Binding #VersionButton}" /> |
|
</Panel> |
|
|
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> |
|
<Button |
|
Margin="8" |
|
HorizontalAlignment="Left" |
|
Command="{Binding ShowLicensesDialogCommand}" |
|
Content="License and Open Source Notices" /> |
|
</StackPanel> |
|
</StackPanel> |
|
</Grid> |
|
|
|
<!-- Extra space at the bottom --> |
|
<Panel Margin="0,0,0,16" /> |
|
</StackPanel> |
|
</ScrollViewer> |
|
|
|
|
|
</controls:UserControlBase>
|
|
|