make ProgressView a lot better
mostly by putting the logtail in a box
This commit is contained in:
parent
a4d6682478
commit
fcd5163101
|
@ -148,6 +148,8 @@ class InstallProgressController(BaseController):
|
|||
raise Exception('AIEEE!')
|
||||
|
||||
self.install_state = InstallState.RUNNING_POSTINSTALL
|
||||
if self.progress_view is not None:
|
||||
self.progress_view.set_status("Running postinstall step.")
|
||||
if self.opts.dry_run:
|
||||
log.debug("Installprogress: this is a dry-run")
|
||||
curtin_cmd = [
|
||||
|
@ -176,7 +178,6 @@ class InstallProgressController(BaseController):
|
|||
self.install_state = InstallState.DONE_POSTINSTALL
|
||||
|
||||
def progress_indicator(self, *args, **kwargs):
|
||||
log.debug('progress_indicator')
|
||||
if self.install_state == InstallState.ERROR:
|
||||
log.debug('progress_indicator: error detected')
|
||||
self.curtin_error()
|
||||
|
@ -209,6 +210,10 @@ class InstallProgressController(BaseController):
|
|||
self.ui.set_header(title, excerpt)
|
||||
self.ui.set_footer(footer, 90)
|
||||
self.progress_view = ProgressView(self.model, self)
|
||||
if self.install_state < InstallState.RUNNING_POSTINSTALL:
|
||||
self.progress_view.set_status("Running install step.")
|
||||
else:
|
||||
self.progress_view.set_status("Running postinstall step.")
|
||||
self.ui.set_body(self.progress_view)
|
||||
|
||||
self.progress_indicator()
|
||||
|
|
|
@ -14,13 +14,16 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from urwid import (Text, Filler,
|
||||
Pile)
|
||||
from urwid import (
|
||||
LineBox,
|
||||
ListBox,
|
||||
Text,
|
||||
Pile,
|
||||
)
|
||||
|
||||
from subiquitycore.view import BaseView
|
||||
from subiquitycore.ui.buttons import confirm_btn
|
||||
from subiquitycore.ui.utils import Padding, Color
|
||||
from subiquitycore import utils
|
||||
|
||||
log = logging.getLogger("subiquity.views.installprogress")
|
||||
|
||||
|
@ -29,22 +32,30 @@ class ProgressView(BaseView):
|
|||
def __init__(self, model, controller):
|
||||
self.model = model
|
||||
self.controller = controller
|
||||
self.text = Text("Installing Ubuntu ...", align="left")
|
||||
self.body = [
|
||||
Padding.center_79(self.text),
|
||||
Padding.line_break(""),
|
||||
self.error = Text("")
|
||||
self.status = Text("Running install step.")
|
||||
self.log = Text("<log goes here>")
|
||||
body = [
|
||||
('pack', Padding.center_79(self.error)),
|
||||
('pack', Padding.center_79(self.status)),
|
||||
('pack', Text("")),
|
||||
('weight', 1, Padding.center_79(LineBox(ListBox([self.log]), title="Installation logs"))),
|
||||
('pack', Text("")),
|
||||
]
|
||||
self.pile = Pile(self.body)
|
||||
super().__init__(Filler(self.pile, valign="middle"))
|
||||
self.pile = Pile(body)
|
||||
super().__init__(self.pile)
|
||||
|
||||
def set_log_tail(self, text):
|
||||
self.text.set_text(text)
|
||||
self.log.set_text(text)
|
||||
|
||||
def set_status(self, text):
|
||||
self.status.set_text(text)
|
||||
|
||||
def set_error(self, text):
|
||||
self.text.set_text(text)
|
||||
self.error.set_text(text)
|
||||
|
||||
def show_complete(self):
|
||||
self.text.set_text("Finished install!")
|
||||
self.status.set_text("Finished install!")
|
||||
w = Padding.fixed_20(
|
||||
Color.button(confirm_btn(label="Reboot now",
|
||||
on_press=self.reboot),
|
||||
|
@ -55,9 +66,11 @@ class ProgressView(BaseView):
|
|||
on_press=self.quit),
|
||||
focus_map='button focus'))
|
||||
|
||||
self.pile.contents.append((w, self.pile.options()))
|
||||
self.pile.contents.append((z, self.pile.options()))
|
||||
self.pile.focus_position = 2
|
||||
new_focus = len(self.pile.contents)
|
||||
self.pile.contents.append((w, self.pile.options('pack')))
|
||||
self.pile.contents.append((z, self.pile.options('pack')))
|
||||
self.pile.contents.append((Text(""), self.pile.options('pack')))
|
||||
self.pile.focus_position = new_focus
|
||||
|
||||
def reboot(self, btn):
|
||||
self.controller.reboot()
|
||||
|
|
Loading…
Reference in New Issue