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

Contents of /cdrom.image/updates/upgrade_text.py

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


Revision 1.8 - (show annotations) (download) (as text)
Fri Jun 9 05:03:00 2006 UTC (17 years, 11 months ago) by gordonr
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +0 -0 lines
Content type: text/x-python
FILE REMOVED
See bug 1510 - all changes should be in the anaconda CVS repository

1 #
2 # upgrade_text.py: text mode upgrade dialogs
3 #
4 # Copyright 2001 Red Hat, Inc.
5 #
6 # This software may be freely redistributed under the terms of the GNU
7 # library public license.
8 #
9 # You should have received a copy of the GNU Library Public License
10 # along with this program; if not, write to the Free Software
11 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
12 #
13
14 import string
15 import isys
16 import iutil
17 import upgrade
18 from constants_text import *
19 from snack import *
20 from fsset import *
21 from flags import flags
22 from constants import *
23 import smeupgradeclass
24 UpgradeClass = smeupgradeclass.InstallClass
25
26 from rhpl.log import log
27 from rhpl.translate import _
28
29 class UpgradeMigrateFSWindow:
30 def __call__ (self, screen, thefsset):
31
32 migent = thefsset.getMigratableEntries()
33
34 g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)
35
36 text = _("This release of %s supports "
37 "the ext3 journalling file system. It has several "
38 "benefits over the ext2 file system traditionally shipped "
39 "in %s. It is possible to migrate the ext2 "
40 "formatted partitions to ext3 without data loss.\n\n"
41 "Which of these partitions would you like to migrate?"
42 % (productName, productName))
43
44 tb = TextboxReflowed(60, text)
45 g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))
46
47 partlist = CheckboxTree(height=4, scroll=1)
48 for entry in migent:
49 if entry.fsystem.getName() != entry.origfsystem.getName():
50 migrating = 1
51 else:
52 migrating = 0
53
54 partlist.append("/dev/%s - %s - %s" % (entry.device.getDevice(),
55 entry.origfsystem.getName(),
56 entry.mountpoint), entry, migrating)
57
58 g.add(partlist, 0, 1, padding = (0, 0, 0, 1))
59
60 buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] )
61 g.add(buttons, 0, 3, anchorLeft = 1, growx = 1)
62
63 while 1:
64 result = g.run()
65
66 if (buttons.buttonPressed(result)):
67 result = buttons.buttonPressed(result)
68
69 if result == TEXT_BACK_CHECK:
70 screen.popWindow()
71 return INSTALL_BACK
72
73 # reset
74 for entry in migent:
75 entry.setFormat(0)
76 entry.setMigrate(0)
77 entry.fsystem = entry.origfsystem
78
79 for entry in partlist.getSelection():
80 entry.setMigrate(1)
81 entry.fsystem = fileSystemTypeGet("ext3")
82
83 screen.popWindow()
84 return INSTALL_OK
85
86 class UpgradeSwapWindow:
87 def __call__ (self, screen, intf, fsset, instPath, swapInfo, dispatch):
88 rc = swapInfo
89
90 (fsList, suggSize, suggMntPoint) = rc
91
92 ramDetected = iutil.memInstalled()/1024
93
94 text = _("The 2.4 kernel needs significantly more swap than older "
95 "kernels, as much as twice as much swap space as RAM on the "
96 "system. You currently have %dMB of swap configured, but "
97 "you may create additional swap space on one of your "
98 "file systems now.") % (iutil.swapAmount() / 1024)
99
100 tb = TextboxReflowed(60, text)
101 amount = Entry(10, scroll = 0)
102 amount.set(str(suggSize))
103
104 l = len(fsList)
105 scroll = 0
106 if l > 4:
107 l = 4
108 scroll = 1
109 listbox = Listbox(l, scroll = scroll)
110
111 liLabel = Label("%-25s %-15s %8s" % (_("Mount Point"),
112 _("Partition"), _("Free Space")))
113
114 count = 0
115 for (mnt, part, size) in fsList:
116 listbox.append("%-25s /dev/%-10s %6dMB" % (mnt, part, size), count)
117
118 if (mnt == suggMntPoint):
119 listbox.setCurrent(count)
120
121 count = count + 1
122
123 buttons = ButtonBar(screen, [TEXT_OK_BUTTON, (_("Skip"), "skip"),
124 TEXT_BACK_BUTTON] )
125
126 amGrid = Grid(2, 3)
127 amGrid.setField(Label(_("RAM detected (MB):")), 0, 0, anchorLeft = 1,
128 padding = (0, 0, 1, 0))
129 amGrid.setField(Label(str(ramDetected)), 1, 0, anchorLeft = 1)
130 amGrid.setField(Label(_("Suggested size (MB):")), 0, 1, anchorLeft = 1,
131 padding = (0, 0, 1, 0))
132 amGrid.setField(Label(str(suggSize)), 1, 1, anchorLeft = 1)
133 amGrid.setField(Label(_("Swap file size (MB):")), 0, 2, anchorLeft = 1,
134 padding = (0, 0, 1, 0))
135 amGrid.setField(amount, 1, 2)
136
137 liGrid = Grid(1, 2)
138 liGrid.setField(liLabel, 0, 0)
139 liGrid.setField(listbox, 0, 1)
140
141 g = GridFormHelp(screen, _("Add Swap"), "upgradeswap", 1, 4)
142 g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))
143 g.add(amGrid, 0, 1, padding = (0, 0, 0, 1))
144 g.add(liGrid, 0, 2, padding = (0, 0, 0, 1))
145 g.add(buttons, 0, 3, anchorLeft = 1, growx = 1)
146
147 while 1:
148 result = g.run()
149
150 if (buttons.buttonPressed(result)):
151 result = buttons.buttonPressed(result)
152
153 if result == TEXT_BACK_CHECK:
154 screen.popWindow()
155 return INSTALL_BACK
156 elif result == "skip":
157 screen.popWindow()
158 return INSTALL_OK
159
160 val = amount.value()
161
162 try:
163 val = int(val)
164 except ValueError:
165 intf.messageWindow(_("Error"),
166 _("The value you entered is not a "
167 "valid number."))
168
169 if type(val) == type(1):
170 (mnt, part, size) = fsList[listbox.current()]
171 if size < (val + 16):
172 intf.messageWindow(_("Error"),
173 _("There is not enough space on the "
174 "device you selected for the swap "
175 "partition."))
176 elif val > 2000 or val < 1:
177 intf.messageWindow(_("Warning"),
178 _("The swap file must be between 1 "
179 "and 2000 MB in size."))
180 else:
181 screen.popWindow()
182 if flags.setupFilesystems:
183 upgrade.createSwapFile(instPath, fsset, mnt, val)
184 dispatch.skipStep("addswap", 1)
185 return INSTALL_OK
186
187 raise ValueError
188
189 class UpgradeExamineWindow:
190 def __call__ (self, screen, dispatch, intf, id, chroot):
191 parts = id.rootParts
192
193 height = min(len(parts), 11) + 1
194 if height == 12:
195 scroll = 1
196 else:
197 scroll = 0
198 partList = []
199 partList.append(_("Erase ALL disks, and perform a fresh install"))
200
201 for (drive, fs, desc) in parts:
202 partList.append("Upgrade existing \"%s\" system" %(desc))
203
204 (button, choice) = ListboxChoiceWindow(screen, _("System to Upgrade"),
205 _("Your system is upgradeable."), partList,
206 [ TEXT_OK_BUTTON,
207 TEXT_BACK_BUTTON ],
208 width = 55, scroll = scroll,
209 height = height,
210 help = "upgraderoot",
211 default = 1)
212
213 if button == TEXT_BACK_CHECK:
214 return INSTALL_BACK
215 else:
216 if choice == 0:
217 root = None
218 else:
219 root = parts[choice - 1]
220
221 if root is not None:
222 c = UpgradeClass(flags.expert)
223 c.setSteps(dispatch)
224 c.setInstallData(id)
225
226 id.upgradeRoot = [(root[0], root[1])]
227 id.rootParts = parts
228 dispatch.skipStep("installtype", skip = 1)
229 else:
230 dispatch.skipStep("installtype", skip = 0)
231 id.upgradeRoot = None
232
233 return INSTALL_OK
234
235 class CustomizeUpgradeWindow:
236 def __call__ (self, screen, dispatch, intf, id, chroot):
237 if id.upgradeRoot is None:
238 return INSTALL_NOOP
239 rc = ButtonChoiceWindow (screen, _("Customize Packages to Upgrade"),
240 _("The packages you have installed, "
241 "and any other packages which are "
242 "needed to satisfy their "
243 "dependencies, have been selected "
244 "for installation. Would you like "
245 "to customize the set of packages "
246 "that will be upgraded?"),
247 buttons = [ _("Yes"), _("No"),
248 TEXT_BACK_BUTTON],
249 help = "custupgrade")
250
251 if rc == TEXT_BACK_CHECK:
252 return INSTALL_BACK
253
254 if rc == string.lower (_("No")):
255 dispatch.skipStep("indivpackage")
256 else:
257 dispatch.skipStep("indivpackage", skip = 0)
258
259 return INSTALL_OK
260

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