From e46de5def8d89908d4de536dca510ba9dafe1137 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 14 May 2019 15:09:55 +0200 Subject: [PATCH] Drop Installpath --- subiquity/controllers/__init__.py | 2 - subiquity/controllers/installpath.py | 67 ------------------------- subiquity/core.py | 1 - subiquity/models/installpath.py | 62 ----------------------- subiquity/models/subiquity.py | 1 - subiquity/ui/views/__init__.py | 2 - subiquity/ui/views/installpath.py | 73 ---------------------------- subiquitycore/core.py | 1 - 8 files changed, 209 deletions(-) delete mode 100644 subiquity/controllers/installpath.py delete mode 100644 subiquity/models/installpath.py delete mode 100644 subiquity/ui/views/installpath.py diff --git a/subiquity/controllers/__init__.py b/subiquity/controllers/__init__.py index 75b5f9c3..ad46d28e 100644 --- a/subiquity/controllers/__init__.py +++ b/subiquity/controllers/__init__.py @@ -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', diff --git a/subiquity/controllers/installpath.py b/subiquity/controllers/installpath.py deleted file mode 100644 index 5693162d..00000000 --- a/subiquity/controllers/installpath.py +++ /dev/null @@ -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 . - -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') diff --git a/subiquity/core.py b/subiquity/core.py index a3bb5b7f..36af4039 100644 --- a/subiquity/core.py +++ b/subiquity/core.py @@ -46,7 +46,6 @@ class Subiquity(Application): "Welcome", "Refresh", "Keyboard", - "Installpath", "Network", "Proxy", "Mirror", diff --git a/subiquity/models/installpath.py b/subiquity/models/installpath.py deleted file mode 100644 index 177fb11b..00000000 --- a/subiquity/models/installpath.py +++ /dev/null @@ -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 . - -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 diff --git a/subiquity/models/subiquity.py b/subiquity/models/subiquity.py index cc8d86b2..8550c4e7 100644 --- a/subiquity/models/subiquity.py +++ b/subiquity/models/subiquity.py @@ -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 diff --git a/subiquity/ui/views/__init__.py b/subiquity/ui/views/__init__.py index 71659427..96a1c974 100644 --- a/subiquity/ui/views/__init__.py +++ b/subiquity/ui/views/__init__.py @@ -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', diff --git a/subiquity/ui/views/installpath.py b/subiquity/ui/views/installpath.py deleted file mode 100644 index 6b1ebccd..00000000 --- a/subiquity/ui/views/installpath.py +++ /dev/null @@ -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 . - -""" 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() diff --git a/subiquitycore/core.py b/subiquitycore/core.py index f095174a..26d60e4a 100644 --- a/subiquitycore/core.py +++ b/subiquitycore/core.py @@ -235,7 +235,6 @@ class Application: # project = "subiquity" # controllers = [ # "Welcome", - # "Installpath", # "Network", # "Filesystem", # "Identity",