Esempio n. 1
0
    def __call__ (self, screen, anaconda):
        if anaconda.dir == DISPATCH_BACK:
            # reset storage to catch any changes
            anaconda.id.storage.reset(examine_all=True)

        # we might get here after storage reset that obsoleted
        # root device objects we had found
        if not anaconda.id.rootParts:
            anaconda.id.rootParts = upgrade.findExistingRoots(anaconda,
                                                              flags.cmdline.has_key("upgradeany"))
            upgrade.setUpgradeRoot(anaconda)

        parts = anaconda.id.rootParts

        height = min(len(parts), 11) + 1
        if height == 12:
            scroll = 1
        else:
            scroll = 0
        partList = []
        partList.append(_("Reinstall System"))

	if (anaconda.id.upgrade == None and anaconda.dispatch.stepInSkipList("installtype")) or anaconda.id.upgrade:
            default = 1
        else:
            default = 0

        for (device, desc) in parts:
            partList.append("%s (%s)" %(desc, device.path))

        (button, choice) =  ListboxChoiceWindow(screen, _("System to Upgrade"),
                            _("There seem to be one or more existing Linux installations "
                              "on your system.\n\nPlease choose one to upgrade, "
			      "or select 'Reinstall System' to freshly install "
			      "your system."), partList,
                                                [ TEXT_OK_BUTTON,
                                                  TEXT_BACK_BUTTON ],
                                                width = 55, scroll = scroll,
                                                height = height,
                                                default = default,
                                                help = "upgraderoot")

        if button == TEXT_BACK_CHECK:
            return INSTALL_BACK
        else:
            if choice == 0:
                root = None
            else:
                root = parts[choice - 1]

        if root is not None:
            upgrade.setSteps(anaconda)
            anaconda.id.setUpgrade(True)

            anaconda.id.upgradeRoot = [(root[0], root[1])]
            anaconda.id.rootParts = parts
            anaconda.dispatch.skipStep("installtype", skip = 1)
        else:
            anaconda.dispatch.skipStep("installtype", skip = 0)
            anaconda.id.upgradeRoot = None

        return INSTALL_OK
    def getScreen(self, anaconda):
        self.anaconda = anaconda

        if self.anaconda.id.upgrade == None:
            # this is the first time we've entered this screen
            self.doupgrade = self.anaconda.dispatch.stepInSkipList(
                "installtype")
        else:
            self.doupgrade = self.anaconda.id.upgrade

        if anaconda.dir == DISPATCH_BACK:
            # reset storage to catch any changes since we only reset when
            # moving forward from autopart, not back.
            # temporarily unset storage.clearPartType so that all devices will be
            # found during storage reset
            self.anaconda.id.storage.reset(examine_all=True)

        # we might get here after storage reset that obsoleted
        # root device objects we had found
        if not self.anaconda.id.rootParts:
            self.anaconda.id.rootParts = upgrade.findExistingRoots(
                self.anaconda, flags.cmdline.has_key("upgradeany"))
            upgrade.setUpgradeRoot(self.anaconda)

        self.parts = self.anaconda.id.rootParts

        vbox = gtk.VBox(False, 12)
        vbox.set_border_width(8)

        introLabel = gtk.Label(
            _("At least one existing installation has been "
              "detected on your system.  What would you "
              "like to do?"))
        introLabel.set_alignment(0, 0)
        vbox.pack_start(introLabel, False, False)

        r = self.createUpgradeOption()
        self.r = r

        b = self.r.render()
        if self.doupgrade:
            self.r.setCurrent(UPGRADE_STR)
        else:
            self.r.setCurrent(REINSTALL_STR)

        self.r.setToggleCallback(self.optionToggled)
        vbox.pack_start(b, False)
        self.root = self.parts[0]

        uplabelstr = _(
            "<b>Which %s installation would you like to upgrade?</b>"
        ) % productName
        self.uplabel = gtk.Label(uplabelstr)
        self.uplabel.set_use_markup(True)
        self.uplabel.set_alignment(0, 0)
        model = gtk.ListStore(str)
        self.upgradecombo = gtk.ComboBox(model)

        cell = gtk.CellRendererText()
        self.upgradecombo.pack_start(cell, True)
        self.upgradecombo.set_attributes(cell, markup=0)

        for (dev, desc) in self.parts:
            iter = model.append()
            if (desc is None) or len(desc) < 1:
                desc = _("Unknown Linux system")
            model[iter][0] = "<small>%s <i>(installed on %s)</i></small>" % (
                desc, dev.path)

# hack hack hackity hack
        alignment = gtk.Alignment(xalign=0.25)
        alignmentBox = gtk.VBox(False, 6)
        alignmentBox.pack_start(self.uplabel, False, False)
        alignmentBox.pack_start(self.upgradecombo, False, False)
        alignment.add(alignmentBox)
        vbox.pack_start(alignment, True, True)

        # set default
        idx = 0
        for p in self.parts:
            if self.anaconda.id.upgradeRoot[0][0] == p[0]:
                self.upgradecombo.set_active(idx)
                break
            idx = idx + 1

        self.upgradeOptionsSetSensitivity(self.doupgrade)

        return vbox
