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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
from iw import *
from gtk import *
from gui import _
from xpms import SMALL_CHECK
import GdkImlib
class LiloWindow (InstallWindow):
foo = GdkImlib.create_image_from_xpm (SMALL_CHECK)
foo.render()
checkMark = foo.make_pixmap()
del foo
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
ics.setTitle (_("Lilo Configuration"))
ics.setNextEnabled (1)
self.type = None
def getNext (self):
return
if self.lilo.get_active ():
self.todo.setLiloLocation (None)
else:
self.type = self.list.selection[0]
if self.list.selection[0] == 0:
self.todo.setLiloLocation (self.boothd)
else:
self.todo.setLiloLocation (self.bootpart)
if self.bootdisk.get_active ():
self.todo.bootdisk = 1
else:
self.todo.bootdisk = 0
def typeName(self, type):
if (type == 2):
return "Linux extended"
elif (type == 1):
return "DOS/Windows"
elif (type == 4):
return "OS/2 / Windows NT"
else:
return "Other"
def toggled (self, widget, *args):
if widget.get_active ():
state = FALSE
else:
state = TRUE
for n in [self.radioBox, self.editBox, self.imageList ]:
n.set_sensitive (state)
def labelUpdated(self, *args):
index = self.imageList.selection[0]
device = self.imageList.get_text(index, 1)
label = self.labelEntry.get_text()
self.imageList.set_text(index, 3, label)
def defaultUpdated(self, *args):
if self.ignoreSignals: return
index = self.imageList.selection[0]
if self.defaultCheck.get_active():
if self.default != None:
self.imageList.set_text(self.default, 0, "")
self.imageList.set_pixmap(index, 0, self.checkMark)
self.default = index
else:
self.imageList.set_text(index, 0, "")
self.default = None
def labelSelected(self, *args):
index = self.imageList.selection[0]
device = self.imageList.get_text(index, 1)
label = self.imageList.get_text(index, 3)
self.deviceLabel.set_text(_("Partition") + ": " + device)
device = device[5:]
type = self.images[device][1]
self.typeLabel.set_text(_("Type") + ":" + self.typeName(type))
self.labelEntry.set_text(label)
self.ignoreSignals = 1
if index == self.default:
self.defaultCheck.set_active(1)
else:
self.defaultCheck.set_active(0)
self.ignoreSignals = 0
def getScreen (self):
self.images = self.todo.getLiloImages()
self.ignoreSignals = 0
if '/' not in self.todo.mounts.keys (): return None
if self.todo.mounts.has_key ('/boot'):
self.bootpart = self.todo.mounts['/boot'][0]
else:
self.bootpart = self.todo.mounts['/'][0]
i = len (self.bootpart) - 1
while i < 0 and self.bootpart[i] in digits:
i = i - 1
self.boothd = self.bootpart[0:i]
format = "/dev/%s"
self.radioBox = GtkVBox (FALSE, 10)
group = GtkRadioButton(None,
("/dev/%s %s" % (self.boothd, _("Master Boot Record (MBR)"))))
self.radioBox.pack_start(group, FALSE)
group = GtkRadioButton(group,
("/dev/%s %s" % (self.bootpart,
_("First sector of boot partition"))))
self.radioBox.pack_start(group, FALSE)
box = GtkVBox (FALSE, 5)
self.bootdisk = GtkCheckButton (_("Create boot disk"))
self.bootdisk.set_active (TRUE)
box.pack_start (self.bootdisk, FALSE)
box.pack_start (GtkHSeparator (), FALSE, padding=3)
self.lilo = GtkCheckButton (_("Skip LILO install"))
self.lilo.set_active (FALSE)
self.lilo.connect ("toggled", self.toggled)
box.pack_start (self.lilo, FALSE)
self.radioBox.set_border_width (10)
box.pack_start (self.radioBox, FALSE)
self.imageList = GtkCList (4,
( _("Default"), _("Device"), _("Partition type"), _("Boot label")))
self.imageList.set_selection_mode (SELECTION_SINGLE)
sortedKeys = self.images.keys()
sortedKeys.sort()
self.default = None
count = 0
for n in sortedKeys:
(label, type) = self.images[n]
self.imageList.append(("", "/dev/" + n, self.typeName(type),
label))
if (label == "linux"):
self.default = count
self.imageList.set_pixmap(count, 0, self.checkMark)
count = count + 1
self.imageList.columns_autosize ()
self.imageList.column_title_passive (1)
self.imageList.set_border_width (5)
self.imageList.connect("select_row", self.labelSelected)
self.imageList.set_column_justification(2, JUSTIFY_CENTER)
self.deviceLabel = GtkLabel(_("Partition") + ":")
self.typeLabel = GtkLabel(_("Type") + ":")
tempBox = GtkHBox()
self.deviceLabel.set_alignment(0.0, 0.0)
self.typeLabel.set_alignment(0.0, 0.0)
tempBox.set_homogeneous(1)
tempBox.pack_start(self.deviceLabel, FALSE)
tempBox.pack_start(self.typeLabel, FALSE)
self.defaultCheck = GtkCheckButton("Default boot image")
self.defaultCheck.connect("toggled", self.defaultUpdated)
# Alliteration!
self.labelLabel = GtkLabel(_("Boot label") + ":")
self.labelEntry = GtkEntry(15)
self.labelEntry.connect("changed", self.labelUpdated)
tempBox2 = GtkHBox()
self.labelLabel.set_alignment(0.0, 0.0)
tempBox2.pack_start(self.labelLabel, FALSE)
tempBox2.pack_start(self.labelEntry, FALSE, padding = 5)
self.editBox = GtkVBox()
self.editBox.pack_start(tempBox, FALSE)
self.editBox.pack_start(self.defaultCheck, FALSE)
self.editBox.pack_start(tempBox2, FALSE)
self.editBox.set_border_width(5)
box.pack_start (GtkHSeparator (), FALSE, padding=3)
box.pack_start (self.editBox, FALSE)
box.pack_start (self.imageList, TRUE)
return box
|