system_setup: update Summary code
This commit is contained in:
parent
1aac580dfd
commit
365769c365
|
@ -1,5 +1,3 @@
|
||||||
import os
|
|
||||||
import pwd
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
@ -85,21 +83,10 @@ class SummaryController(SubiquityTuiController):
|
||||||
|
|
||||||
async def make_ui(self):
|
async def make_ui(self):
|
||||||
real_name = ""
|
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")
|
identity = getattr(self.app.client, "identity")
|
||||||
if identity is not None:
|
if identity is not None:
|
||||||
data = await identity.GET()
|
data = await identity.GET()
|
||||||
real_name = data.realname
|
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)
|
self.summary_view = SummaryView(self, real_name)
|
||||||
# We may reach the DONE or ERROR state even before we had a chance
|
# We may reach the DONE or ERROR state even before we had a chance
|
||||||
# to show the UI.
|
# to show the UI.
|
||||||
|
|
|
@ -25,14 +25,18 @@ class SummaryView(BaseView):
|
||||||
|
|
||||||
def __init__(self, controller, real_name):
|
def __init__(self, controller, real_name):
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
complete_text = _("Hi {real_name},\n\n"
|
complete_text = _("You have completed the setup!\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 "
|
"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(
|
self.reboot_btn = Toggleable(ok_btn(
|
||||||
_("Reboot Now"), on_press=self.reboot))
|
_("Reboot Now"), on_press=self.reboot))
|
||||||
|
|
Loading…
Reference in New Issue