Esempio n. 3
0
    def getScreen (self, anaconda):
        global seenExamineScreen
        self.anaconda = anaconda

        if not seenExamineScreen:
	    # this is the first time we've entered this screen
	    self.doupgrade = self.anaconda.dispatch.stepInSkipList("installtype")
            seenExamineScreen = True
	else:
	    self.doupgrade = self.anaconda.upgrade

        # we might get here after storage reset that obsoleted
        # root device objects we had found
        if not self.anaconda.rootParts:
            self.anaconda.rootParts = upgrade.findExistingRoots(self.anaconda,
                                                                flags.cmdline.has_key("upgradeany"))
            upgrade.setUpgradeRoot(self.anaconda)

        self.parts = self.anaconda.rootParts

        vbox = gtk.VBox (False, 12)
	vbox.set_border_width (8)

        introLabel = gtk.Label(_("At least one existing installation has been "
                                 "detected on your system.  What would you "
                                 "like to do?"))
        introLabel.set_alignment(0, 0)
        vbox.pack_start(introLabel, False, False)

	r = self.createUpgradeOption()
        self.r = r

	b = self.r.render()
	if self.doupgrade:
	    self.r.setCurrent(UPGRADE_STR)
	else:
	    self.r.setCurrent(REINSTALL_STR)

	self.r.setToggleCallback(self.optionToggled)
        vbox.pack_start(b, False)
        self.root = self.parts[0]

	uplabelstr = _("<b>Which %s installation would you like to recover?</b>") % productName
	self.uplabel = gtk.Label(uplabelstr)
        self.uplabel.set_use_markup(True)
        self.uplabel.set_alignment(0, 0)
        model = gtk.ListStore(str)
	self.upgradecombo = gtk.ComboBox(model)

        cell = gtk.CellRendererText()
        self.upgradecombo.pack_start(cell, True)
        self.upgradecombo.set_attributes(cell, markup=0)

	for (dev, desc) in self.parts:
            iter = model.append()
	    if (desc is None) or len(desc) < 1:
		desc = _("Unknown Linux system")
            model[iter][0] = "<small>%s <i>(installed on %s)</i></small>" %(desc, dev.path)

	# hack hack hackity hack
        alignment = gtk.Alignment(xalign=0.25)
        alignmentBox = gtk.VBox(False, 6)
        alignmentBox.pack_start(self.uplabel, False, False)
        alignmentBox.pack_start(self.upgradecombo, False, False)
        alignment.add(alignmentBox)
        vbox.pack_start(alignment, True, True)

	# set default
	idx = 0
	for p in self.parts:
	    if self.anaconda.upgradeRoot[0][0] == p[0]:
	        self.upgradecombo.set_active(idx)
	        break
	    idx = idx + 1

	self.upgradeOptionsSetSensitivity(self.doupgrade)

        return vbox
    def __call__(self, screen, anaconda):
        if anaconda.dir == DISPATCH_BACK:
            # reset storage to catch any changes
            anaconda.id.storage.reset(examine_all=True)

        # we might get here after storage reset that obsoleted
        # root device objects we had found
        if not anaconda.id.rootParts:
            anaconda.id.rootParts = upgrade.findExistingRoots(
                anaconda, flags.cmdline.has_key("upgradeany"))
            upgrade.setUpgradeRoot(anaconda)

        parts = anaconda.id.rootParts

        height = min(len(parts), 11) + 1
        if height == 12:
            scroll = 1
        else:
            scroll = 0
        partList = []
        partList.append(_("Reinstall System"))

        if (anaconda.id.upgrade == None
                and anaconda.dispatch.stepInSkipList("installtype")
            ) or anaconda.id.upgrade:
            default = 1
        else:
            default = 0

        for (device, desc) in parts:
            partList.append("%s (%s)" % (desc, device.path))

        (button, choice) = ListboxChoiceWindow(
            screen,
            _("System to Upgrade"),
            _("There seem to be one or more existing Linux installations "
              "on your system.\n\nPlease choose one to upgrade, "
              "or select 'Reinstall System' to freshly install "
              "your system."),
            partList, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON],
            width=55,
            scroll=scroll,
            height=height,
            default=default,
            help="upgraderoot")

        if button == TEXT_BACK_CHECK:
            return INSTALL_BACK
        else:
            if choice == 0:
                root = None
            else:
                root = parts[choice - 1]

        if root is not None:
            upgrade.setSteps(anaconda)
            anaconda.id.setUpgrade(True)

            anaconda.id.upgradeRoot = [(root[0], root[1])]
            anaconda.id.rootParts = parts
            anaconda.dispatch.skipStep("installtype", skip=1)
        else:
            anaconda.dispatch.skipStep("installtype", skip=0)
            anaconda.id.upgradeRoot = None

        return INSTALL_OK