diff --git a/src/PipManager/Languages/Lang.Designer.cs b/src/PipManager/Languages/Lang.Designer.cs index dd10534..4e1cc14 100644 --- a/src/PipManager/Languages/Lang.Designer.cs +++ b/src/PipManager/Languages/Lang.Designer.cs @@ -1203,6 +1203,15 @@ public static string LibraryInstall_Add_AlreadyInstalled { } } + /// + /// 查找类似 Default 的本地化字符串。 + /// + public static string LibraryInstall_Add_Header { + get { + return ResourceManager.GetString("LibraryInstall_Add_Header", resourceCulture); + } + } + /// /// 查找类似 Invalid Package Name (PEP 508) 的本地化字符串。 /// @@ -1239,6 +1248,15 @@ public static string LibraryInstall_Add_Verifying { } } + /// + /// 查找类似 Download Wheel File 的本地化字符串。 + /// + public static string LibraryInstall_Download_Header { + get { + return ResourceManager.GetString("LibraryInstall_Download_Header", resourceCulture); + } + } + /// /// 查找类似 Install 的本地化字符串。 /// @@ -1266,6 +1284,15 @@ public static string LibraryInstall_List_VersionSpecified { } } + /// + /// 查找类似 requirements.txt Import 的本地化字符串。 + /// + public static string LibraryInstall_Requirements_Header { + get { + return ResourceManager.GetString("LibraryInstall_Requirements_Header", resourceCulture); + } + } + /// /// 查找类似 About 的本地化字符串。 /// diff --git a/src/PipManager/Languages/Lang.resx b/src/PipManager/Languages/Lang.resx index 678612c..e32ba11 100644 --- a/src/PipManager/Languages/Lang.resx +++ b/src/PipManager/Languages/Lang.resx @@ -628,4 +628,13 @@ Other sources are faster to connect to, but may be incomplete. No output currently + + Default + + + requirements.txt Import + + + Download Wheel File + \ No newline at end of file diff --git a/src/PipManager/Languages/Lang.zh-cn.resx b/src/PipManager/Languages/Lang.zh-cn.resx index 3329d05..9a24f99 100644 --- a/src/PipManager/Languages/Lang.zh-cn.resx +++ b/src/PipManager/Languages/Lang.zh-cn.resx @@ -628,4 +628,13 @@ 当前无输出 + + 默认 + + + requirement.txt 导入 + + + 下载 Wheel 文件 + \ No newline at end of file diff --git a/src/PipManager/Models/Action/ActionListItem.cs b/src/PipManager/Models/Action/ActionListItem.cs index 2069aef..47aba8b 100644 --- a/src/PipManager/Models/Action/ActionListItem.cs +++ b/src/PipManager/Models/Action/ActionListItem.cs @@ -5,12 +5,17 @@ namespace PipManager.Models.Action; public partial class ActionListItem : ObservableObject { - public ActionListItem(ActionType operationType, string operationCommand, bool progressIntermediate = false, int totalSubTaskNumber = 1) + public ActionListItem(ActionType operationType, string operationCommand, string displayCommand = "", bool progressIntermediate = false, int totalSubTaskNumber = 1) { OperationType = operationType; OperationCommand = operationCommand; ProgressIntermediate = progressIntermediate; TotalSubTaskNumber = totalSubTaskNumber; + DisplayCommand = displayCommand switch + { + "" => operationCommand, + _ => displayCommand, + }; OperationDescription = operationType switch { ActionType.Uninstall => Lang.Action_Operation_Uninstall, @@ -47,6 +52,7 @@ public ActionListItem(ActionType operationType, string operationCommand, bool pr public string OperationDescription { get; set; } public string OperationTimestamp { get; set; } = DateTime.Now.ToLocalTime().ToString("yyyy-M-d HH:mm:ss"); public string OperationCommand { get; set; } + public string DisplayCommand { get; set; } public bool ProgressIntermediate { get; set; } public string BadgeAppearance { get; set; } diff --git a/src/PipManager/ViewModels/Pages/Library/LibraryInstallViewModel.cs b/src/PipManager/ViewModels/Pages/Library/LibraryInstallViewModel.cs index ceacb6e..229977d 100644 --- a/src/PipManager/ViewModels/Pages/Library/LibraryInstallViewModel.cs +++ b/src/PipManager/ViewModels/Pages/Library/LibraryInstallViewModel.cs @@ -8,6 +8,7 @@ using PipManager.Services.Environment; using PipManager.Services.Mask; using PipManager.Services.Toast; +using PipManager.Views.Pages.Action; using System.Collections.ObjectModel; using System.IO; using Wpf.Ui; @@ -28,14 +29,16 @@ public record InstalledPackagesMessage(List InstalledPackages); private readonly IContentDialogService _contentDialogService; private readonly IEnvironmentService _environmentService; private readonly IToastService _toastService; + private readonly INavigationService _navigationService; - public LibraryInstallViewModel(IActionService actionService, IMaskService maskService, IContentDialogService contentDialogService, IEnvironmentService environmentService, IToastService toastService) + public LibraryInstallViewModel(IActionService actionService, IMaskService maskService, IContentDialogService contentDialogService, IEnvironmentService environmentService, IToastService toastService, INavigationService navigationService) { _actionService = actionService; _maskService = maskService; _contentDialogService = contentDialogService; _environmentService = environmentService; _toastService = toastService; + _navigationService = navigationService; WeakReferenceMessenger.Default.Register(this, Receive); } @@ -153,7 +156,7 @@ private void AddRequirementsTask() Title = "requirements.txt", FileName = "requirements.txt", DefaultExt = ".txt", - Filter = "requirements|requirements.txt", + Filter = "requirements|*.txt", RestoreDirectory = true }; var result = openFileDialog.ShowDialog(); @@ -169,9 +172,11 @@ private void AddRequirementsToAction() _actionService.AddOperation(new ActionListItem ( ActionType.InstallByRequirements, - Requirements + Requirements, + displayCommand: "requirements.txt" )); Requirements = ""; + _navigationService.Navigate(typeof(ActionPage)); } #endregion Requirements Import diff --git a/src/PipManager/Views/Pages/Action/ActionPage.xaml b/src/PipManager/Views/Pages/Action/ActionPage.xaml index 46aa89b..6763505 100644 --- a/src/PipManager/Views/Pages/Action/ActionPage.xaml +++ b/src/PipManager/Views/Pages/Action/ActionPage.xaml @@ -92,7 +92,7 @@ Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" - Text="{Binding OperationCommand}" + Text="{Binding DisplayCommand}" TextWrapping="WrapWithOverflow" /> diff --git a/src/PipManager/Views/Pages/Library/LibraryInstallPage.xaml b/src/PipManager/Views/Pages/Library/LibraryInstallPage.xaml index 16e8d15..923119a 100644 --- a/src/PipManager/Views/Pages/Library/LibraryInstallPage.xaml +++ b/src/PipManager/Views/Pages/Library/LibraryInstallPage.xaml @@ -32,7 +32,7 @@ Margin="0,0,6,0" Filled="True" Symbol="AppsAddIn24" /> - + @@ -118,7 +118,7 @@ Margin="0,0,6,0" Filled="True" Symbol="ArrowImport24" /> - + @@ -157,7 +157,7 @@ Margin="0,0,6,0" Filled="True" Symbol="ArrowDownload24" /> - +