summaryrefslogtreecommitdiffstats
path: root/iw/lilo.py
blob: 28106ec0e4eba6727f4e665dae46c8660c6517fe (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
from iw import *
from gtk import *

class LiloWindow (InstallWindow):

    def __init__ (self, ics):
	InstallWindow.__init__ (self, ics)

        ics.setTitle ("Lilo Configuration")
        ics.setNextEnabled (1)
        self.type = None

    def getNext (self):
        self.type = self.list.selection[0]
        if self.list.selection[0] == 0:
            self.todo.setLiloLocation (self.boothd)
        else:
            self.todo.setLiloLocation (self.bootpart)

    def getScreen (self):
        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"
        sw = GtkScrolledWindow ()
        sw.set_border_width (5)
        sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC)

        self.list = GtkCList (2, ("Device", "Location"))
        self.list.freeze ()
        self.list.append ((format % (self.boothd,), "Master Boot Record (MBR)"))
        self.list.append ((format % (self.bootpart,), "First sector of boot partition"))
        self.list.columns_autosize ()
        self.list.set_selection_mode (SELECTION_BROWSE)
        self.list.set_column_resizeable (0, FALSE)
        self.list.set_column_resizeable (1, FALSE)
        self.list.column_titles_passive ()
        if self.type:
            self.list.select_row (self.type, 0)
        self.list.thaw ()
        sw.add (self.list)

        return sw