subiquity/system_setup/ui/views/overview.py

51 lines
1.7 KiB
Python
Raw Normal View History

2021-07-16 16:19:11 +00:00
""" Overview
Overview provides user with the overview of all the current settings.
"""
2021-08-09 15:20:25 +00:00
import os
2021-07-16 16:19:11 +00:00
import logging
from subiquitycore.ui.buttons import done_btn
from subiquitycore.ui.utils import button_pile, screen
from subiquitycore.view import BaseView
log = logging.getLogger("ubuntu_wsl_oobe.ui.views.overview")
class OverviewView(BaseView):
title = _("Setup Complete")
def __init__(self, controller):
self.controller = controller
2021-08-09 15:20:25 +00:00
user_name = ""
with open('/var/run/ubuntu_wsl_oobe_assigned_account', 'r') as f:
user_name = f.read()
os.remove('/var/run/ubuntu_wsl_oobe_assigned_account')
2021-07-16 16:19:11 +00:00
complete_text = _("Hi {username},\n"
"You have complete the setup!\n\n"
2021-08-12 14:31:27 +00:00
"It is suggested to run the following command"
" to update your Ubuntu to the latest version:"
"\n\n\n"
2021-07-16 16:19:11 +00:00
" $ sudo apt update\n $ sudo apt upgrade\n\n\n"
2021-08-12 14:31:27 +00:00
"You can use the builtin `ubuntuwsl` command to "
"manage your WSL settings:\n\n\n"
2021-07-16 16:19:11 +00:00
" $ sudo ubuntuwsl ...\n\n\n"
2021-08-12 14:31:27 +00:00
"* All settings will take effect after first "
"restart of Ubuntu.").format(username=user_name)
2021-07-16 16:19:11 +00:00
super().__init__(
screen(
rows=[],
buttons=button_pile(
[done_btn(_("Done"), on_press=self.confirm), ]),
focus_buttons=True,
excerpt=complete_text,
)
)
def confirm(self, result):
self.controller.done(result)