Skip to content

Commit

Permalink
perf: support download distributions in search
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraZiling committed Apr 14, 2024
1 parent 16d0bb8 commit d03064c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/PipManager/Languages/Lang.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/PipManager/Languages/Lang.resx
Original file line number Diff line number Diff line change
Expand Up @@ -732,4 +732,7 @@
<data name="ContentDialog_Message_CacheClearFailed" xml:space="preserve">
<value>Failed to clear caches</value>
</data>
<data name="Dialog_Title_DownloadDistributions" xml:space="preserve">
<value>Open download folder (for wheel files)</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/PipManager/Languages/Lang.zh-cn.resx
Original file line number Diff line number Diff line change
Expand Up @@ -732,4 +732,7 @@
<data name="ContentDialog_Message_CacheClearFailed" xml:space="preserve">
<value>清除缓存失败</value>
</data>
<data name="Dialog_Title_DownloadDistributions" xml:space="preserve">
<value>打开下载文件夹</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@ private void BrowseDownloadDistributionsFolderTask()
{
var openFolderDialog = new OpenFolderDialog
{
Title = "Download Folder (for wheel files)"
Title = Lang.Dialog_Title_DownloadDistributions
};
var result = openFolderDialog.ShowDialog();
if (result == true)
if (result != true)
{
DownloadDistributionsFolderPath = openFolderDialog.FolderName;
DownloadDistributionsEnabled = PreDownloadPackages.Count > 0;
return;
}

DownloadDistributionsFolderPath = openFolderDialog.FolderName;
DownloadDistributionsEnabled = PreDownloadPackages.Count > 0;
}

[RelayCommand]
Expand Down
20 changes: 18 additions & 2 deletions src/PipManager/ViewModels/Pages/Search/SearchDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Collections.ObjectModel;
using System.Drawing;
using System.Net.Http;
using Microsoft.Win32;
using PipManager.Models.Action;
using PipManager.Services.Action;
using PipManager.Services.Mask;
Expand Down Expand Up @@ -116,9 +117,24 @@ private void InitializeViewModel()
private string _targetVersion = "";

[RelayCommand]
private async Task DownloadPackage()
private void DownloadPackage()
{

var openFolderDialog = new OpenFolderDialog
{
Title = Lang.Dialog_Title_DownloadDistributions
};
var result = openFolderDialog.ShowDialog();
if (result != true)
{
return;
}
_actionService.AddOperation(new ActionListItem
(
ActionType.Download,
[$"{Package!.Name}=={TargetVersion}"],
path: openFolderDialog.FolderName,
extraParameters: ["--no-deps"]
));
}

[RelayCommand]
Expand Down

0 comments on commit d03064c

Please sign in to comment.