Skip to content

Commit

Permalink
chg - Finalized backports
Browse files Browse the repository at this point in the history
---

We've adjusted the backported code for this series.

---

Type: chg
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jan 3, 2025
1 parent cb5d50e commit 2f32cec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public static void InitRegisterConfig(TestContext tc)
[DataRow(nameof(KernelDriverConfig))]
[DataRow(nameof(KernelMainConfig))]
[DataRow(nameof(KernelSaverConfig))]
[DataRow(nameof(KernelSplashConfig))]
[DataRow(nameof(KernelWidgetsConfig))]
[Description("Management")]
public void TestCheckBuiltinConfig(string name)
Expand All @@ -77,7 +76,6 @@ public void TestCheckCustomConfig()
[DataRow(nameof(KernelDriverConfig))]
[DataRow(nameof(KernelMainConfig))]
[DataRow(nameof(KernelSaverConfig))]
[DataRow(nameof(KernelSplashConfig))]
[DataRow(nameof(KernelWidgetsConfig))]
[Description("Management")]
public void TestCheckBuiltinSettingsResourcesShallow(string name)
Expand All @@ -97,7 +95,6 @@ public void TestCheckBuiltinSettingsResourcesShallow(string name)
[DataRow(nameof(KernelDriverConfig))]
[DataRow(nameof(KernelMainConfig))]
[DataRow(nameof(KernelSaverConfig))]
[DataRow(nameof(KernelSplashConfig))]
[DataRow(nameof(KernelWidgetsConfig))]
[Description("Management")]
public void TestCheckBuiltinSettingsResourcesDeep(string name)
Expand Down Expand Up @@ -127,7 +124,6 @@ public void TestCheckBuiltinSettingsResourcesDeep(string name)
[DataRow(nameof(KernelDriverConfig))]
[DataRow(nameof(KernelMainConfig))]
[DataRow(nameof(KernelSaverConfig))]
[DataRow(nameof(KernelSplashConfig))]
[DataRow(nameof(KernelWidgetsConfig))]
[Description("Management")]
public void TestCheckBuiltinSettingsResourcesDeepEval(string name)
Expand Down
33 changes: 12 additions & 21 deletions public/Nitrocid/Shell/Homepage/HomepageTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,13 @@ public static void OpenHomepage()
ColorTools.LoadBack();

// Prepare the widget
var widget =
WidgetTools.CheckWidget(Config.MainConfig.HomepageWidget) ?
WidgetTools.GetWidget(Config.MainConfig.HomepageWidget) :
WidgetTools.GetWidget(nameof(AnalogClock));
if (Config.MainConfig.EnableHomepageWidgets)
{
int widgetLeft = ConsoleWrapper.WindowWidth / 2 + ConsoleWrapper.WindowWidth % 2;
int widgetWidth = ConsoleWrapper.WindowWidth / 2 - 4;
int widgetHeight = ConsoleWrapper.WindowHeight - 11;
int widgetTop = 2;
string widgetInit = widget.Initialize(widgetLeft + 1, widgetTop + 1, widgetWidth, widgetHeight);
TextWriterRaw.WriteRaw(widgetInit);
}
var widget = WidgetTools.GetWidget(nameof(AnalogClock));
int widgetLeft = ConsoleWrapper.WindowWidth / 2 + ConsoleWrapper.WindowWidth % 2;
int widgetWidth = ConsoleWrapper.WindowWidth / 2 - 4;
int widgetHeight = ConsoleWrapper.WindowHeight - 11;
int widgetTop = 2;
string widgetInit = widget.Initialize(widgetLeft + 1, widgetTop + 1, widgetWidth, widgetHeight);
TextWriterRaw.WriteRaw(widgetInit);

// Now, render the homepage
homeScreenBuffer.AddDynamicText(() =>
Expand Down Expand Up @@ -156,11 +150,8 @@ public static void OpenHomepage()
builder.Append(BorderColor.RenderBorder(widgetLeft, rssTop, widgetWidth, rssHeight, KernelColorTools.GetColor(KernelColorType.TuiPaneSelectedSeparator)));

// Render the widget
if (Config.MainConfig.EnableHomepageWidgets)
{
string widgetSeq = widget.Render(widgetLeft + 1, widgetTop + 1, widgetWidth, widgetHeight);
builder.Append(widgetSeq);
}
string widgetSeq = widget.Render(widgetLeft + 1, widgetTop + 1, widgetWidth, widgetHeight);
builder.Append(widgetSeq);

// Render the first three RSS feeds
if (string.IsNullOrEmpty(rssSequence))
Expand Down Expand Up @@ -292,8 +283,8 @@ void DoAction(int choiceIdx)
int aboutButtonEndPosX = aboutButtonStartPosX + buttonWidth + 1;
int aboutButtonEndPosY = aboutButtonStartPosY + buttonHeight + 1;
int clockTop = 3;
int widgetWidth = ConsoleWrapper.WindowWidth / 2 - 4;
int widgetHeight = ConsoleWrapper.WindowHeight - 13;
widgetWidth = ConsoleWrapper.WindowWidth / 2 - 4;
widgetHeight = ConsoleWrapper.WindowHeight - 13;
int optionsEndX = settingsButtonStartPosX + widgetWidth - 1 + ConsoleWrapper.WindowWidth % 2;
int optionsEndY = clockTop + widgetHeight + 1;

Expand Down Expand Up @@ -364,7 +355,7 @@ void DoAction(int choiceIdx)
{
render = true;
var keypress = Input.ReadKey();
int widgetHeight = ConsoleWrapper.WindowHeight - 10;
widgetHeight = ConsoleWrapper.WindowHeight - 10;
int currentPage = (choiceIdx - 1) / widgetHeight;
int startIndex = widgetHeight * currentPage;
int endIndex = widgetHeight * (currentPage + 1);
Expand Down

0 comments on commit 2f32cec

Please # to comment.