Browse Source

fix package manager page

pull/55/head
JT 1 year ago
parent
commit
bfa969eb95
  1. 6
      StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs
  2. 5
      StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs
  3. 6
      StabilityMatrix.Avalonia/Views/MainWindow.axaml
  4. 4
      StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml

6
StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs

@ -46,8 +46,8 @@ public partial class LaunchPageViewModel : PageViewModelBase
{ {
var info = new ProcessStartInfo var info = new ProcessStartInfo
{ {
FileName = "py", FileName = "python",
WorkingDirectory = "py", //WorkingDirectory = "py",
Arguments = "-uc \"import tqdm, time; print('start'); [time.sleep(0.1) for _ in tqdm.tqdm(range(25))]; print('end')\"" Arguments = "-uc \"import tqdm, time; print('start'); [time.sleep(0.1) for _ in tqdm.tqdm(range(25))]; print('end')\""
}; };
@ -61,7 +61,7 @@ public partial class LaunchPageViewModel : PageViewModelBase
private void OnProcessOutputReceived(ProcessOutput output) private void OnProcessOutputReceived(ProcessOutput output)
{ {
var raw = output.RawText; var raw = output.RawText;
// Replace /n and /r with literals // Replace \n and \r with literals
raw = raw.Replace("\n", "\\n").Replace("\r", "\\r"); raw = raw.Replace("\n", "\\n").Replace("\r", "\\r");
Debug.WriteLine($"output raw: '{raw}', output: '{output.Text}', clear lines: {output.ClearLines}"); Debug.WriteLine($"output raw: '{raw}', output: '{output.Text}', clear lines: {output.ClearLines}");
Debug.Flush(); Debug.Flush();

5
StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs

@ -33,6 +33,11 @@ public partial class PackageManagerViewModel : PageViewModelBase
Packages = new ObservableCollection<InstalledPackage>(settingsManager.Settings.InstalledPackages); Packages = new ObservableCollection<InstalledPackage>(settingsManager.Settings.InstalledPackages);
} }
public PackageManagerViewModel() : this(new SettingsManager(), null!)
{
}
[NotifyPropertyChangedFor(nameof(ProgressBarVisibility))] [NotifyPropertyChangedFor(nameof(ProgressBarVisibility))]
[ObservableProperty] [ObservableProperty]
private int progressValue; private int progressValue;

6
StabilityMatrix.Avalonia/Views/MainWindow.axaml

@ -11,7 +11,9 @@
x:Class="StabilityMatrix.Avalonia.Views.MainWindow" x:Class="StabilityMatrix.Avalonia.Views.MainWindow"
x:DataType="vm:MainWindowViewModel" x:DataType="vm:MainWindowViewModel"
Icon="/Assets/Icon.ico" Icon="/Assets/Icon.ico"
Title="StabilityMatrix.Avalonia"> Width="900"
Height="650"
Title="Stability Matrix Avalonia">
<Design.DataContext> <Design.DataContext>
<vm:MainWindowViewModel /> <vm:MainWindowViewModel />
@ -56,6 +58,8 @@
Grid.RowSpan="2" Grid.RowSpan="2"
AlwaysShowHeader="False" AlwaysShowHeader="False"
PaneDisplayMode="Left" PaneDisplayMode="Left"
IsPaneOpen="False"
OpenPaneLength="200"
Content="{Binding CurrentPage}" Content="{Binding CurrentPage}"
MenuItemsSource="{Binding Pages, Mode=OneWay}" MenuItemsSource="{Binding Pages, Mode=OneWay}"
SelectedItem="{Binding SelectedCategory}" SelectedItem="{Binding SelectedCategory}"

4
StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml

@ -45,7 +45,6 @@
Command="{Binding ShowInstallWindowCommand}" Command="{Binding ShowInstallWindowCommand}"
Height="40" Height="40"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
IsEnabled="{Binding InstallButtonEnabled, FallbackValue=True}"
Margin="0,0,0,16" Margin="0,0,0,16"
VerticalContentAlignment="Center"> VerticalContentAlignment="Center">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
@ -59,8 +58,7 @@
<ListBox <ListBox
ItemsSource="{Binding Packages}" ItemsSource="{Binding Packages}"
SelectedItem="{Binding SelectedPackage, Mode=TwoWay}" SelectedItem="{Binding SelectedPackage, Mode=TwoWay}">
IsVisible="{Binding InstallButtonVisibility, FallbackValue=True}">
<ListBox.Template> <ListBox.Template>
<ControlTemplate> <ControlTemplate>

Loading…
Cancel
Save