Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ProjectDirector/ProjectDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using ktsu.ImGui.Widgets;
using ktsu.ImGui.Styler;
using Octokit;
// using OpenAI.Chat;

Check warning on line 22 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
using Semantics.Paths;

#pragma warning disable CA1506
Expand Down Expand Up @@ -62,7 +62,7 @@
/// </summary>
private CloneTracker Clones { get; } = new();

// private ChatClient ChatClient { get; init; }

Check warning on line 65 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.

private static void Main(string[] _) => ImGuiApp.Start(new ProjectDirector().BuildConfig());

Expand All @@ -77,6 +77,9 @@
internal ImGuiAppConfig BuildConfig() => new()
{
Title = "Project Director",

// The options are loaded by the constructor, so this is the state the last run saved.
InitialWindowState = Options.WindowState,
OnAppMenu = ShowMenu,
OnMoveOrResize = WindowResized,
OnRender = Tick,
Expand All @@ -101,7 +104,7 @@
_ = MakeLoadedOptionsSafe(Options, QueueLog);

Options.Save();
// ChatClient = new(model: "gpt-4o", new ApiKeyCredential(Options.OpenAIToken));

Check warning on line 107 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
DividerDiff = new("DiffDivider", DividerResized, ImGuiWidgets.DividerLayout.Columns);
DividerContainerCols = new("VerticalDivider", DividerResized, ImGuiWidgets.DividerLayout.Columns);
DividerContainerRows = new("HorizontalDivider", DividerResized, ImGuiWidgets.DividerLayout.Rows);
Expand Down Expand Up @@ -423,7 +426,7 @@
private void FetchAllRepos() => Options.ClonedRepos.Values.ForEach(FetchRepo);
private void PullAllRepos() => Options.ClonedRepos.Values.ForEach(PullRepo);

private void FetchRepo(FullyQualifiedGitHubRepoName repoName)

Check warning on line 429 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

All 'FetchRepo' method overloads should be adjacent.
{
if (Options.Repos.TryGetValue(repoName, out GitRepository? repo))
{
Expand Down Expand Up @@ -765,7 +768,7 @@
});
}

//int fetchInterval = repo.MinFetchIntervalSeconds;

Check warning on line 771 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
//if (ImGuiWidgets.Knob("Min Fetch Interval", ref fetchInterval, 0, 300, 150))
//{
// repo.MinFetchIntervalSeconds = fetchInterval;
Expand Down Expand Up @@ -2298,7 +2301,7 @@

if (ImGui.TableNextColumn())
{
//if (ImGui.Button($"Propagate Directory###Propagate{path.Replace(Path.DirectorySeparatorChar, '.').Replace(Path.AltDirectorySeparatorChar, '.')}"))

Check warning on line 2304 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
//{
// shouldOpenPopup |= true;
// Options.PropagatePath = path;
Expand All @@ -2307,7 +2310,7 @@

if (ImGui.TableNextColumn())
{
//if (ImGui.Button($"X"))

Check warning on line 2313 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
//{
// //Directory.Delete(Path.Combine(Options.Repos[Options.BaseRepo].LocalPath, Options.BrowsePath, path));
//}
Expand Down Expand Up @@ -2352,7 +2355,7 @@

}

// if (ImGui.Selectable($"Generate Readme"))

Check warning on line 2358 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
// {
// GitRepository repo = Options.Repos[Options.BaseRepo];
// IEnumerable<string> csFiles = Directory.EnumerateFiles(repo.LocalPath, "*.cs", SearchOption.AllDirectories);
Expand Down Expand Up @@ -2383,13 +2386,13 @@

if (ImGui.TableNextColumn())//&& ImGui.Button($"Propagate###Propagate{path.Replace(Path.DirectorySeparatorChar, '.').Replace(Path.AltDirectorySeparatorChar, '.')}"))
{
//shouldOpenPopup |= true;

Check warning on line 2389 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
//Options.PropagatePath = path;
}

if (ImGui.TableNextColumn())
{
//if (ImGui.Button($"X"))

Check warning on line 2395 in ProjectDirector/ProjectDirector.cs

View workflow job for this annotation

GitHub Actions / ci / .NET / Analyze & Release

Remove this commented out code.
//{
// //File.Delete(Path.Combine(Options.Repos[Options.BaseRepo].LocalPath, Options.BrowsePath, path));
//}
Expand Down
46 changes: 46 additions & 0 deletions tests/ProjectDirector.UITests/WindowStateTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2023-2026 ktsu-dev contributors

namespace ktsu.ProjectDirector.UITests;

using System.IO.Abstractions.TestingHelpers;
using System.Numerics;

using ktsu.AppDataStorage;
using ktsu.ImGui.App;

using Silk.NET.Windowing;

/// <summary>
/// The window's size, position and layout, which the application saves whenever the window moves
/// or resizes, and starts the next run with.
/// </summary>
[TestClass]
public sealed class WindowStateTests
{
[TestMethod]
public void BuildConfig_StartsTheWindowWhereTheSavedOptionsLeftIt()
{
AppData.ConfigureForTesting(() => new MockFileSystem());
try
{
ImGuiAppWindowState saved = new()
{
Size = new Vector2(1600, 1000),
Pos = new Vector2(2000, 150),
LayoutState = WindowState.Maximized,
};
Assert.AreNotEqual(saved.LayoutState, new ImGuiAppWindowState().LayoutState, "The default layout is already maximized, so this would prove nothing.");

using ProjectDirectorOptions options = new() { WindowState = saved };
ImGuiAppConfig config = new ProjectDirector(options).BuildConfig();

Assert.AreEqual(saved.Size, config.InitialWindowState.Size);
Assert.AreEqual(saved.Pos, config.InitialWindowState.Pos);
Assert.AreEqual(saved.LayoutState, config.InitialWindowState.LayoutState);
}
finally
{
AppData.ResetFileSystem();
}
}
}
Loading