summaryrefslogtreecommitdiffstats
path: root/iw/bootloader_advanced_gui.py
blob: e5ebb7d8ae7bae84ddeb3da304454a510895cf51 (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
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
#
# bootloader_advanced.py: gui advanced bootloader configuration dialog
#
# Jeremy Katz <katzj@redhat.com>
#
# Copyright 2001-2002 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import gtk
import gobject
import iutil
import partedUtils
import gui
from iw_gui import *
from rhpl.translate import _, N_

from bootlocwidget import BootloaderLocationWidget

class AdvancedBootloaderWindow(InstallWindow):
    windowTitle = N_("Advanced Boot Loader Configuration")
    htmlTag = "advbootloader"

    def __init__(self, ics):
        InstallWindow.__init__(self, ics)
        self.parent = ics.getICW().window


    def getPrev(self):
        pass


    def getNext(self):
        # forcing lba32 can be a bad idea.. make sure they really want to
        if (self.forceLBA.get_active() and not self.bl.forceLBA32):
            rc = self.intf.messageWindow(_("Warning"),
                    _("Forcing the use of LBA32 for your bootloader when "
                      "not supported by the BIOS can cause your machine "
                      "to be unable to boot.  We highly recommend you "
                      "create a boot disk when asked later in the "
                      "install process.\n\n"
                      "Would you like to continue and force LBA32 mode?"),
                                         type = "custom",
                                         custom_buttons = [_("Cancel"),
                                                           _("Force LBA32")])
            if rc != 1:
                raise gui.StayOnScreen

        # set forcelba
        self.bl.setForceLBA(self.forceLBA.get_active())
        # set kernel args
        self.bl.args.set(self.appendEntry.get_text())

        # set the boot device
        self.bl.setDevice(self.blloc.getBootDevice())

        # set the drive order
        self.bl.drivelist = self.blloc.getDriveOrder()


    # set up the vbox with force lba32 and kernel append
    def setupOptionsVbox(self):
        self.options_vbox = gtk.VBox(gtk.FALSE, 5)
        self.options_vbox.set_border_width(5)
        
        self.forceLBA = gtk.CheckButton(_("_Force LBA32 (not normally required)"))
        self.options_vbox.pack_start(self.forceLBA, gtk.FALSE)
        self.forceLBA.set_active(self.bl.forceLBA32)

        label = gui.WrappingLabel(_("If you wish to add default options to the "
			    "boot command, enter them into "
			    "the 'General kernel parameters' field."))
	label.set_alignment(0.0, 0.0)
        self.options_vbox.pack_start(label, gtk.FALSE)

        label = gui.MnemonicLabel(_("_General kernel parameters"))
        self.appendEntry = gtk.Entry()
        label.set_mnemonic_widget(self.appendEntry)
        args = self.bl.args.get()
        if args:
            self.appendEntry.set_text(args)
        box = gtk.HBox(gtk.FALSE, 0)
        box.pack_start(label)
        box.pack_start(self.appendEntry)
	al = gtk.Alignment(0.0, 0.0)
	al.add(box)
        self.options_vbox.pack_start(al, gtk.FALSE)


    def getScreen(self, dispatch, bl, fsset, diskset):
        self.dispatch = dispatch
        self.bl = bl
        self.intf = dispatch.intf

        thebox = gtk.VBox (gtk.FALSE, 10)

        # boot loader location bits (mbr vs boot, drive order)
        self.blloc = BootloaderLocationWidget(bl, fsset, diskset,
                                              self.parent, self.intf)
        thebox.pack_start(self.blloc.getWidget(), gtk.FALSE)

        thebox.pack_start (gtk.HSeparator(), gtk.FALSE)

        # some optional things
        self.setupOptionsVbox()
        thebox.pack_start(self.options_vbox, gtk.FALSE)


        return thebox