1 |
# |
2 |
# installpath_text: text mode installation type selection dialog |
3 |
# |
4 |
# Copyright 2001-2002 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 |
from snack import * |
15 |
from constants_text import * |
16 |
from rhpl.translate import _ |
17 |
from flags import flags |
18 |
import installclass |
19 |
|
20 |
class InstallPathWindow: |
21 |
def __call__ (self, screen, dispatch, id, method, intf): |
22 |
tmpclasses = installclass.availableClasses() |
23 |
|
24 |
# strip out '_' in names cause we dont do mnemonics in text mode |
25 |
classes = [] |
26 |
for (n, o, l) in tmpclasses: |
27 |
n2 = n.replace("_", "") |
28 |
classes.append((n2, o, l)) |
29 |
|
30 |
choices = [] |
31 |
default = 0 |
32 |
i = 0 |
33 |
orig = None |
34 |
|
35 |
for (name, object, icon) in classes: |
36 |
choices.append(_(name)) |
37 |
|
38 |
if isinstance(id.instClass, object): |
39 |
orig = i |
40 |
elif object.default: |
41 |
default = i |
42 |
|
43 |
i = i + 1 |
44 |
|
45 |
if orig != None: |
46 |
default = orig |
47 |
|
48 |
choice = default |
49 |
# (button, choice) = ListboxChoiceWindow(screen, _("Installation Type"), |
50 |
# _("What type of system would you like to install?"), |
51 |
# choices, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON], |
52 |
# width = 40, default = default, help = "installpath") |
53 |
# |
54 |
# if button == TEXT_BACK_CHECK: |
55 |
# return INSTALL_BACK |
56 |
|
57 |
rc = intf.messageWindow(_("Warning"), |
58 |
_("All disks will be reformatted and any data will be lost. Proceed?"), |
59 |
type = "yesno", default = "no") |
60 |
|
61 |
if rc == 0: |
62 |
return INSTALL_BACK |
63 |
|
64 |
if (choice != orig): |
65 |
(name, objectClass, logo) = classes[choice] |
66 |
c = objectClass(flags.expert) |
67 |
c.setSteps(dispatch) |
68 |
c.setInstallData(id) |
69 |
|
70 |
return INSTALL_OK |
71 |
|