From de47657c85efb846e17d6fb9ddcb3521c2ddaa9b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 8 Jul 2002 04:06:59 +0000 Subject: now you change the boot loader from a dialog on the first screen so that confusion is gone, but otherwise, basically the same as things were before. added mnemonics as they were needed --- iw/blpasswidget.py | 14 ++-- iw/bootloader_advanced_gui.py | 86 ++--------------------- iw/bootloader_main_gui.py | 157 ++++++++++++++++++++++++++++++++++++++---- iw/fdisk_gui.py | 1 + iw/osbootwidget.py | 50 +++++++++----- 5 files changed, 190 insertions(+), 118 deletions(-) diff --git a/iw/blpasswidget.py b/iw/blpasswidget.py index 8f8f2a6b6..fa64664bf 100644 --- a/iw/blpasswidget.py +++ b/iw/blpasswidget.py @@ -73,10 +73,10 @@ class BootloaderPasswordWidget: # set the label on the button for the bootloader password def setPassLabel(self): + self.passButton.set_label(_("Change _password")) if not self.usePassCb.get_active() or not self.password: - self.passButton.set_label(_("No password")) + self.passButton.set_sensitive(gtk.FALSE) else: - self.passButton.set_label(_("Change _Password")) self.passButton.set_sensitive(gtk.TRUE) # callback for when the password checkbox is clicked @@ -113,15 +113,17 @@ class BootloaderPasswordWidget: table = gtk.Table(2, 2) table.set_row_spacings(5) table.set_col_spacings(5) - table.attach(gtk.Label(_("Password:")), 0, 1, 2, 3, - gtk.FILL, 0, 10) + label = gui.MnemonicLabel(_("_Password:")) + table.attach(label, 0, 1, 2, 3, gtk.FILL, 0, 10) pwEntry = gtk.Entry (16) pwEntry.set_visibility (gtk.FALSE) + label.set_mnemonic_widget(pwEntry) table.attach(pwEntry, 1, 2, 2, 3, gtk.FILL, 0, 10) - table.attach(gtk.Label(_("Confirm:")), 0, 1, 3, 4, - gtk.FILL, 0, 10) + label = gui.MnemonicLabel(_("Con_firm:")) + table.attach(label, 0, 1, 3, 4, gtk.FILL, 0, 10) confirmEntry = gtk.Entry (16) confirmEntry.set_visibility (gtk.FALSE) + label.set_mnemonic_widget(confirmEntry) table.attach(confirmEntry, 1, 2, 3, 4, gtk.FILL, 0, 10) dialog.vbox.pack_start(table) diff --git a/iw/bootloader_advanced_gui.py b/iw/bootloader_advanced_gui.py index 91a5f3ec8..8ffd6bb2e 100644 --- a/iw/bootloader_advanced_gui.py +++ b/iw/bootloader_advanced_gui.py @@ -38,8 +38,7 @@ class AdvancedBootloaderWindow(InstallWindow): 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 and - not self.none_radio.get_active()): + 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 " @@ -53,14 +52,6 @@ class AdvancedBootloaderWindow(InstallWindow): if rc != 1: raise gui.StayOnScreen - # set the bootloader type - if self.none_radio.get_active(): - self.dispatch.skipStep("instbootloader") - return - else: - self.bl.setUseGrub(self.grub_radio.get_active()) - self.dispatch.skipStep("instbootloader", skip = 0) - # set forcelba self.bl.setForceLBA(self.forceLBA.get_active()) # set kernel args @@ -73,24 +64,6 @@ class AdvancedBootloaderWindow(InstallWindow): self.bl.drivelist = self.blloc.getDriveOrder() - # enable the options if we're installing a boot loader - def bootloaderChanged(self, widget, *args): - if widget == self.grub_radio and self.grub_radio.get_active(): - # grub is the boot loader - self.blloc.getWidget().set_sensitive(gtk.TRUE) - self.blloc.setUsingGrub(1) - self.options_vbox.set_sensitive(gtk.TRUE) - elif widget == self.lilo_radio and self.lilo_radio.get_active(): - # lilo is the boot loader - self.blloc.getWidget().set_sensitive(gtk.TRUE) - self.blloc.setUsingGrub(0) - self.options_vbox.set_sensitive(gtk.TRUE) - elif widget == self.none_radio and self.none_radio.get_active(): - # using no boot loader - self.blloc.getWidget().set_sensitive(gtk.FALSE) - self.options_vbox.set_sensitive(gtk.FALSE) - - # set up the vbox with force lba32 and kernel append def setupOptionsVbox(self): self.options_vbox = gtk.VBox(gtk.FALSE, 5) @@ -100,8 +73,9 @@ class AdvancedBootloaderWindow(InstallWindow): self.options_vbox.pack_start(self.forceLBA, gtk.FALSE) self.forceLBA.set_active(self.bl.forceLBA32) - label = gtk.Label(_("General kernel parameters")) + 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) @@ -111,46 +85,6 @@ class AdvancedBootloaderWindow(InstallWindow): self.options_vbox.pack_start(box, gtk.FALSE) - # set up the vbox with the choose your bootloader bits - def setupChooseBootloaderRadioBox(self): - self.radio_vbox = gtk.VBox(gtk.FALSE, 2) - self.radio_vbox.set_border_width(5) - - label = gui.WrappingLabel(_("Please select the boot loader that " - "the computer will use. GRUB is the " - "default boot loader. However, if you " - "do not wish to overwrite your current " - "boot loader, select \"Do not install " - "a boot loader.\" ")) - label.set_alignment(0.0, 0.0) - - self.grub_radio = gtk.RadioButton(None, (_("Use _GRUB as the " - "boot loader"))) - self.lilo_radio = gtk.RadioButton(self.grub_radio, - (_("Use _LILO as the boot loader"))) - self.none_radio = gtk.RadioButton(self.grub_radio, (_("_Do not " - "install a " - "boot loader"))) - - - self.radio_vbox.pack_start(label, gtk.FALSE) - self.radio_vbox.pack_start(self.grub_radio, gtk.FALSE) - self.radio_vbox.pack_start(self.lilo_radio, gtk.FALSE) - self.radio_vbox.pack_start(self.none_radio, gtk.FALSE) - - # XXX this is kind of ugly - if self.dispatch.stepInSkipList("instbootloader"): - self.none_radio.set_active(gtk.TRUE) - elif not self.bl.useGrub(): - self.lilo_radio.set_active(gtk.TRUE) - else: - self.grub_radio.set_active(gtk.TRUE) - - self.grub_radio.connect("toggled", self.bootloaderChanged) - self.lilo_radio.connect("toggled", self.bootloaderChanged) - self.none_radio.connect("toggled", self.bootloaderChanged) - - def getScreen(self, dispatch, bl, fsset, diskset): self.dispatch = dispatch self.bl = bl @@ -158,16 +92,10 @@ class AdvancedBootloaderWindow(InstallWindow): thebox = gtk.VBox (gtk.FALSE, 10) - # choose your boot loader type - self.setupChooseBootloaderRadioBox() - thebox.pack_start(self.radio_vbox, gtk.FALSE) - - thebox.pack_start (gtk.HSeparator(), gtk.FALSE) - # 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()) + thebox.pack_start(self.blloc.getWidget(), gtk.FALSE) thebox.pack_start (gtk.HSeparator(), gtk.FALSE) @@ -176,10 +104,4 @@ class AdvancedBootloaderWindow(InstallWindow): thebox.pack_start(self.options_vbox, gtk.FALSE) - # go ahead and set default sensitivities - if self.none_radio.get_active(): - self.options_vbox.set_sensitive(gtk.FALSE) - self.blloc.getWidget().set_sensitive(gtk.FALSE) - - return thebox diff --git a/iw/bootloader_main_gui.py b/iw/bootloader_main_gui.py index 3f1b00d04..29e8e4ab9 100644 --- a/iw/bootloader_main_gui.py +++ b/iw/bootloader_main_gui.py @@ -43,6 +43,19 @@ class MainBootloaderWindow(InstallWindow): # since that won't change anything self.bl.setDevice(self.bldev) + if self.blname is None: + # if we're not installing a boot loader, don't show the second + # screen and don't worry about other options + self.dispatch.skipStep("instbootloader", skip = 1) + self.dispatch.skipStep("bootloaderadvanced", skip = 1) + return + else: + self.dispatch.skipStep("instbootloader", skip = 0) + if self.blname == "GRUB": + self.bl.setUseGrub(1) + else: + self.bl.setUseGrub(0) + # set the password self.bl.setPassword(self.blpass.getPassword(), isCrypted = 0) @@ -53,10 +66,110 @@ class MainBootloaderWindow(InstallWindow): self.dispatch.skipStep("bootloaderadvanced", skip = 0) else: self.dispatch.skipStep("bootloaderadvanced", skip = 1) - # avoid screwing ourselves -- if we're skipping the advanced - # screen, always make sure to install the boot loader - self.dispatch.skipStep("instbootloader", skip = 0) + def changeBootloaderCallback(self, *args): + dialog = gtk.Dialog(_("Change Boot Loader"), self.parent) + dialog.add_button('gtk-cancel', 2) + dialog.add_button('gtk-ok', 1) + dialog.set_position(gtk.WIN_POS_CENTER) + gui.addFrame(dialog) + radio_vbox = self.setupChooseBootloaderRadioBox() + + dialog.vbox.pack_start(radio_vbox) + dialog.show_all() + + blname = self.blname + while 1: + rc = dialog.run() + if rc == 2: + break + + if self.none_radio.get_active() == gtk.TRUE: + newrc = self.intf.messageWindow(_("Warning"), + _("You have selected not to " + "install a boot loader on " + "your system. You will " + "have to create a boot " + "disk to boot your system " + "with this option.\n\n" + "Would you like to " + "continue and not install " + "a boot loader?"), + type = "custom", + custom_buttons = + [_("Cancel"), + _("C_ontinue with no boot " + "loader")]) + if newrc != 1: + continue + blname = None + elif self.lilo_radio.get_active() == gtk.TRUE: + blname = "LILO" + else: + blname = "GRUB" + break + + dialog.destroy() + + if rc !=2: + self.blname = blname + self.updateBootLoaderLabel() + if blname is not None: + self.oslist.changeBootLoader(blname) + return rc + + + def setupChooseBootloaderRadioBox(self): + radio_vbox = gtk.VBox(gtk.FALSE, 2) + radio_vbox.set_border_width(5) + + label = gui.WrappingLabel(_("Please select the boot loader that " + "the computer will use. GRUB is the " + "default boot loader. However, if you " + "do not wish to overwrite your current " + "boot loader, select \"Do not install " + "a boot loader.\" ")) + label.set_alignment(0.0, 0.0) + + self.grub_radio = gtk.RadioButton(None, (_("Use _GRUB as the " + "boot loader"))) + self.lilo_radio = gtk.RadioButton(self.grub_radio, + (_("Use _LILO as the boot loader"))) + self.none_radio = gtk.RadioButton(self.grub_radio, (_("_Do not " + "install a " + "boot loader"))) + + + radio_vbox.pack_start(label, gtk.FALSE) + radio_vbox.pack_start(self.grub_radio, gtk.FALSE) + radio_vbox.pack_start(self.lilo_radio, gtk.FALSE) + radio_vbox.pack_start(self.none_radio, gtk.FALSE) + + if self.blname is None: + self.none_radio.set_active(gtk.TRUE) + elif self.blname == "LILO": + self.lilo_radio.set_active(gtk.TRUE) + else: + self.grub_radio.set_active(gtk.TRUE) + + return radio_vbox + + + def updateBootLoaderLabel(self): + if self.blname is not None: + self.bllabel.set_text(_("The %s boot loader will be " + "installed on /dev/%s.") % + (self.blname, self.bldev)) + active = gtk.TRUE + else: + self.bllabel.set_text(_("No boot loader will be installed.")) + active = gtk.FALSE + + for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), + self.advanced ]: + widget.set_sensitive(active) + + def getScreen(self, dispatch, bl, fsset, diskSet): self.dispatch = dispatch self.bl = bl @@ -75,9 +188,12 @@ class MainBootloaderWindow(InstallWindow): thebox.pack_start(spacer, gtk.FALSE) if self.bl.useGrub(): - blname = "GRUB" + self.blname = "GRUB" else: - blname = "LILO" + self.blname = "LILO" + # XXX this is kind of ugly + if self.dispatch.stepInSkipList("instbootloader"): + self.blname = None # make sure we get a valid device to say we're installing to if bl.getDevice() is not None: @@ -91,29 +207,43 @@ class MainBootloaderWindow(InstallWindow): else: self.bldev = choices['boot'][0] - label = gui.WrappingLabel(_("The %s boot loader will be installed " - "on /dev/%s.") % (blname, self.bldev)) - label.set_alignment(0.0, 0.5) - thebox.pack_start(label, gtk.FALSE) + self.bllabel = gui.WrappingLabel("") + + self.bllabel.set_alignment(0.0, 0.5) + + hbox = gtk.HBox(gtk.FALSE, 10) + hbox.pack_start(self.bllabel, gtk.FALSE) + + button = gtk.Button(_("_Change boot loader")) + hbox.pack_start(button, gtk.FALSE) + button.connect("clicked", self.changeBootloaderCallback) + + alignment = gtk.Alignment() + alignment.set(0.1, 0, 0, 0) + alignment.add(hbox) + + thebox.pack_start(alignment, gtk.FALSE) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, gtk.FALSE) # configure the systems available to boot from the boot loader - self.oslist = OSBootWidget(bl, fsset, diskSet, self.parent, self.intf) + self.oslist = OSBootWidget(bl, fsset, diskSet, self.parent, + self.intf, self.blname) thebox.pack_start(self.oslist.getWidget(), gtk.FALSE) thebox.pack_start (gtk.HSeparator(), gtk.FALSE) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(bl, self.parent, self.intf) - thebox.pack_start(self.blpass.getWidget()) + thebox.pack_start(self.blpass.getWidget(), gtk.FALSE) thebox.pack_start (gtk.HSeparator(), gtk.FALSE) # check box to control showing the advanced screen - self.advanced = gtk.CheckButton(_("Configure advanced boot loader options")) + self.advanced = gtk.CheckButton(_("Configure advanced boot loader " + "_options")) if dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(gtk.FALSE) else: @@ -121,6 +251,9 @@ class MainBootloaderWindow(InstallWindow): thebox.pack_start(self.advanced, gtk.FALSE) + # finally, update the label and activate widgets appropriately + self.updateBootLoaderLabel() + return thebox diff --git a/iw/fdisk_gui.py b/iw/fdisk_gui.py index 74873c326..22a33ffab 100644 --- a/iw/fdisk_gui.py +++ b/iw/fdisk_gui.py @@ -58,6 +58,7 @@ class FDiskWindow (InstallWindow): term = vte.Terminal() term.set_encoding("UTF-8") term.set_font_from_string("monospace") + term.connect("child_exited", self.child_died, widget) self.drive = drive diff --git a/iw/osbootwidget.py b/iw/osbootwidget.py index 0ef994ad2..4210d5571 100644 --- a/iw/osbootwidget.py +++ b/iw/osbootwidget.py @@ -24,26 +24,21 @@ from rhpl.translate import _, N_ class OSBootWidget: """Widget to display OSes to boot and allow adding new ones.""" - def __init__(self, bl, fsset, diskset, parent, intf): + def __init__(self, bl, fsset, diskset, parent, intf, blname): self.bl = bl self.fsset = fsset self.diskset = diskset self.parent = parent self.intf = intf - - # illegal characters for boot loader labels - if self.bl.useGrub(): - self.illegalChars = [ "$", "=" ] - else: - self.illegalChars = [ "$", "=", " " ] - - if self.bl.useGrub(): - blname = "GRUB" + if blname is not None: + self.blname = blname else: - blname = "LILO" + self.blname = "GRUB" + self.setIllegalChars() + self.vbox = gtk.VBox(gtk.FALSE, 5) - label = gui.WrappingLabel(_("You can configure the %s boot loader to boot other operating systems. Additional operating systems can be added to the below list to choose between them on boot.") % (blname,)) + label = gui.WrappingLabel(_("You can configure the boot loader to boot other operating systems. Additional operating systems can be added to the below list to choose between them on boot.")) self.vbox.pack_start(label, gtk.FALSE) spacer = gtk.Label("") @@ -110,6 +105,21 @@ class OSBootWidget: alignment.add(self.vbox) self.widget = alignment + def setIllegalChars(self): + # illegal characters for boot loader labels + if self.blname == "GRUB": + self.illegalChars = [ "$", "=" ] + else: + self.illegalChars = [ "$", "=", " " ] + + def changeBootLoader(self, blname): + if blname is not None: + self.blname = blname + else: + self.blname = "GRUB" + self.setIllegalChars() + self.fillOSList() + # adds/edits a new "other" os to the boot loader config def editOther(self, oldDevice, oldLabel, isDefault, isRoot = 0): dialog = gtk.Dialog(_("Image"), self.parent) @@ -131,13 +141,16 @@ class OSBootWidget: table.set_row_spacings(5) table.set_col_spacings(5) - table.attach(gtk.Label(_("Label")), 0, 1, 1, 2, gtk.FILL, 0, 10) + label = gui.MnemonicLabel(_("_Label")) + table.attach(label, 0, 1, 1, 2, gtk.FILL, 0, 10) labelEntry = gtk.Entry(32) + label.set_mnemonic_widget(labelEntry) table.attach(labelEntry, 1, 2, 1, 2, gtk.FILL, 0, 10) if oldLabel: labelEntry.set_text(oldLabel) - table.attach(gtk.Label(_("Device")), 0, 1, 2, 3, gtk.FILL, 0, 10) + label = gui.MnemonicLabel(_("_Device")) + table.attach(label, 0, 1, 2, 3, gtk.FILL, 0, 10) if not isRoot: # XXX should potentially abstract this out into a function pedparts = [] @@ -168,10 +181,11 @@ class OSBootWidget: deviceOption.set_history(defindex) table.attach(deviceOption, 1, 2, 2, 3, gtk.FILL, 0, 10) + label.set_mnemonic_widget(deviceOption) else: table.attach(gtk.Label(oldDevice), 1, 2, 2, 3, gtk.FILL, 0, 10) - default = gtk.CheckButton(_("Default Boot Target")) + default = gtk.CheckButton(_("Default Boot _Target")) table.attach(default, 0, 2, 3, 4, gtk.FILL, 0, 10) if isDefault != 0: default.set_active(gtk.TRUE) @@ -222,7 +236,7 @@ class OSBootWidget: for key in self.imagelist.keys(): if dev == key: continue - if self.bl.useGrub(): + if self.blname == "GRUB": thisLabel = self.imagelist[key][1] else: thisLabel = self.imagelist[key][0] @@ -266,7 +280,7 @@ class OSBootWidget: del self.imagelist[oldDevice] # go ahead and add it - if self.bl.useGrub(): + if self.blname == "GRUB": self.imagelist[dev] = (oldshort, label, isRoot) else: self.imagelist[dev] = (label, oldlong, isRoot) @@ -345,7 +359,7 @@ class OSBootWidget: for dev in keys: (label, longlabel, fstype) = self.imagelist[dev] - if self.bl.useGrub(): + if self.blname == "GRUB": theLabel = longlabel else: theLabel = label -- cgit