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