show projects v1

This commit is contained in:
Matt Parker
2025-11-03 18:13:00 +10:00
parent 77674c86cb
commit bbffc8ce18
2 changed files with 31 additions and 2 deletions

View File

@@ -10,11 +10,13 @@ public partial class NugetPackageDetails : VBoxContainer
private Label _packageNameLabel = null!;
private OptionButton _versionOptionButton = null!;
private OptionButton _nugetSourceOptionButton = null!;
private VBoxContainer _projectsVBoxContainer = null!;
private IdePackageResult? _package;
private readonly Texture2D _defaultIconTextureRect = ResourceLoader.Load<Texture2D>("uid://b5ih61vdjv5e6");
private readonly Texture2D _warningIconTextureRect = ResourceLoader.Load<Texture2D>("uid://pd3h5qfjn8pb");
private readonly PackedScene _packageDetailsProjectEntryScene = ResourceLoader.Load<PackedScene>("uid://5uan5u23cr2s");
[Inject] private readonly NugetPackageIconCacheService _nugetPackageIconCacheService = null!;
[Inject] private readonly NugetClientService _nugetClientService = null!;
@@ -24,7 +26,10 @@ public partial class NugetPackageDetails : VBoxContainer
_packageNameLabel = GetNode<Label>("%PackageNameLabel");
_versionOptionButton = GetNode<OptionButton>("%VersionOptionButton");
_nugetSourceOptionButton = GetNode<OptionButton>("%NugetSourceOptionButton");
_projectsVBoxContainer = GetNode<VBoxContainer>("%ProjectsVBoxContainer");
_nugetSourceOptionButton.ItemSelected += OnNugetSourceSelected;
_projectsVBoxContainer.QueueFreeChildren();
}
public async Task SetPackage(IdePackageResult package)
@@ -55,7 +60,18 @@ public partial class NugetPackageDetails : VBoxContainer
public async Task SetProjects(HashSet<SharpIdeProjectModel> projects)
{
var scenes = projects.Select(s =>
{
var scene = _packageDetailsProjectEntryScene.Instantiate<PackageDetailsProjectEntry>();
return scene;
}).ToList();
await this.InvokeAsync(() =>
{
foreach (var scene in scenes)
{
_projectsVBoxContainer.AddChild(scene);
}
});
}
private async void OnNugetSourceSelected(long sourceIndex)

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://odaefch2sdft"]
[gd_scene load_steps=4 format=3 uid="uid://odaefch2sdft"]
[ext_resource type="Script" uid="uid://d1v1v4uqdu2rw" path="res://Features/Nuget/NugetPackageDetails.cs" id="1_c3hm2"]
[ext_resource type="Texture2D" uid="uid://b5ih61vdjv5e6" path="res://Features/LeftSideBar/Resources/Nuget.svg" id="1_jrdf0"]
[ext_resource type="PackedScene" uid="uid://5uan5u23cr2s" path="res://Features/Nuget/PackageDetailsProjectEntry.tscn" id="3_tik62"]
[node name="NugetPackageDetails" type="VBoxContainer"]
anchors_preset = 15
@@ -9,6 +10,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 8
script = ExtResource("1_c3hm2")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
@@ -59,3 +61,14 @@ popup/item_0/id = 0
layout_mode = 2
folded = true
title = "Info - OpenTelemetry protocol exporter for OpenTelemetry .NET"
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_top = 10
[node name="ProjectsVBoxContainer" type="VBoxContainer" parent="MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="PackageDetailsProjectEntry" parent="MarginContainer/ProjectsVBoxContainer" instance=ExtResource("3_tik62")]
layout_mode = 2