Multi-Platform Package Manager for Stable Diffusion
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.
 
 
 

198 lines
8.6 KiB

<controls:UserControlBase
x:Class="StabilityMatrix.Avalonia.Views.Dialogs.PythonPackagesDialog"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
xmlns:python="clr-namespace:StabilityMatrix.Core.Python;assembly=StabilityMatrix.Core"
xmlns:sg="clr-namespace:SpacedGridControl.Avalonia;assembly=SpacedGridControl.Avalonia"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:vmDialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
d:DataContext="{x:Static mocks:DesignData.PythonPackagesViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
x:DataType="vmDialogs:PythonPackagesViewModel"
mc:Ignorable="d">
<sg:SpacedGrid
MinHeight="300"
Margin="8"
ColumnDefinitions="*,Auto,*"
RowDefinitions="Auto,Auto,*">
<!-- Title -->
<!--<TextBlock
Margin="16,16,16,0"
FontSize="24"
FontWeight="Bold"
Text="{x:Static lang:Resources.Label_PythonPackages}"
TextWrapping="Wrap" />-->
<!-- Close button -->
<!--<Button
Grid.Row="1"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Top">
<ui:SymbolIcon
Foreground="LightGreen"
Symbol=""
ToolTip.Tip="{x:Static lang:Resources.Label_ConnectedModel}" />
</Button>-->
<ui:CommandBar Grid.Row="1" Grid.Column="0">
<ui:CommandBar.Styles>
<Style Selector="ui|CommandBarButton">
<Setter Property="Padding" Value="4" />
<Setter Property="Width" Value="35" />
<Setter Property="Height" Value="45" />
</Style>
</ui:CommandBar.Styles>
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton
IconSource="Add"
Command="{Binding InstallPackageCommand}"
Label="{x:Static lang:Resources.Action_Save}" />
<ui:CommandBarButton
IconSource="Remove"
Command="{Binding UninstallSelectedPackageCommand}"
Label="{x:Static lang:Resources.Action_Remove}">
<!--<ui:CommandBarButton.IsEnabled>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="!EnvVarsView.IsEmpty" />
<Binding ElementName="EnvVarsGrid" Path="SelectedItem" Converter="{x:Static ObjectConverters.IsNotNull}" />
</MultiBinding>
</ui:CommandBarButton.IsEnabled>-->
</ui:CommandBarButton>
<ui:CommandBarSeparator />
</ui:CommandBar.PrimaryCommands>
</ui:CommandBar>
<!-- Option Cards -->
<!--<controls:Card
Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Classes="transparent">
</controls:Card>-->
<ScrollViewer
Grid.Row="2"
Grid.Column="0"
IsVisible="{Binding !IsLoading}">
<ListBox
ItemsSource="{Binding Packages}"
SelectedItem="{Binding SelectedPackage}"
SelectionMode="AlwaysSelected">
<ListBox.ItemTemplate>
<DataTemplate DataType="vmDialogs:PythonPackagesItemViewModel">
<sg:SpacedGrid Margin="0,4" ColumnDefinitions="Auto,Auto">
<TextBlock Text="{Binding Package.Name}" Theme="{DynamicResource BodyStrongTextBlockStyle}" />
<TextBlock
Grid.Column="1"
FontSize="13"
Foreground="{StaticResource ThemeLightGreyColor}"
Text="{Binding Package.Version}"
TextTrimming="CharacterEllipsis" />
</sg:SpacedGrid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
<ProgressBar
Margin="32,16"
Grid.Row="2"
Grid.Column="0"
IsIndeterminate="True"
IsEnabled="{Binding IsLoading}"
IsVisible="{Binding IsLoading}"/>
<GridSplitter
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="1"
Width="8" />
<TransitioningContentControl
Margin="8,0"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="2"
Width="500"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Content="{Binding SelectedPackage}">
<TransitioningContentControl.ContentTemplate>
<DataTemplate DataType="{x:Type vmDialogs:PythonPackagesItemViewModel}">
<sg:SpacedGrid RowDefinitions="Auto,Auto,*">
<TextBlock
Text="{Binding Package.Name}"
Theme="{DynamicResource TitleTextBlockStyle}" />
<TextBlock
Grid.Row="1"
Text="{Binding Package.Version}" />
<!-- Loaded content -->
<StackPanel Grid.Row="2" IsVisible="{Binding !IsLoading}">
<TextBlock
TextWrapping="WrapWithOverflow"
Text="{Binding PipShowResult.Author}" />
<TextBlock
TextWrapping="WrapWithOverflow"
Text="{Binding PipShowResult.License}" />
<ui:HyperlinkButton
NavigateUri="{Binding PipShowResult.HomePage}"/>
<TextBlock
TextWrapping="WrapWithOverflow"
Text="{Binding PipShowResult.Summary}" />
</StackPanel>
<!-- Loading indicator -->
<ProgressBar
Grid.Row="2"
Margin="32,16"
IsIndeterminate="True"
IsEnabled="{Binding IsLoading}"
IsVisible="{Binding IsLoading}"/>
</sg:SpacedGrid>
</DataTemplate>
</TransitioningContentControl.ContentTemplate>
</TransitioningContentControl>
<!--<Carousel
Grid.Row="2"
Grid.Column="2"
ItemsSource="{Binding Packages}"
AutoScrollToSelectedItem="True"
SelectedItem="{Binding SelectedPackage}">
<Carousel.PageTransition>
<CompositePageTransition>
<PageSlide Orientation="Vertical" Duration="0.167" >
~1~<PageSlide.SlideInEasing>
<SineEaseIn />
</PageSlide.SlideInEasing>
<PageSlide.SlideOutEasing>
<SineEaseOut />
</PageSlide.SlideOutEasing>@1@
</PageSlide>
~1~<CrossFade Duration="0.167" />@1@
</CompositePageTransition>
</Carousel.PageTransition>
<Carousel.ItemTemplate>
<DataTemplate DataType="{x:Type python:PipPackageInfo}">
<sg:SpacedGrid>
<TextBlock Theme="{DynamicResource BodyStrongTextBlockStyle}" Text="{Binding Name}"/>
</sg:SpacedGrid>
</DataTemplate>
</Carousel.ItemTemplate>
</Carousel>-->
</sg:SpacedGrid>
</controls:UserControlBase>