sln picker styling

This commit is contained in:
Matt Parker
2025-09-30 18:35:15 +10:00
parent 4473ab17a6
commit d59c793263
3 changed files with 69 additions and 11 deletions

View File

@@ -5,22 +5,20 @@ namespace SharpIDE.Godot.Features.SlnPicker;
public partial class SlnPicker : Control
{
private FileDialog _fileDialog = null!;
private Button _openSlnButton = null!;
private readonly TaskCompletionSource<string?> _tcs = new TaskCompletionSource<string?>(TaskCreationOptions.RunContinuationsAsynchronously);
public override void _Ready()
{
_fileDialog = GetNode<FileDialog>("%FileDialog");
_openSlnButton = GetNode<Button>("%OpenSlnButton");
_openSlnButton.Pressed += () => _fileDialog.PopupCentered();
_fileDialog.FileSelected += path => _tcs.SetResult(path);
_fileDialog.Canceled += () => _tcs.SetResult(null);
}
public async Task<string?> GetSelectedSolutionPath()
{
var tcs = new TaskCompletionSource<string?>(TaskCreationOptions.RunContinuationsAsynchronously);
await this.InvokeAsync(() =>
{
_fileDialog.FileSelected += path => tcs.SetResult(path);
_fileDialog.Canceled += () => tcs.SetResult(null);
_fileDialog.PopupCentered();
});
var selectedPath = await tcs.Task;
return selectedPath;
return await _tcs.Task;
}
}
}

View File

@@ -11,6 +11,65 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ciq0g")
[node name="VSplitContainer" type="HSplitContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
split_offset = 245
dragging_enabled = false
dragger_visibility = 2
[node name="MarginContainer" type="MarginContainer" parent="VSplitContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="VBoxContainer" type="VBoxContainer" parent="VSplitContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VSplitContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "SharpIDE"
[node name="Panel" type="Panel" parent="VSplitContainer"]
layout_mode = 2
[node name="MarginContainer2" type="MarginContainer" parent="VSplitContainer/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="VBoxContainer2" type="VBoxContainer" parent="VSplitContainer/Panel/MarginContainer2"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VSplitContainer/Panel/MarginContainer2/VBoxContainer2"]
layout_mode = 2
[node name="LineEdit" type="LineEdit" parent="VSplitContainer/Panel/MarginContainer2/VBoxContainer2/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Search Projects"
[node name="OpenSlnButton" type="Button" parent="VSplitContainer/Panel/MarginContainer2/VBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Open Sln File"
[node name="HSeparator" type="HSeparator" parent="VSplitContainer/Panel/MarginContainer2/VBoxContainer2"]
layout_mode = 2
[node name="FileDialog" type="FileDialog" parent="."]
unique_name_in_owner = true
oversampling_override = 1.0

View File

@@ -21,6 +21,7 @@ public partial class IdeWindow : Control
{
MSBuildLocator.RegisterDefaults();
GodotServiceDefaults.AddServiceDefaults();
//GetWindow().SetMinSize(new Vector2I(1152, 648));
PickSolution();
}