2015-07-24 14:56:48 +00:00
|
|
|
# Copyright 2015 Canonical, Ltd.
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-08-24 03:55:45 +00:00
|
|
|
import logging
|
|
|
|
from urwid import (Text, Filler,
|
2015-09-25 02:30:04 +00:00
|
|
|
Pile)
|
2016-06-30 18:17:01 +00:00
|
|
|
from subiquitycore.view import ViewPolicy
|
|
|
|
from subiquitycore.ui.buttons import confirm_btn
|
|
|
|
from subiquitycore.ui.utils import Padding, Color
|
2015-07-24 14:56:48 +00:00
|
|
|
|
2016-06-30 18:17:01 +00:00
|
|
|
log = logging.getLogger("subiquitycore.views.installprogress")
|
2015-07-24 14:56:48 +00:00
|
|
|
|
2015-08-24 03:55:45 +00:00
|
|
|
|
2015-07-24 14:56:48 +00:00
|
|
|
class ProgressView(ViewPolicy):
|
2015-10-29 20:58:51 +00:00
|
|
|
def __init__(self, model, signal):
|
2015-07-24 14:56:48 +00:00
|
|
|
"""
|
|
|
|
:param output_w: Filler widget to display updated status text
|
|
|
|
"""
|
2015-10-29 20:58:51 +00:00
|
|
|
self.model = model
|
2015-08-24 03:55:45 +00:00
|
|
|
self.signal = signal
|
2015-12-04 15:07:21 +00:00
|
|
|
self.text = Text("Wait for it ...", align="left")
|
2015-07-24 14:56:48 +00:00
|
|
|
self.body = [
|
2015-11-03 19:08:15 +00:00
|
|
|
Padding.center_79(self.text),
|
|
|
|
Padding.line_break(""),
|
2015-07-24 14:56:48 +00:00
|
|
|
]
|
2015-09-25 19:57:29 +00:00
|
|
|
self.pile = Pile(self.body)
|
|
|
|
super().__init__(Filler(self.pile, valign="middle"))
|
|
|
|
|
|
|
|
def show_finished_button(self):
|
2015-11-20 15:57:14 +00:00
|
|
|
w = Padding.fixed_20(
|
2015-09-25 19:57:29 +00:00
|
|
|
Color.button(confirm_btn(label="Reboot now",
|
|
|
|
on_press=self.reboot),
|
|
|
|
focus_map='button focus'))
|
|
|
|
|
2015-11-20 15:57:14 +00:00
|
|
|
z = Padding.fixed_20(
|
2015-11-03 19:08:15 +00:00
|
|
|
Color.button(confirm_btn(label="Quit Installer",
|
|
|
|
on_press=self.quit),
|
|
|
|
focus_map='button focus'))
|
|
|
|
|
2015-09-25 19:57:29 +00:00
|
|
|
self.pile.contents.append((w, self.pile.options()))
|
2015-11-03 19:08:15 +00:00
|
|
|
self.pile.contents.append((z, self.pile.options()))
|
|
|
|
self.pile.focus_position = 2
|
2015-09-25 19:57:29 +00:00
|
|
|
|
|
|
|
def reboot(self, btn):
|
|
|
|
self.signal.emit_signal('installprogress:curtin-reboot')
|
2015-11-03 19:08:15 +00:00
|
|
|
|
|
|
|
def quit(self, btn):
|
|
|
|
self.signal.emit_signal('quit')
|