summaryrefslogtreecommitdiffstats
path: root/iw/format.py
blob: 3d0b1a696c05483295d91b697f0c0be7f86618d5 (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
52
53
54
from gtk import *
from iw import *
from thread import *
import isys
from gui import _

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

        self.todo = ics.getToDo ()
        ics.setTitle (_("Choose partitions to Format"))
        ics.setNextEnabled (1)
##         ics.setHTML ("<HTML><BODY>Choose partitions to Format</BODY></HTML>")
        ics.readHTML ("format")

    def getScreen (self):
        def toggled (widget, (todo, mount)):
            if widget.get_active ():
                (dev, fstype, format) = todo.mounts[mount]
                todo.mounts[mount] = (dev, fstype, 1)
            else:
                (dev, fstype, format) = todo.mounts[mount]
                todo.mounts[mount] = (dev, fstype, 0)

        def check (widget, todo):
            todo.badBlockCheck = widget.get_active ()

        box = GtkVBox (FALSE, 10)

        mounts = self.todo.mounts.keys ()
        mounts.sort ()

        for mount in mounts:
            (dev, fstype, format) = self.todo.mounts[mount]
            if fstype == "ext2":
                checkButton = GtkCheckButton ("/dev/%s   %s" % (dev, mount))
                checkButton.set_active (format)
                checkButton.connect ("toggled", toggled, (self.todo, mount))
                box.pack_start (checkButton)

        vbox = GtkVBox (FALSE, 10)
        vbox.pack_start (box, FALSE, TRUE)

        vbox.pack_start (GtkHSeparator (), FALSE, padding=3)
        
        self.check = GtkCheckButton (_("Check for bad blocks while formatting"))
        self.check.set_active (self.todo.badBlockCheck)
        self.check.connect ("toggled", check, self.todo)
        vbox.pack_start (self.check, FALSE)
        
        self.check = GtkCheckButton 

        return vbox