Drop Installpath
This commit is contained in:
parent
6df3f5c2af
commit
e46de5def8
|
@ -15,7 +15,6 @@
|
|||
|
||||
from .filesystem import FilesystemController
|
||||
from .identity import IdentityController
|
||||
from .installpath import InstallpathController
|
||||
from .installprogress import InstallProgressController
|
||||
from .keyboard import KeyboardController
|
||||
from .proxy import ProxyController
|
||||
|
@ -28,7 +27,6 @@ from .welcome import WelcomeController
|
|||
__all__ = [
|
||||
'FilesystemController',
|
||||
'IdentityController',
|
||||
'InstallpathController',
|
||||
'InstallProgressController',
|
||||
'KeyboardController',
|
||||
'ProxyController',
|
||||
|
|
|
@ -1,67 +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/>.
|
||||
|
||||
import logging
|
||||
|
||||
from subiquitycore.controller import BaseController
|
||||
|
||||
from subiquity.ui.views import InstallpathView
|
||||
|
||||
log = logging.getLogger('subiquity.controller.installpath')
|
||||
|
||||
|
||||
class InstallpathController(BaseController):
|
||||
|
||||
def __init__(self, common):
|
||||
super().__init__(common)
|
||||
self.model = self.base_model.installpath
|
||||
self.answers = self.all_answers.get("Installpath", {})
|
||||
self.release = None
|
||||
|
||||
def default(self):
|
||||
self.ui.set_body(InstallpathView(self.model, self))
|
||||
if 'path' in self.answers:
|
||||
path = self.answers['path']
|
||||
self.model.path = path
|
||||
if path == 'ubuntu':
|
||||
self.install_ubuntu()
|
||||
else:
|
||||
self.model.update(self.answers)
|
||||
log.debug(
|
||||
"InstallpathController.default next-screen answers=%s",
|
||||
self.answers)
|
||||
self.signal.emit_signal('next-screen')
|
||||
|
||||
def cancel(self):
|
||||
self.signal.emit_signal('prev-screen')
|
||||
|
||||
def serialize(self):
|
||||
return {'path': self.model.path, 'results': self.model.results}
|
||||
|
||||
def deserialize(self, data):
|
||||
self.model.path = data['path']
|
||||
self.model.results = data['results']
|
||||
|
||||
def choose_path(self, path):
|
||||
self.model.path = path
|
||||
getattr(self, 'install_' + path)()
|
||||
|
||||
def install_ubuntu(self):
|
||||
log.debug("InstallpathController.install_ubuntu next-screen")
|
||||
self.signal.emit_signal('next-screen')
|
||||
|
||||
def install_cmdline(self):
|
||||
log.debug("Installing from command line sources.")
|
||||
self.signal.emit_signal('next-screen')
|
|
@ -46,7 +46,6 @@ class Subiquity(Application):
|
|||
"Welcome",
|
||||
"Refresh",
|
||||
"Keyboard",
|
||||
"Installpath",
|
||||
"Network",
|
||||
"Proxy",
|
||||
"Mirror",
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
# Copyright 2018 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/>.
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
log = logging.getLogger("subiquity.models.installpath")
|
||||
|
||||
|
||||
class InstallpathModel(object):
|
||||
"""Model representing install options"""
|
||||
|
||||
path = 'ubuntu'
|
||||
results = {}
|
||||
|
||||
def __init__(self, target, sources=None):
|
||||
self.target = target
|
||||
self.cmdline_sources = sources
|
||||
self.sources = {}
|
||||
if sources:
|
||||
self.path = 'cmdline'
|
||||
|
||||
@property
|
||||
def paths(self):
|
||||
cmdline = []
|
||||
if self.cmdline_sources:
|
||||
cmdline = [(_('Install from cli provided sources'), 'cmdline')]
|
||||
return cmdline + [
|
||||
(_('Install Ubuntu'), 'ubuntu'),
|
||||
]
|
||||
|
||||
def update(self, results):
|
||||
self.results = results
|
||||
|
||||
def render(self):
|
||||
src_map = {
|
||||
'ubuntu': ['cp:///media/filesystem'],
|
||||
'cmdline': self.cmdline_sources,
|
||||
}
|
||||
src_list = src_map[self.path]
|
||||
|
||||
self.sources = {}
|
||||
for n, u in enumerate(src_list):
|
||||
self.sources[self.path + "%02d" % n] = u
|
||||
|
||||
config = {
|
||||
'sources': self.sources,
|
||||
}
|
||||
|
||||
return config
|
|
@ -28,7 +28,6 @@ from subiquitycore.file_util import write_file
|
|||
from subiquitycore.utils import run_command
|
||||
|
||||
from .filesystem import FilesystemModel
|
||||
from .installpath import InstallpathModel
|
||||
from .keyboard import KeyboardModel
|
||||
from .locale import LocaleModel
|
||||
from .proxy import ProxyModel
|
||||
|
|
|
@ -22,7 +22,6 @@ from .bcache import BcacheView
|
|||
from .ceph import CephDiskView
|
||||
from .iscsi import IscsiDiskView
|
||||
from .identity import IdentityView
|
||||
from .installpath import InstallpathView
|
||||
from .installprogress import ProgressView
|
||||
from .keyboard import KeyboardView
|
||||
from .welcome import WelcomeView
|
||||
|
@ -33,7 +32,6 @@ __all__ = [
|
|||
'GuidedDiskSelectionView',
|
||||
'GuidedFilesystemView',
|
||||
'IdentityView',
|
||||
'InstallpathView',
|
||||
'IscsiDiskView',
|
||||
'KeyboardView',
|
||||
'MAASView',
|
||||
|
|
|
@ -1,73 +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/>.
|
||||
|
||||
""" Install Path
|
||||
|
||||
Provides high level options for Ubuntu install
|
||||
|
||||
"""
|
||||
import logging
|
||||
|
||||
from urwid import Text
|
||||
|
||||
from subiquitycore.ui.buttons import back_btn, forward_btn
|
||||
from subiquitycore.ui.utils import button_pile, screen
|
||||
from subiquitycore.view import BaseView
|
||||
|
||||
from subiquitycore.lsb_release import lsb_release
|
||||
|
||||
log = logging.getLogger('subiquity.installpath')
|
||||
|
||||
|
||||
class InstallpathView(BaseView):
|
||||
title = "Ubuntu {}"
|
||||
|
||||
excerpt = _("Welcome to Ubuntu! The world's favourite platform "
|
||||
"for clouds, clusters, and amazing internet things. "
|
||||
"This is the installer for Ubuntu on servers and "
|
||||
"internet devices.")
|
||||
footer = _("Use UP, DOWN arrow keys, and ENTER, to "
|
||||
"navigate options")
|
||||
|
||||
def __init__(self, model, controller):
|
||||
self.title = self.title.format(
|
||||
lsb_release().get('release', 'Unknown Release'))
|
||||
self.model = model
|
||||
self.controller = controller
|
||||
self.items = []
|
||||
back = back_btn(_("Back"), on_press=self.cancel)
|
||||
super().__init__(screen(
|
||||
[self._build_choices(), Text("")], [back],
|
||||
focus_buttons=False, excerpt=_(self.excerpt)))
|
||||
|
||||
def _build_choices(self):
|
||||
choices = []
|
||||
focus_position = 0
|
||||
for i, (label, path) in enumerate(self.model.paths):
|
||||
log.debug("Building inputs: {}".format(path))
|
||||
choices.append(
|
||||
forward_btn(
|
||||
label=label, on_press=self.confirm, user_arg=path))
|
||||
if path == self.model.path:
|
||||
focus_position = i
|
||||
bp = button_pile(choices)
|
||||
bp.base_widget.focus_position = focus_position
|
||||
return bp
|
||||
|
||||
def confirm(self, sender, path):
|
||||
self.controller.choose_path(path)
|
||||
|
||||
def cancel(self, button=None):
|
||||
self.controller.cancel()
|
|
@ -235,7 +235,6 @@ class Application:
|
|||
# project = "subiquity"
|
||||
# controllers = [
|
||||
# "Welcome",
|
||||
# "Installpath",
|
||||
# "Network",
|
||||
# "Filesystem",
|
||||
# "Identity",
|
||||
|
|
Loading…
Reference in New Issue