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.
296 lines
20 KiB
296 lines
20 KiB
<controls:UserControlBase xmlns="https://github.com/avaloniaui" |
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls" |
|
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs" |
|
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" |
|
xmlns:packages="clr-namespace:StabilityMatrix.Core.Models.Packages;assembly=StabilityMatrix.Core" |
|
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core" |
|
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" |
|
xmlns:input="clr-namespace:FluentAvalonia.UI.Input;assembly=FluentAvalonia" |
|
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" |
|
xmlns:packageManager="clr-namespace:StabilityMatrix.Avalonia.ViewModels.PackageManager" |
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|
x:DataType="packageManager:PackageInstallBrowserViewModel" |
|
d:DataContext="{x:Static mocks:DesignData.NewInstallerDialogViewModel}" |
|
x:Class="StabilityMatrix.Avalonia.Views.PackageManager.PackageInstallBrowserView"> |
|
|
|
<controls:UserControlBase.Resources> |
|
<input:StandardUICommand x:Key="PackageSelected" |
|
Command="{Binding OnPackageSelected}" /> |
|
|
|
<DataTemplate x:DataType="packages:BasePackage" x:Key="PackageTemplate"> |
|
<Button Padding="0" |
|
HorizontalAlignment="Stretch" |
|
HorizontalContentAlignment="Stretch" |
|
Margin="4" |
|
Classes="transparent-full" |
|
CornerRadius="8" |
|
Command="{StaticResource PackageSelected}" |
|
CommandParameter="{Binding }"> |
|
<controls:Card> |
|
|
|
<Grid ColumnDefinitions="Auto, *, Auto"> |
|
<controls:BetterAdvancedImage |
|
Grid.Column="0" |
|
Height="128" |
|
Width="128" |
|
Stretch="UniformToFill" |
|
CornerRadius="4" |
|
Source="{Binding PreviewImageUri}" /> |
|
<StackPanel Grid.Column="1" Orientation="Vertical"> |
|
<TextBlock Text="{Binding DisplayName}" |
|
FontWeight="Light" |
|
Margin="16,0,0,0" |
|
FontSize="20" /> |
|
|
|
<TextBlock Text="{Binding ByAuthor}" |
|
FontWeight="Light" |
|
Margin="16,0,0,0" |
|
FontSize="13" /> |
|
|
|
<TextBlock TextWrapping="Wrap" |
|
Text="{Binding Blurb}" |
|
FontWeight="Light" |
|
Margin="16,8,0,8" |
|
FontSize="16" /> |
|
|
|
<TextBlock TextWrapping="Wrap" |
|
Text="{Binding Disclaimer}" |
|
IsVisible="{Binding Disclaimer, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" |
|
Foreground="OrangeRed" |
|
FontWeight="Light" |
|
Margin="16,-4,0,4" |
|
FontSize="14" /> |
|
|
|
<ItemsRepeater Margin="16, 8, 0, 0" |
|
ItemsSource="{Binding AvailableTorchVersions}"> |
|
<ItemsRepeater.Layout> |
|
<StackLayout Orientation="Horizontal" /> |
|
</ItemsRepeater.Layout> |
|
<ItemsRepeater.ItemTemplate> |
|
<DataTemplate DataType="{x:Type models:TorchVersion}"> |
|
<controls:Card |
|
Tag="{Binding }" |
|
HorizontalAlignment="Left" |
|
Padding="4" |
|
Margin="0,0,8,0" |
|
VerticalAlignment="Top"> |
|
|
|
<controls:Card.Styles> |
|
<Style Selector="controls|Card[Tag=Cuda]"> |
|
<Setter Property="Background" |
|
Value="{DynamicResource ThemeGreenColorTransparent}" /> |
|
<Setter Property="BorderBrush" |
|
Value="{DynamicResource ThemeGreenColorTransparent}" /> |
|
<Style |
|
Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" |
|
Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="NVIDIA" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Rocm]"> |
|
<Setter Property="Background" |
|
Value="{DynamicResource ThemeDarkRedColor}" /> |
|
<Setter Property="BorderBrush" |
|
Value="{DynamicResource ThemeDarkRedColor}" /> |
|
<Style |
|
Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" |
|
Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="AMD (Linux)" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" |
|
ToolTip.Tip="For AMD GPUs that support ROCm on Linux" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=DirectMl]"> |
|
<Setter Property="Background" |
|
Value="{DynamicResource ThemeDarkBlueColor}" /> |
|
<Setter Property="BorderBrush" |
|
Value="{DynamicResource ThemeDarkBlueColor}" /> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="DirectML" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" |
|
ToolTip.Tip="For any DirectX compatible GPU on Windows" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Mps]"> |
|
<Setter Property="Background" Value="White" /> |
|
<Setter Property="BorderBrush" Value="White" /> |
|
<Style |
|
Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" |
|
Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="macOS" |
|
TextAlignment="Center" |
|
Foreground="Black" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Cpu]"> |
|
<Setter Property="Background" |
|
Value="{DynamicResource ThemeBlueGreyColor}" /> |
|
<Setter Property="BorderBrush" |
|
Value="{DynamicResource ThemeBlueGreyColor}" /> |
|
<Style |
|
Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" |
|
Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="CPU" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
</controls:Card.Styles> |
|
</controls:Card> |
|
</DataTemplate> |
|
</ItemsRepeater.ItemTemplate> |
|
</ItemsRepeater> |
|
|
|
</StackPanel> |
|
|
|
<controls1:SymbolIcon Grid.Column="2" |
|
HorizontalAlignment="Right" |
|
VerticalAlignment="Center" |
|
FontSize="24" |
|
Symbol="ChevronRight" /> |
|
</Grid> |
|
</controls:Card> |
|
</Button> |
|
</DataTemplate> |
|
</controls:UserControlBase.Resources> |
|
|
|
<TabControl TabStripPlacement="Top"> |
|
<TabControl.Items> |
|
<TabItem Header="Inference" Margin="8,0,0,0"> |
|
<ScrollViewer Padding="8"> |
|
<StackPanel Orientation="Vertical"> |
|
<Grid ColumnDefinitions="*, Auto" Margin="0,0,0,8"> |
|
<TextBox Margin="4, 0,0,0" |
|
Watermark="{x:Static lang:Resources.Action_Search}" |
|
Height="36" |
|
FontSize="16" |
|
HorizontalAlignment="Stretch" |
|
VerticalAlignment="Center" |
|
KeyDown="InputElement_OnKeyDown" |
|
Text="{Binding SearchFilter, Mode=TwoWay}"> |
|
<TextBox.InnerRightContent> |
|
<Grid> |
|
<Button Classes="transparent-full" |
|
IsVisible="{Binding SearchFilter.Length}" |
|
Command="{Binding ClearSearchQuery}"> |
|
<controls1:SymbolIcon Symbol="Cancel" /> |
|
</Button> |
|
<controls1:SymbolIcon |
|
IsVisible="{Binding !SearchFilter.Length}" |
|
Margin="0,0,10,0" |
|
FontSize="16" |
|
Symbol="Find" /> |
|
</Grid> |
|
</TextBox.InnerRightContent> |
|
</TextBox> |
|
<ToggleSwitch Grid.Column="1" OnContent="Show All Packages" OffContent="Show All Packages" |
|
IsChecked="{Binding ShowIncompatiblePackages}" |
|
VerticalAlignment="Center" |
|
HorizontalAlignment="Left" |
|
Margin="16, 0, 8, 0" |
|
ToolTip.Tip="Enabling "Show All Packages" will include packages that may not be compatible with your system and may run very slowly as a result." /> |
|
</Grid> |
|
<ItemsRepeater ItemsSource="{Binding InferencePackages}"> |
|
<ItemsRepeater.Layout> |
|
<StackLayout Orientation="Vertical" /> |
|
</ItemsRepeater.Layout> |
|
<ItemsRepeater.ItemTemplate> |
|
<StaticResource ResourceKey="PackageTemplate" /> |
|
</ItemsRepeater.ItemTemplate> |
|
</ItemsRepeater> |
|
</StackPanel> |
|
</ScrollViewer> |
|
</TabItem> |
|
<TabItem Header="Training"> |
|
<ScrollViewer Padding="8"> |
|
<StackPanel Orientation="Vertical"> |
|
<Grid ColumnDefinitions="*, Auto" Margin="0,0,0,8"> |
|
<TextBox Margin="4, 0,0,0" |
|
Watermark="{x:Static lang:Resources.Action_Search}" |
|
Height="36" |
|
FontSize="16" |
|
HorizontalAlignment="Stretch" |
|
VerticalAlignment="Center" |
|
KeyDown="InputElement_OnKeyDown" |
|
Text="{Binding SearchFilter, Mode=TwoWay}"> |
|
<TextBox.InnerRightContent> |
|
<Grid> |
|
<Button Classes="transparent-full" |
|
IsVisible="{Binding SearchFilter.Length}" |
|
Command="{Binding ClearSearchQuery}"> |
|
<controls1:SymbolIcon Symbol="Cancel" /> |
|
</Button> |
|
<controls1:SymbolIcon |
|
IsVisible="{Binding !SearchFilter.Length}" |
|
Margin="0,0,10,0" |
|
FontSize="16" |
|
Symbol="Find" /> |
|
</Grid> |
|
</TextBox.InnerRightContent> |
|
</TextBox> |
|
<ToggleSwitch Grid.Column="1" OnContent="Show All Packages" OffContent="Show All Packages" |
|
IsChecked="{Binding ShowIncompatiblePackages}" |
|
VerticalAlignment="Center" |
|
HorizontalAlignment="Left" |
|
Margin="16, 0, 8, 0" |
|
ToolTip.Tip="Enabling "Show All Packages" will include packages that may not be compatible with your system and may run very slowly as a result." /> |
|
</Grid> |
|
<ItemsRepeater ItemsSource="{Binding TrainingPackages}"> |
|
<ItemsRepeater.Layout> |
|
<StackLayout Orientation="Vertical" /> |
|
</ItemsRepeater.Layout> |
|
<ItemsRepeater.ItemTemplate> |
|
<StaticResource ResourceKey="PackageTemplate" /> |
|
</ItemsRepeater.ItemTemplate> |
|
</ItemsRepeater> |
|
</StackPanel> |
|
</ScrollViewer> |
|
</TabItem> |
|
</TabControl.Items> |
|
</TabControl> |
|
</controls:UserControlBase>
|
|
|