From 365769c3655bd507247b50464a5430f08ed3f5f1 Mon Sep 17 00:00:00 2001 From: Patrick Wu Date: Tue, 14 Sep 2021 22:48:46 +0800 Subject: [PATCH] system_setup: update Summary code --- system_setup/client/controllers/summary.py | 13 ------------- system_setup/ui/views/summary.py | 18 +++++++++++------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/system_setup/client/controllers/summary.py b/system_setup/client/controllers/summary.py index c521a816..7616af60 100644 --- a/system_setup/client/controllers/summary.py +++ b/system_setup/client/controllers/summary.py @@ -1,5 +1,3 @@ -import os -import pwd import aiohttp import asyncio import logging @@ -85,21 +83,10 @@ class SummaryController(SubiquityTuiController): async def make_ui(self): real_name = "" - - tmp_variant = "wsl_setup" - onsite_variant = getattr(self.app, "variant") - if onsite_variant is not None: - tmp_variant = onsite_variant - identity = getattr(self.app.client, "identity") if identity is not None: data = await identity.GET() real_name = data.realname - if tmp_variant == "wsl_configuration": - tmp_uid = os.getuid() - if tmp_uid >= 1000 and tmp_uid < 65534: - real_name = pwd.getpwuid(tmp_uid)[0] - self.summary_view = SummaryView(self, real_name) # We may reach the DONE or ERROR state even before we had a chance # to show the UI. diff --git a/system_setup/ui/views/summary.py b/system_setup/ui/views/summary.py index a65e4019..19df7823 100644 --- a/system_setup/ui/views/summary.py +++ b/system_setup/ui/views/summary.py @@ -25,14 +25,18 @@ class SummaryView(BaseView): def __init__(self, controller, real_name): self.controller = controller - complete_text = _("Hi {real_name},\n\n" - "You have completed the setup!\n\n" - "It is suggested to run the following commands" - " to update your Ubuntu to the latest version:" - "\n\n\n" - " $ sudo apt update\n $ sudo apt upgrade\n\n\n" + complete_text = _("You have completed the setup!\n\n" "All settings will take effect after next " - "restart of Ubuntu.").format(real_name=real_name) + "restart of Ubuntu.") + if real_name != '': + complete_text = _("Hi {real_name},\n\n" + "You have completed the setup!\n\n" + "It is suggested to run the following commands" + " to update your Ubuntu to the latest version:" + "\n\n\n" + " $ sudo apt update\n $ sudo apt upgrade\n\n\n" + "All settings will take effect after next " + "restart of Ubuntu.").format(real_name=real_name) self.reboot_btn = Toggleable(ok_btn( _("Reboot Now"), on_press=self.reboot))