diff options
author | Chris Lumens <clumens@redhat.com> | 2008-11-18 17:25:10 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-02-09 11:30:09 -0500 |
commit | 31607bb4e26957ad89fff96d0c35942b8e847356 (patch) | |
tree | 57c2b286d4c2937f475294b82046b682e597c469 /textw | |
parent | 0a84b4c1d2528eb699598d1207ce2979d81f1bb4 (diff) | |
download | anaconda-31607bb4e26957ad89fff96d0c35942b8e847356.tar.gz anaconda-31607bb4e26957ad89fff96d0c35942b8e847356.tar.xz anaconda-31607bb4e26957ad89fff96d0c35942b8e847356.zip |
Reduce package selection down to automatically installing Base and Core.
There is no more interactive group/package selection in text mode.
Diffstat (limited to 'textw')
-rw-r--r-- | textw/grpselect_text.py | 158 | ||||
-rw-r--r-- | textw/task_text.py | 67 |
2 files changed, 5 insertions, 220 deletions
diff --git a/textw/grpselect_text.py b/textw/grpselect_text.py deleted file mode 100644 index eac4072dc..000000000 --- a/textw/grpselect_text.py +++ /dev/null @@ -1,158 +0,0 @@ -# -# grpselect_text - Text mode group/package selection UI -# -# Copyright (C) 2005, 2006, 2007 Red Hat, Inc. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Author(s): Jeremy Katz <katzj@redhat.com> -# - -import yum.Errors -from snack import * -from constants_text import * -from compssort import * - -from constants import * -import gettext -_ = lambda x: gettext.ldgettext("anaconda", x) - -import logging -log = logging.getLogger("anaconda") - - -class GroupSelectionWindow: - def __deselectPackage(self, grp, pkg): - grpid = grp.groupid - try: - pkgs = self.ayum.pkgSack.returnNewestByName(pkg) - except yum.Errors.PackageSackError: - log.debug("no such package %s from group %s" % - (pkg, grpid)) - if pkgs: - pkgs = self.ayum.bestPackagesFromList(pkgs) - for po in pkgs: - txmbrs = self.ayum.tsInfo.getMembers(pkgtup = po.pkgtup) - for txmbr in txmbrs: - try: - txmbr.groups.remove(grpid) - except ValueError: - log.debug("package %s was not marked in group %s" %(po, grpid)) - if len(txmbr.groups) == 0: - self.ayum.tsInfo.remove(po.pkgtup) - - def __selectPackage(self, grp, pkg): - grpid = grp.groupid - try: - txmbrs = self.ayum.install(name = pkg) - except yum.Errors.InstallError, e: - log.debug("No package named %s available to be installed: %s" - %(pkg, e)) - else: - map(lambda x: x.groups.append(grpid), txmbrs) - - def __call__(self, screen, anaconda): - self.ayum = anaconda.backend.ayum - - g = GridFormHelp(screen, "Package Group Selection", - "packagetree", 1, 5) - - t = TextboxReflowed(50, _("Please select the package groups you " - "would like to install.")) - g.add(t, 0, 0, (0, 0, 0, 1), anchorLeft = 1) - - # FIXME: this is very yum backend specific... - groups = filter(lambda x: x.user_visible, - anaconda.backend.ayum.comps.groups) - groups = filter(lambda x: anaconda.backend.ayum._groupHasPackages(x), - groups) - groups.sort(ui_comps_sort) - ct = CheckboxTree(height = 6, scroll = (len(groups) > 6)) - for grp in groups: - ct.append(xmltrans(grp.name, grp.translated_name), - grp, grp.selected) - g.add(ct, 0, 2, (0, 0, 0, 1)) - - bb = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON)) - g.add(bb, 0, 3, growx = 1) - - g.addHotKey("F2") - screen.pushHelpLine (_("<Space>,<+>,<-> selection | <F2> Group Details | <F12> next screen")) - - while 1: - result = g.run() - - if result != "F2": - break - - grp = ct.getCurrent() - pkgs = grp.default_packages.keys() + grp.optional_packages.keys() - if len(pkgs) == 0: - ButtonChoiceWindow(screen, _("Error"), - _("No optional packages to select")) - continue - - # if current group is not selected then select it first - newSelection = 0 - lst = ct.getSelection() - if grp not in lst: - newSelection = 1 - self.ayum.selectGroup(grp.groupid) - ct.setEntryValue(grp, True) - - # do group details - gct = CheckboxTree(height = 8, scroll = 1) - - orig = {} - pkgs.sort() - for pkg in pkgs: - orig[pkg] = self.ayum.isPackageInstalled(pkg) - gct.append("%s" %(pkg,), pkg, orig[pkg]) - - bb2 = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON)) - - g2 = GridFormHelp (screen, _("Package Group Details"), "", 1, 4) - - g2.add (gct, 0, 1, (0, 0, 0, 1)) - g2.add (bb2, 0, 3, growx = 1) - - rc2 = g2.runOnce() - if bb2.buttonPressed(rc2) == TEXT_CANCEL_CHECK: - # unselect group if necessary - if newSelection: - ct.setEntryValue(grp, False) - self.ayum.deselectGroup(grp.groupid) - - else: - # reflect new packages selected - selected = gct.getSelection() - for (opkg, osel) in orig.items(): - if opkg in selected and not osel: - self.__selectPackage(grp, opkg) - elif opkg not in selected and osel: - self.__deselectPackage(grp, opkg) - - rc = bb.buttonPressed(result) - screen.popWindow() - if rc == TEXT_BACK_CHECK: - return INSTALL_BACK - - sel = ct.getSelection() - for g in groups: - if g in sel and not g.selected: - anaconda.backend.selectGroup(g.groupid) - elif g not in sel and g.selected: - anaconda.backend.deselectGroup(g.groupid) - - return INSTALL_OK diff --git a/textw/task_text.py b/textw/task_text.py index 0c062685e..94afce651 100644 --- a/textw/task_text.py +++ b/textw/task_text.py @@ -17,73 +17,16 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from snack import * from constants_text import * from constants import * -import gettext -_ = lambda x: gettext.ldgettext("anaconda", x) - class TaskWindow: - def groupsExist(self, lst): - # FIXME: yum specific - for gid in lst: - g = self.backend.ayum.comps.return_group(gid) - if not g: - return False - return True - def __call__(self, screen, anaconda): - self.backend = anaconda.backend - tasks = anaconda.id.instClass.tasks - - bb = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON)) - - toplevel = GridFormHelp (screen, _("Package selection"), - "tasksel", 1, 5) - - if anaconda.id.instClass.description: - labeltxt = anaconda.id.instClass.description - else: - labeltxt = _("The default installation of %s includes a set of software applicable for general internet usage. What additional tasks would you like your system to support?") %(productName,) - toplevel.add (TextboxReflowed(55, labeltxt), 0, 0, (0, 0, 0, 1)) - - ct = CheckboxTree(height = 4, scroll = (len(tasks) > 4)) - for (txt, grps) in tasks: - if not self.backend.groupListExists(grps): - continue - - if self.backend.groupListDefault(grps): - ct.append(_(txt), txt, True) - else: - ct.append(_(txt), txt, False) - toplevel.add (ct, 0, 2, (0,0,0,1)) - - custom = not anaconda.dispatch.stepInSkipList("group-selection") - customize = Checkbox (_("Customize software selection"), custom) - toplevel.add (customize, 0, 3, (0, 0, 0, 1)) - toplevel.add (bb, 0, 4, (0, 0, 0, 0), growx = 1) + anaconda.dispatch.skipStep("basepkgsel") + anaconda.dispatch.skipStep("group-selection") - result = toplevel.run() - rc = bb.buttonPressed (result) - if rc == TEXT_BACK_CHECK: - screen.popWindow() - return INSTALL_BACK + anaconda.backend.resetPackageSelections() + anaconda.backend.selectGroup("Core") + anaconda.backend.selectGroup("Base") - if customize.selected(): - anaconda.dispatch.skipStep("group-selection", skip = 0) - else: - anaconda.dispatch.skipStep("group-selection") - - sel = ct.getSelection() - for (txt, grps) in tasks: - if txt in sel: - map(lambda g: setattr(self.backend.ayum.comps.return_group(g), - "default", True), grps) - else: - map(lambda g: setattr(self.backend.ayum.comps.return_group(g), - "default", False), grps) - screen.popWindow() - return INSTALL_OK - |