summaryrefslogtreecommitdiffstats
path: root/iw/autopartition.py
blob: 017dd109aa1d09d9a5e41d00e37b8de7851da686 (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
from gtk import *
from iw import *
from thread import *

FSEDIT_CLEAR_LINUX  = (1 << 0)
FSEDIT_CLEAR_ALL    = (1 << 2)
FSEDIT_USE_EXISTING = (1 << 3)

class AutoPartitionWindow (InstallWindow):

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

        self.todo = ics.getToDo ()
        ics.setTitle ("Auto partition")
	ics.setNextEnabled (TRUE)

    def getNext (self):
        attempt = [
        ( "/boot",      16,     0x83, 0, -1 ),
        ( "/",          256,    0x83, 0, -1 ),
        ( "/usr",       512,    0x83, 1, -1 ),
        ( "/var",       256,    0x83, 0, -1 ),
        ( "/home",      512,    0x83, 1, -1 ),
        ( "Swap-auto",  64,     0x82,   0, -1 ),
        ]

        ret = self.todo.ddruid.attempt (attempt, "Workstation", self.type)
        return None

    def typeSelected (self, button, data):
        self.type = data
        
    def getScreen (self):
	box = GtkVBox (FALSE)

	group = GtkRadioButton (None, "Remove all data")
        group.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_ALL)
	box.pack_start (group, FALSE)
	item = GtkRadioButton (group, "Remove Linux partitions")
        item.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_LINUX)
	box.pack_start (item, FALSE)
	item = GtkRadioButton (group, "Use existing free space")
        item.connect ("clicked", self.typeSelected, FSEDIT_USE_EXISTING)
	box.pack_start (item, FALSE)
	item.set_active (TRUE)

	return box