/[smeserver]/cdrom.image/updates/examine_gui.py
ViewVC logotype

Annotation of /cdrom.image/updates/examine_gui.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download) (as text)
Sun Jul 31 16:24:57 2005 UTC (19 years, 3 months ago) by slords
Branch: MAIN
Changes since 1.1: +2 -0 lines
Content type: text/x-python
Second major pass as anaconda installer
- Install/Upgrade both functional in text & gui
- Added upgrade warning for systems < 21:6.0-11
- TODO: raid migration for upgrades
- TODO: status message for post-{install,upgrade}

1 slords 1.1 #
2     # examine_gui.py: dialog to allow selection of a RHL installation to upgrade
3     # and if the user wishes to select individual packages.
4     #
5     # Copyright 2000-2003 Red Hat, Inc.
6     #
7     # This software may be freely redistributed under the terms of the GNU
8     # library public license.
9     #
10     # You should have received a copy of the GNU Library Public License
11     # along with this program; if not, write to the Free Software
12     # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13     #
14    
15     import gtk
16     from iw_gui import *
17     from package_gui import *
18     from pixmapRadioButtonGroup_gui import pixmapRadioButtonGroup
19     from rhpl.translate import _, N_
20     from constants import *
21     from upgrade import *
22     from flags import flags
23    
24     import smeupgradeclass
25     UpgradeClass = smeupgradeclass.InstallClass
26    
27     UPGRADE_STR = "upgrade"
28     REINSTALL_STR = "reinstall"
29    
30     class UpgradeExamineWindow (InstallWindow):
31    
32     windowTitle = N_("Upgrade Examine")
33     htmlTag = "upgradeexamine"
34    
35     def getNext (self):
36     if self.doupgrade:
37     # set the install class to be an upgrade
38     c = UpgradeClass(flags.expert)
39     c.setSteps(self.dispatch)
40     c.setInstallData(self.id)
41    
42     rootfs = self.parts[self.upgradecombo.get_active()]
43     self.id.upgradeRoot = [(rootfs[0], rootfs[1])]
44     self.id.rootParts = self.parts
45    
46     if self.individualPackages is not None and self.individualPackages.get_active():
47     self.dispatch.skipStep("indivpackage", skip = 0)
48     else:
49     self.dispatch.skipStep("indivpackage")
50     self.dispatch.skipStep("installtype", skip = 1)
51 slords 1.2 # else:
52     # self.dispatch.skipStep("installtype", skip = 0)
53 slords 1.1
54     return None
55    
56     def createUpgradeOption(self):
57     r = pixmapRadioButtonGroup()
58     r.addEntry(REINSTALL_STR,
59     _("_Install %s") %(productName,),
60     pixmap=self.ics.readPixmap("install.png"),
61     descr=_("Choose this option to freshly install your system. " "Existing software and data may be overwritten "
62     "depending on your configuration choices."))
63    
64     r.addEntry(UPGRADE_STR,
65     _("_Upgrade an existing installation"),
66     pixmap=self.ics.readPixmap("upgrade.png"),
67     descr=_("Choose this option if you would like "
68     "to upgrade your existing %s system. "
69     "This option will preserve the "
70     "existing data on your drives.") %(productName,))
71    
72     return r
73    
74     def upgradeOptionsSetSensitivity(self, state):
75     self.uplabel.set_sensitive(state)
76     self.upgradecombo.set_sensitive(state)
77     if self.individualPackages is not None:
78     self.individualPackages.set_sensitive(state)
79    
80     def optionToggled(self, widget, name):
81     if name == UPGRADE_STR:
82     self.upgradeOptionsSetSensitivity(widget.get_active())
83    
84     self.doupgrade = widget.get_active()
85    
86     #UpgradeExamineWindow tag = "upgrade"
87     def getScreen (self, dispatch, intf, id, chroot):
88     self.dispatch = dispatch
89     self.intf = intf
90     self.id = id
91     self.chroot = chroot
92    
93     self.doupgrade = dispatch.stepInSkipList("installtype")
94     self.parts = self.id.rootParts
95    
96     vbox = gtk.VBox (gtk.FALSE, 10)
97     vbox.set_border_width (8)
98    
99     r = self.createUpgradeOption()
100     b = r.render()
101     if self.doupgrade:
102     r.setCurrent(UPGRADE_STR)
103     else:
104     r.setCurrent(REINSTALL_STR)
105    
106     r.setToggleCallback(self.optionToggled)
107     box = gtk.VBox (gtk.FALSE)
108     box.pack_start(b, gtk.FALSE)
109    
110     vbox.pack_start (box, gtk.FALSE)
111     self.root = self.parts[0]
112    
113     #
114     # lets remove this seemingly useless option - clutters display
115     #
116     # self.individualPackages = gtk.CheckButton (_("_Customize packages to be "
117     # "upgraded"))
118     # self.individualPackages.set_active (not dispatch.stepInSkipList("indivpackage"))
119     # ipbox = gtk.HBox(gtk.FALSE)
120     # crackhbox = gtk.HBox(gtk.FALSE)
121     # crackhbox.set_size_request(70, -1)
122     # ipbox.pack_start(crackhbox, gtk.FALSE, gtk.FALSE)
123     # ipbox.pack_start(self.individualPackages, gtk.TRUE, gtk.TRUE)
124     # r.packWidgetInEntry(UPGRADE_STR, ipbox)
125     self.individualPackages = None
126    
127    
128     # hack hack hackity hack
129     upboxtmp = gtk.VBox(gtk.FALSE, 5)
130     uplabelstr = _("The following installed system will be upgraded:")
131     self.uplabel = gtk.Label(uplabelstr)
132     self.uplabel.set_alignment(0.0, 0.0)
133     model = gtk.ListStore(str)
134     self.upgradecombo = gtk.ComboBox(model)
135    
136     cell = gtk.CellRendererText()
137     self.upgradecombo.pack_start(cell, True)
138     self.upgradecombo.set_attributes(cell, markup=0)
139    
140     for (part, filesystem, desc) in self.parts:
141     iter = model.append()
142     if (desc is None) or len(desc) < 1:
143     desc = _("Unknown Linux system")
144     if part[:5] != "/dev/":
145     devname = "/dev/" + part
146     else:
147     devname = part
148     model[iter][0] = "<small>%s (%s)</small>" %(desc, devname)
149    
150     upboxtmp.pack_start(self.uplabel)
151    
152     # more indentation
153     box1 = gtk.HBox(gtk.FALSE)
154     crackhbox = gtk.HBox(gtk.FALSE)
155     crackhbox.set_size_request(35, -1)
156     box1.pack_start(crackhbox, gtk.FALSE, gtk.FALSE)
157     box1.pack_start(self.upgradecombo, gtk.FALSE, gtk.FALSE)
158     upboxtmp.pack_start(box1, gtk.FALSE, gtk.FALSE)
159    
160     # hack indent it
161     upbox = gtk.HBox(gtk.FALSE)
162    
163     crackhbox = gtk.HBox(gtk.FALSE)
164     crackhbox.set_size_request(70, -1)
165    
166     upbox.pack_start(crackhbox, gtk.FALSE, gtk.FALSE)
167     # upbox.pack_start(upboxtmp, gtk.TRUE, gtk.TRUE)
168     upbox.pack_start(upboxtmp, gtk.FALSE, gtk.FALSE)
169    
170     # all done phew
171     r.packWidgetInEntry(UPGRADE_STR, upbox)
172    
173     # set default
174     if self.doupgrade:
175     idx = 0
176     for p in self.parts:
177     if self.id.upgradeRoot[0][0] == p[0]:
178     self.upgradecombo.set_active(idx)
179     break
180     idx = idx + 1
181    
182     self.upgradeOptionsSetSensitivity(self.doupgrade)
183    
184     return vbox

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed