summaryrefslogtreecommitdiffstats
path: root/iw/examine_gui.py
blob: c8137a60ba07a6f66cc664f3c08025eca57728e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# examine_gui.py: dialog to allow selection of a RHL installation to upgrade
#                 and if the user wishes to select individual packages.
#
# Copyright 2000-2002 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import gtk
from iw_gui import *
from package_gui import *
from rhpl.translate import _, N_
from constants import *
from upgrade import *

class UpgradeExamineWindow (InstallWindow):		

    windowTitle = N_("Upgrade Examine")
    htmlTag = "upgrade"

    def toggled (self, widget, newPart):
        if widget.get_active ():
	    self.root = newPart

    def getNext (self):
        self.id.upgradeRoot = [self.root]
	if self.individualPackages.get_active():
	    self.dispatch.skipStep("indivpackage", skip = 0)
	else:
	    self.dispatch.skipStep("indivpackage")

        return None

    #UpgradeExamineWindow tag = "upgrade"
    def getScreen (self, dispatch, intf, id, chroot):
        self.dispatch = dispatch
        self.intf = intf
        self.id = id
        self.chroot = chroot

        self.parts = self.id.upgradeRoot
        
	box = gtk.VBox (gtk.FALSE)
        if not self.parts:
            box.pack_start (gtk.Label (_("You don't have any Linux partitions."
                                        "\nYou can't upgrade this sytem!")),
                            gtk.FALSE)
            self.ics.setNextEnabled (gtk.FALSE)
            return box

        vbox = gtk.VBox (gtk.FALSE, 10)
	vbox.set_border_width (8)

        if self.parts and len (self.parts) > 1:
	    label = gtk.Label (_("Please select the device containing the root "
                                "filesystem: "))
	    label.set_alignment(0.0, 0.5)
	    box.pack_start(label, gtk.FALSE)

	    table = gtk.Table(2, 6)
	    table.set_border_width (10)
            box.pack_start (table, gtk.FALSE)
	    box.pack_start (gtk.HSeparator ())
	    spacer = gtk.Label("")
	    spacer.set_size_request(15, 1)
	    table.attach(spacer, 0, 1, 2, 4, gtk.FALSE)

            self.ics.setNextEnabled (gtk.TRUE)
            self.root = self.parts[0]
            group = None
	    row = 1
            for (part, filesystem) in self.parts:
                group = gtk.RadioButton (group, part)
                group.connect ("toggled", self.toggled, (part, filesystem))
		table.attach(group, 1, 2, row, row+1)
		row = row + 1

	    vbox.pack_start (box, gtk.FALSE)
        else:
            # if there is only one partition, go on.
            self.ics.setNextEnabled (gtk.TRUE)
            self.root = self.parts[0]
	    label = gtk.Label (_("Upgrading the %s installation "
                                "on partition /dev/%s")
                              % (productName, self.root[0] + "\n\n",))
	    label.set_alignment(0.0, 0.5)
	    vbox.pack_start(label, gtk.FALSE)
            
        self.individualPackages = gtk.CheckButton (_("_Customize packages to be "
                                                    "upgraded"))
        self.individualPackages.set_active (not dispatch.stepInSkipList("indivpackage"))
            
        align = gtk.Alignment (0.0, 0.5)
        align.add (self.individualPackages)

        vbox.pack_start (align, gtk.FALSE)

        return vbox