remove SimpleList
and the Body widget, both utterly trivial
This commit is contained in:
parent
752b15eac3
commit
bd48ed9b1d
|
@ -16,8 +16,8 @@
|
|||
import logging
|
||||
from urwid import Text
|
||||
|
||||
from subiquitycore.ui.lists import SimpleList
|
||||
from subiquitycore.ui.buttons import done_btn
|
||||
from subiquitycore.ui.container import ListBox
|
||||
from subiquitycore.ui.utils import button_pile, Padding
|
||||
from subiquitycore.view import BaseView
|
||||
|
||||
|
@ -40,7 +40,7 @@ class DiskInfoView(BaseView):
|
|||
for h in hdinfo:
|
||||
body.append(Text(h))
|
||||
body.append(self._build_buttons())
|
||||
super().__init__(Padding.center_79(SimpleList(body)))
|
||||
super().__init__(Padding.center_79(ListBox(body)))
|
||||
|
||||
def _build_buttons(self):
|
||||
return button_pile([done_btn(_("Done"), on_press=self.done)])
|
||||
|
|
|
@ -20,9 +20,8 @@ Welcome provides user with language selection
|
|||
"""
|
||||
import logging
|
||||
from urwid import Text
|
||||
from subiquitycore.ui.lists import SimpleList
|
||||
from subiquitycore.ui.buttons import forward_btn
|
||||
from subiquitycore.ui.container import Pile
|
||||
from subiquitycore.ui.container import Pile, ListBox
|
||||
from subiquitycore.ui.utils import Padding
|
||||
from subiquitycore.view import BaseView
|
||||
|
||||
|
@ -45,16 +44,16 @@ class WelcomeView(BaseView):
|
|||
]))
|
||||
|
||||
def _build_model_inputs(self):
|
||||
sl = []
|
||||
btns = []
|
||||
current_index = None
|
||||
for i, (code, native) in enumerate(self.model.get_languages()):
|
||||
if code == self.model.selected_language:
|
||||
current_index = i
|
||||
sl.append(forward_btn(label=native, on_press=self.confirm, user_arg=code))
|
||||
btns.append(forward_btn(label=native, on_press=self.confirm, user_arg=code))
|
||||
|
||||
lb = SimpleList(sl)
|
||||
lb = ListBox(btns)
|
||||
if current_index is not None:
|
||||
lb._w.base_widget.focus_position = current_index
|
||||
lb.base_widget.focus_position = current_index
|
||||
return lb
|
||||
|
||||
def confirm(self, sender, code):
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
from urwid import WidgetWrap, Pile, Text, ProgressBar
|
||||
from subiquitycore.ui.utils import Padding, Color
|
||||
from subiquitycore.ui.lists import SimpleList
|
||||
|
||||
|
||||
class Header(WidgetWrap):
|
||||
|
@ -64,11 +63,3 @@ class Footer(WidgetWrap):
|
|||
message_widget,
|
||||
]
|
||||
super().__init__(Color.frame_footer(Pile(status)))
|
||||
|
||||
|
||||
class Body(WidgetWrap):
|
||||
""" Body widget
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(SimpleList([Text("")]))
|
||||
|
|
|
@ -15,8 +15,13 @@
|
|||
|
||||
""" Base Frame Widget """
|
||||
|
||||
from urwid import Frame, WidgetWrap
|
||||
from subiquitycore.ui.anchors import Header, Footer, Body
|
||||
from urwid import (
|
||||
Frame,
|
||||
Text,
|
||||
WidgetWrap,
|
||||
)
|
||||
from subiquitycore.ui.anchors import Header, Footer
|
||||
from subiquitycore.ui.container import ListBox
|
||||
from subiquitycore.ui.utils import Color
|
||||
import logging
|
||||
|
||||
|
@ -28,9 +33,8 @@ class SubiquityUI(WidgetWrap):
|
|||
|
||||
def __init__(self):
|
||||
self.header = Header("")
|
||||
self.body = Body()
|
||||
self.footer = Footer("", 0, 1)
|
||||
self.frame = Frame(self.body, header=self.header, footer=self.footer)
|
||||
self.frame = Frame(ListBox([Text("")]), header=self.header, footer=self.footer)
|
||||
self.progress_current = 0
|
||||
self.progress_completion = 0
|
||||
super().__init__(Color.body(self.frame))
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# 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/>.
|
||||
|
||||
from urwid import SimpleFocusListWalker, WidgetWrap
|
||||
|
||||
from subiquitycore.ui.container import ListBox
|
||||
|
||||
|
||||
class SimpleList(WidgetWrap):
|
||||
def __init__(self, contents, is_selectable=True):
|
||||
self.contents = contents
|
||||
self.is_selectable = is_selectable
|
||||
super().__init__(self._build_widget())
|
||||
|
||||
def _build_widget(self):
|
||||
lw = SimpleFocusListWalker(list(self.contents))
|
||||
|
||||
return ListBox(lw)
|
||||
|
||||
def selectable(self):
|
||||
return self.is_selectable
|
Loading…
Reference in New Issue