From 1d8146d8ad8afe399e21188ea43b495666664c05 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 16 Feb 2021 22:24:44 +0100 Subject: [PATCH] login-app: give some precision to student after login --- pkg/login-app/cmd/dialog-reboot.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/pkg/login-app/cmd/dialog-reboot.go b/pkg/login-app/cmd/dialog-reboot.go index 97e3974..7f82340 100644 --- a/pkg/login-app/cmd/dialog-reboot.go +++ b/pkg/login-app/cmd/dialog-reboot.go @@ -14,7 +14,7 @@ func CreateRebootDialog(title, login string) *RebootDialog { dlg := new(RebootDialog) sWidth, sHeight := ui.ScreenSize() - wWidth, wHeight := 50, 10 + wWidth, wHeight := 48, 10 dlg.View = ui.AddWindow(sWidth/2-wWidth/2, sHeight/2-wHeight/2, wWidth, wHeight, title) ui.WindowManager().BeginUpdate() defer ui.WindowManager().EndUpdate() @@ -28,15 +28,26 @@ func CreateRebootDialog(title, login string) *RebootDialog { textfrm.SetPaddings(1, 1) textfrm.SetPack(ui.Vertical) textfrm.SetGaps(2, 1) - ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, "You are now successfully logged in as:", ui.Fixed) - ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, login, ui.Fixed) - ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, "Your computer will automatically", ui.Fixed) - ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, "reboot in a few seconds...", ui.Fixed) + lbl1 := ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, " You are now successfully logged in as:", ui.Fixed) + lbl1.SetTextColor(ui.ColorWhiteBold) - progress := ui.CreateProgressBar(textfrm, ui.AutoSize, ui.AutoSize, 1) + for i := 0; i <= wWidth/2-len(login)/2; i += 1 { + login = " " + login + } + lbl2 := ui.CreateLabel(textfrm, ui.AutoSize, ui.AutoSize, login, 1) + lbl2.SetTextColor(ui.ColorGreenBold) + + lbl3 := ui.CreateLabel(textfrm, 40, 2, " Your computer will automatically\n reboot in a few seconds...", ui.Fixed) + lbl3.SetMultiline(true) + + progress := ui.CreateProgressBar(textfrm, ui.AutoSize, ui.AutoSize, ui.Fixed) progress.SetLimits(0, 100) + lbl4 := ui.CreateLabel(textfrm, 40, 4, "\nThe challenge begins right after the reboot. Good luck!", ui.Fixed) + lbl4.SetTextColor(ui.ColorWhiteBold) + lbl4.SetMultiline(true) + go func() { for i := 0; i < 100; i += 1 { progress.SetValue(i)