def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.storage.partitioned disks = anaconda.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton( _("_Install boot loader on /dev/%s.") % (self.bldev, )) self.grubCB.set_active( not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) # XXX: lxnay here, GRUB-2 doesn't allow this # thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox
def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox (False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton(_("_Install boot loader on /dev/%s.") % (self.bldev,)) self.grubCB.set_active(not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox
def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.bootloader self.intf = anaconda.intf self.driveorder = [d.name for d in self.bl.drives] thebox = gtk.VBox (False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to self.bldev = self.bl.stage1_device hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton(_("_Install boot loader on %s.") % (self.bldev.path,)) self.grubCB.set_active(self.dispatch.step_enabled("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) if not self.bl.name == "GRUB2": # with grub2 we use os-prober to generate menu entries for all # other OS it finds without user interaction thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.setDevice(self.bldev) self.bl.drivelist = self.driveorder if not self.grubCB.get_active(): # 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) # kind of a hack... self.bl.defaultDevice = None return else: self.dispatch.skipStep("instbootloader", skip=0) self.bl.setUseGrub(1) # set the password self.bl.setPassword(self.blpass.getPassword(), isCrypted=0) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() def bootloaderChanged(self, *args): active = self.grubCB.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.deviceButton ]: widget.set_sensitive(active) def _deviceChange(self, b, anaconda, *args): def __driveChange(combo, dxml, choices): if not choices.has_key("mbr"): return iter = combo.get_active_iter() if not iter: return first = combo.get_model()[iter][1] desc = choices["mbr"][1] dxml.get_widget("mbrRadio").set_label("%s - /dev/%s" % (_(desc), first)) dxml.get_widget("mbrRadio").set_data("bootDevice", first) def __genStore(combo, disks, active): model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(model) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text=0) for disk in disks: i = model.append(None) model[i] = ("%s %8.0f MB %s" % (disk.name, disk.size, disk.description), "%s" % (disk.name, )) if disk.name == active: combo.set_active_iter(i) return model (dxml, dialog) = gui.getGladeWidget("blwhere.glade", "blwhereDialog") gui.addFrame(dialog) dialog.set_transient_for(self.parent) dialog.show() choices = anaconda.platform.bootloaderChoices(self.bl) for t in ("mbr", "boot"): if not choices.has_key(t): continue (device, desc) = choices[t] w = dxml.get_widget("%sRadio" % (t, )) w.set_label("%s - /dev/%s" % (_(desc), device)) w.show() if self.bldev == device: w.set_active(True) else: w.set_active(False) w.set_data("bootDevice", device) for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" % (i, )) lbl = dxml.get_widget("bd%dLabel" % (i, )) combo.show() lbl.show() partitioned = anaconda.storage.partitioned disks = anaconda.storage.disks bl_disks = [d for d in disks if d in partitioned] m = __genStore(combo, bl_disks, self.driveorder[i - 1]) dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices) __driveChange(dxml.get_widget("bd1Combo"), dxml, choices) while 1: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break # set the boot device based on what they chose if dxml.get_widget("bootRadio").get_active(): self.bldev = dxml.get_widget("bootRadio").get_data( "bootDevice") elif dxml.get_widget("mbrRadio").get_active(): self.bldev = dxml.get_widget("mbrRadio").get_data("bootDevice") else: raise RuntimeError, "No radio button selected!" # and adjust the boot order neworder = [] for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" % (i, )) iter = combo.get_active_iter() if not iter: continue act = combo.get_model()[iter][1] if act not in neworder: neworder.append(act) for d in self.driveorder: if d not in neworder: neworder.append(d) self.driveorder = neworder break dialog.destroy() self.grubCB.set_label( _("_Install boot loader on /dev/%s.") % (self.bldev, )) return rc def _setBLCBText(self): self.grubCB.set_label( _("_Install boot loader on /dev/%s.") % (self.bldev, )) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.storage.partitioned disks = anaconda.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton( _("_Install boot loader on /dev/%s.") % (self.bldev, )) self.grubCB.set_active( not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) # XXX: lxnay here, GRUB-2 doesn't allow this # thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") htmlTag = "bootloader" def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # 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) # kind of a hack... self.bl.defaultDevice = None 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) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() if self.advanced.get_active(): self.dispatch.skipStep("bootloaderadvanced", skip=0) else: self.dispatch.skipStep("bootloaderadvanced", skip=1) 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 is not None) and (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"))) if bootloader.showLilo: self.lilo_radio = gtk.RadioButton(self.grub_radio, (_("Use _LILO as the boot " "loader"))) else: self.lilo_radio = None 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) if self.lilo_radio: 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.lilo_radio is not None and self.blname == "LILO" and iutil.getArch( ) == "i386": 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 self.intf = dispatch.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(gtk.FALSE, 10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, gtk.FALSE) if self.bl.useGrub(): self.blname = "GRUB" else: 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: self.bldev = bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = fsset.bootloaderChoices(diskSet, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] 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.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(), 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")) if dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(gtk.FALSE) else: self.advanced.set_active(gtk.TRUE) thebox.pack_start(self.advanced, gtk.FALSE) # finally, update the label and activate widgets appropriately self.updateBootLoaderLabel() return thebox
def getScreen(self, dispatch, bl, fsset, diskSet): self.dispatch = dispatch self.bl = bl self.intf = dispatch.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(gtk.FALSE, 10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, gtk.FALSE) if self.bl.useGrub(): self.blname = "GRUB" else: 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: self.bldev = bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = fsset.bootloaderChoices(diskSet, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] 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.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(), 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")) if dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(gtk.FALSE) else: self.advanced.set_active(gtk.TRUE) thebox.pack_start(self.advanced, gtk.FALSE) # finally, update the label and activate widgets appropriately self.updateBootLoaderLabel() return thebox
def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(False, 5) thebox.set_border_width(10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) if self.bl.useGrub(): self.blname = "GRUB" else: self.blname = None # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.id.fsset.bootloaderChoices( anaconda.id.diskset, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] vb = gtk.VBox(False, 6) self.grub_radio = gtk.RadioButton( None, _("The %s boot loader will be " "installed on /dev/%s.") % ("GRUB", self.bldev)) self.grub_radio.set_use_underline(False) vb.pack_start(self.grub_radio) self.none_radio = gtk.RadioButton( self.grub_radio, _("No boot loader will be installed.")) vb.pack_start(self.none_radio) if self.blname is None: self.none_radio.set_active(True) self.grub_radio.set_active(False) else: self.grub_radio.set_active(True) self.none_radio.set_active(False) self.grub_radio.connect("toggled", self.bootloaderChanged) self.none_radio.connect("toggled", self.bootloaderChanged) thebox.pack_start(vb, False) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent, self.blname) thebox.pack_start(self.oslist.getWidget(), False) thebox.pack_start(gtk.HSeparator(), False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) thebox.pack_start(gtk.HSeparator(), False) # check box to control showing the advanced screen self.advanced = gtk.CheckButton( _("Configure advanced boot loader " "_options")) if self.dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(False) else: self.advanced.set_active(True) thebox.pack_start(self.advanced, False) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.setDevice(self.bldev) if self.none_radio.get_active(): # 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) # kind of a hack... self.bl.defaultDevice = None 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) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() if self.advanced.get_active(): self.dispatch.skipStep("bootloaderadvanced", skip=0) else: self.dispatch.skipStep("bootloaderadvanced", skip=1) def bootloaderChanged(self, *args): active = self.grub_radio.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.advanced ]: widget.set_sensitive(active) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox(False, 5) thebox.set_border_width(10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) if self.bl.useGrub(): self.blname = "GRUB" else: self.blname = None # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.id.fsset.bootloaderChoices( anaconda.id.diskset, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] vb = gtk.VBox(False, 6) self.grub_radio = gtk.RadioButton( None, _("The %s boot loader will be " "installed on /dev/%s.") % ("GRUB", self.bldev)) self.grub_radio.set_use_underline(False) vb.pack_start(self.grub_radio) self.none_radio = gtk.RadioButton( self.grub_radio, _("No boot loader will be installed.")) vb.pack_start(self.none_radio) if self.blname is None: self.none_radio.set_active(True) self.grub_radio.set_active(False) else: self.grub_radio.set_active(True) self.none_radio.set_active(False) self.grub_radio.connect("toggled", self.bootloaderChanged) self.none_radio.connect("toggled", self.bootloaderChanged) thebox.pack_start(vb, False) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent, self.blname) thebox.pack_start(self.oslist.getWidget(), False) thebox.pack_start(gtk.HSeparator(), False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) thebox.pack_start(gtk.HSeparator(), False) # check box to control showing the advanced screen self.advanced = gtk.CheckButton( _("Configure advanced boot loader " "_options")) if self.dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(False) else: self.advanced.set_active(True) thebox.pack_start(self.advanced, False) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.setDevice(self.bldev) self.bl.drivelist = self.driveorder if not self.grubCB.get_active(): # 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) # kind of a hack... self.bl.defaultDevice = None return else: self.dispatch.skipStep("instbootloader", skip = 0) self.bl.setUseGrub(1) # set the password self.bl.setPassword(self.blpass.getPassword(), isCrypted = 0) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() def bootloaderChanged(self, *args): active = self.grubCB.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.deviceButton ]: if widget: widget.set_sensitive(active) def _deviceChange(self, b, anaconda, *args): def __driveChange(combo, dxml, choices): if not choices.has_key("mbr"): return iter = combo.get_active_iter() if not iter: return first = combo.get_model()[iter][1] desc = choices["mbr"][1] dxml.get_widget("mbrRadio").set_label("%s - /dev/%s" %(_(desc), first)) dxml.get_widget("mbrRadio").set_data("bootDevice", first) def __genStore(combo, disks, active): model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(model) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text = 0) for disk in disks: i = model.append(None) model[i] = ("%s %8.0f MB %s" %(disk.name, disk.size, disk.description), "%s" %(disk.name,)) if disk.name == active: combo.set_active_iter(i) return model (dxml, dialog) = gui.getGladeWidget("blwhere.glade", "blwhereDialog") gui.addFrame(dialog) dialog.set_transient_for(self.parent) dialog.show() choices = anaconda.platform.bootloaderChoices(self.bl) for t in ("mbr", "boot"): if not choices.has_key(t): continue (device, desc) = choices[t] w = dxml.get_widget("%sRadio" %(t,)) w.set_label("%s - /dev/%s" %(_(desc), device)) w.show() if self.bldev == device: w.set_active(True) else: w.set_active(False) w.set_data("bootDevice", device) for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) lbl = dxml.get_widget("bd%dLabel" %(i,)) combo.show() lbl.show() partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks bl_disks = [d for d in disks if d in partitioned] m = __genStore(combo, bl_disks, self.driveorder[i - 1]) dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices) __driveChange(dxml.get_widget("bd1Combo"), dxml, choices) while 1: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break # set the boot device based on what they chose if dxml.get_widget("bootRadio").get_active(): self.bldev = dxml.get_widget("bootRadio").get_data("bootDevice") elif dxml.get_widget("mbrRadio").get_active(): self.bldev = dxml.get_widget("mbrRadio").get_data("bootDevice") else: raise RuntimeError, "No radio button selected!" # and adjust the boot order neworder = [] for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) iter = combo.get_active_iter() if not iter: continue act = combo.get_model()[iter][1] if act not in neworder: neworder.append(act) for d in self.driveorder: if d not in neworder: neworder.append(d) self.driveorder = neworder break dialog.destroy() self.grubCB.set_label(_("_Install boot loader on /dev/%s.") % (self.bldev,)) return rc def _setBLCBText(self): self.grubCB.set_label(_("_Install boot loader on /dev/%s.") % (self.bldev,)) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox (False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton(_("_Install boot loader on /dev/%s.") % (self.bldev,)) self.grubCB.set_active(not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.setDevice(self.bldev) self.bl.drivelist = self.driveorder if not self.grubCB.get_active(): # 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) # kind of a hack... self.bl.defaultDevice = None return else: self.dispatch.skipStep("instbootloader", skip = 0) self.bl.setUseGrub(1) # set the password self.bl.setPassword(self.blpass.getPassword(), isCrypted = 0) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() def bootloaderChanged(self, *args): active = self.grubCB.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.deviceButton ]: if widget: widget.set_sensitive(active) def _deviceChange(self, b, anaconda, *args): def __driveChange(combo, dxml, choices): if not choices.has_key("mbr"): return iter = combo.get_active_iter() if not iter: return first = combo.get_model()[iter][1] desc = choices["mbr"][1] dxml.get_widget("mbrRadio").set_label("%s - /dev/%s" %(_(desc), first)) dxml.get_widget("mbrRadio").set_data("bootDevice", first) def __genStore(combo, disks, active): model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(model) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text = 0) for disk in disks: i = model.append(None) model[i] = ("%s %8.0f MB %s" %(disk.name, disk.size, disk.description), "%s" %(disk.name,)) if disk.name == active: combo.set_active_iter(i) return model (dxml, dialog) = gui.getGladeWidget("blwhere.glade", "blwhereDialog") gui.addFrame(dialog) dialog.set_transient_for(self.parent) dialog.show() choices = anaconda.platform.bootloaderChoices(self.bl) for t in ("mbr", "boot"): if not choices.has_key(t): continue (device, desc) = choices[t] w = dxml.get_widget("%sRadio" %(t,)) w.set_label("%s - /dev/%s" %(_(desc), device)) w.show() if self.bldev == device: w.set_active(True) else: w.set_active(False) w.set_data("bootDevice", device) for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) lbl = dxml.get_widget("bd%dLabel" %(i,)) combo.show() lbl.show() partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks bl_disks = [d for d in disks if d in partitioned] m = __genStore(combo, bl_disks, self.driveorder[i - 1]) dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices) __driveChange(dxml.get_widget("bd1Combo"), dxml, choices) while 1: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break # set the boot device based on what they chose if dxml.get_widget("bootRadio").get_active(): self.bldev = dxml.get_widget("bootRadio").get_data("bootDevice") elif dxml.get_widget("mbrRadio").get_active(): self.bldev = dxml.get_widget("mbrRadio").get_data("bootDevice") else: raise RuntimeError, "No radio button selected!" # and adjust the boot order neworder = [] for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) iter = combo.get_active_iter() if not iter: continue act = combo.get_model()[iter][1] if act not in neworder: neworder.append(act) for d in self.driveorder: if d not in neworder: neworder.append(d) self.driveorder = neworder break dialog.destroy() self.grubCB.set_label(_("_Install boot loader on /dev/%s.") % (self.bldev,)) return rc def _setBLCBText(self): self.grubCB.set_label(_("_Install boot loader on /dev/%s.") % (self.bldev,)) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None isBlack = False ''' f = open("/root/isotype") lines = f.readlines() f.close() for x in lines: if x.find("vServer") != -1 or x.find("vCenter") != -1: isBlack = True break ''' import fvi x = fvi.get_iso_type() if x.find("vServer") != -1 or x.find("vCenter") != -1: isBlack = True if isBlack: bgcolor = "#333333" fontcolor = "#e6e6e6" else: bgcolor = "#cccccc" fontcolor = "#333333" eboximage = gtk.EventBox() eboximage.set_app_paintable(True) eboximage.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(bgcolor)) eboximage.set_size_request(1024,100) fixed = gtk.Fixed() i = gtk.Image() path = "/usr/share/anaconda/pixmaps/icon11_boot.png" i.set_from_file(path) i.show() fixed.put(i,45,15) label1 = gtk.Label() lstr = "<span font_desc=' 16' weight='bold' foreground='"+fontcolor+"'><b>引导程序:</b></span>" label1.set_markup(lstr) fixed.put(label1,160,23) label2 = gtk.Label() label2.set_markup("<span font_desc=' 11.5' weight='bold' foreground='"+fontcolor+"'><b>选择引导程序安装位置</b></span>") fixed.put(label2,160,58) eboximage.add(fixed) eboximage.show_all() thebox = gtk.VBox(False,0) thebox.pack_start(eboximage,False,False,0) ########################################################### # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] ########################################################### boxall = gtk.VBox(False,0) hb = gtk.HBox(False, 12) """self.grubCB = gtk.CheckButton(_("_Install boot loader on /dev/%s.") % (self.bldev,))""" self.grubCB = gtk.CheckButton((u"在/dev/%s 中安装引导装载程序") % (self.bldev,)) l = self.grubCB.get_children()[0] lstr = "<span foreground='#333333'><b>"+l.get_text()+"</b></span>" l.set_markup(lstr) self.grubCB.set_active(not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_(u"更换设备")) l = self.deviceButton.get_children()[0] lstr = "<span foreground='#333333'><b>"+l.get_text()+"</b></span>" l.set_markup(lstr) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False,False,32) boxall.pack_start(hb,False,False,0) ################################################################# # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) boxall.pack_start(self.blpass.getWidget(),False,False,5) ################################################################### # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) boxall.pack_start(self.oslist.getWidget(),True,True,10) fix = gtk.Fixed() fix.put(boxall,35,35) thebox.pack_start(fix,True,True,20) ###################################################################### self.bootloaderChanged() """return thebox""" #################################################################### ebox = gtk.EventBox() ebox.add(thebox) ebox.set_app_paintable(True) ebox.set_border_width(0) ebox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse("#e6e6e6")) return ebox
def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf self.driveorder = self.bl.drivelist if len(self.driveorder) == 0: partitioned = anaconda.id.storage.partitioned disks = anaconda.id.storage.disks self.driveorder = [d.name for d in disks if d in partitioned] if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None isBlack = False ''' f = open("/root/isotype") lines = f.readlines() f.close() for x in lines: if x.find("vServer") != -1 or x.find("vCenter") != -1: isBlack = True break ''' import fvi x = fvi.get_iso_type() if x.find("vServer") != -1 or x.find("vCenter") != -1: isBlack = True if isBlack: bgcolor = "#333333" fontcolor = "#e6e6e6" else: bgcolor = "#cccccc" fontcolor = "#333333" eboximage = gtk.EventBox() eboximage.set_app_paintable(True) eboximage.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(bgcolor)) eboximage.set_size_request(1024,100) fixed = gtk.Fixed() i = gtk.Image() path = "/usr/share/anaconda/pixmaps/icon11_boot.png" i.set_from_file(path) i.show() fixed.put(i,45,15) label1 = gtk.Label() lstr = "<span font_desc=' 16' weight='bold' foreground='"+fontcolor+"'><b>引导程序:</b></span>" label1.set_markup(lstr) fixed.put(label1,160,23) label2 = gtk.Label() label2.set_markup("<span font_desc=' 11.5' weight='bold' foreground='"+fontcolor+"'><b>选择引导程序安装位置</b></span>") fixed.put(label2,160,58) eboximage.add(fixed) eboximage.show_all() thebox = gtk.VBox(False,0) thebox.pack_start(eboximage,False,False,0) ########################################################### # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.platform.bootloaderChoices(self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] ########################################################### boxall = gtk.VBox(False,0) hb = gtk.HBox(False, 12) """self.grubCB = gtk.CheckButton(_("_Install boot loader on /dev/%s.") % (self.bldev,))""" self.grubCB = gtk.CheckButton((u"在/dev/%s 中安装引导装载程序") % (self.bldev,)) l = self.grubCB.get_children()[0] lstr = "<span foreground='#333333'><b>"+l.get_text()+"</b></span>" l.set_markup(lstr) self.grubCB.set_active(not self.dispatch.stepInSkipList("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_(u"更换设备")) l = self.deviceButton.get_children()[0] lstr = "<span foreground='#333333'><b>"+l.get_text()+"</b></span>" l.set_markup(lstr) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False,False,32) boxall.pack_start(hb,False,False,0) ################################################################# # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) boxall.pack_start(self.blpass.getWidget(),False,False,5) ################################################################### # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) boxall.pack_start(self.oslist.getWidget(),True,True,10) fix = gtk.Fixed() fix.put(boxall,35,35) thebox.pack_start(fix,True,True,20) ###################################################################### self.bootloaderChanged() """return thebox""" #################################################################### ebox = gtk.EventBox() ebox.add(thebox) ebox.set_app_paintable(True) ebox.set_border_width(0) ebox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse("#e6e6e6")) return ebox
def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox (False, 5) thebox.set_border_width(10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) if self.bl.useGrub(): self.blname = "GRUB" else: self.blname = None # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.id.fsset.bootloaderChoices(anaconda.id.diskset, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] vb = gtk.VBox(False, 6) self.grub_radio = gtk.RadioButton(None, _("The %s boot loader will be " "installed on /dev/%s.") % ("GRUB", self.bldev)) self.grub_radio.set_use_underline(False) vb.pack_start(self.grub_radio) self.none_radio = gtk.RadioButton(self.grub_radio, _("No boot loader will be installed.")) vb.pack_start(self.none_radio) if self.blname is None: self.none_radio.set_active(True) self.grub_radio.set_active(False) else: self.grub_radio.set_active(True) self.none_radio.set_active(False) self.grub_radio.connect("toggled", self.bootloaderChanged) self.none_radio.connect("toggled", self.bootloaderChanged) thebox.pack_start(vb, False) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent, self.blname) thebox.pack_start(self.oslist.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # check box to control showing the advanced screen self.advanced = gtk.CheckButton(_("Configure advanced boot loader " "_options")) if self.dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(False) else: self.advanced.set_active(True) thebox.pack_start(self.advanced, False) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.setDevice(self.bldev) if self.none_radio.get_active(): # 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) # kind of a hack... self.bl.defaultDevice = None 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) # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() if self.advanced.get_active(): self.dispatch.skipStep("bootloaderadvanced", skip = 0) else: self.dispatch.skipStep("bootloaderadvanced", skip = 1) def bootloaderChanged(self, *args): active = self.grub_radio.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.advanced ]: widget.set_sensitive(active) def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.id.bootloader self.intf = anaconda.intf if self.bl.getPassword(): self.usePass = 1 self.password = self.bl.getPassword() else: self.usePass = 0 self.password = None thebox = gtk.VBox (False, 5) thebox.set_border_width(10) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) if self.bl.useGrub(): self.blname = "GRUB" else: self.blname = None # make sure we get a valid device to say we're installing to if self.bl.getDevice() is not None: self.bldev = self.bl.getDevice() else: # we don't know what it is yet... if mbr is possible, we want # it, else we want the boot dev choices = anaconda.id.fsset.bootloaderChoices(anaconda.id.diskset, self.bl) if choices.has_key('mbr'): self.bldev = choices['mbr'][0] else: self.bldev = choices['boot'][0] vb = gtk.VBox(False, 6) self.grub_radio = gtk.RadioButton(None, _("The %s boot loader will be " "installed on /dev/%s.") % ("GRUB", self.bldev)) self.grub_radio.set_use_underline(False) vb.pack_start(self.grub_radio) self.none_radio = gtk.RadioButton(self.grub_radio, _("No boot loader will be installed.")) vb.pack_start(self.none_radio) if self.blname is None: self.none_radio.set_active(True) self.grub_radio.set_active(False) else: self.grub_radio.set_active(True) self.none_radio.set_active(False) self.grub_radio.connect("toggled", self.bootloaderChanged) self.none_radio.connect("toggled", self.bootloaderChanged) thebox.pack_start(vb, False) spacer = gtk.Label("") spacer.set_size_request(10, 1) thebox.pack_start(spacer, False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent, self.blname) thebox.pack_start(self.oslist.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) thebox.pack_start (gtk.HSeparator(), False) # check box to control showing the advanced screen self.advanced = gtk.CheckButton(_("Configure advanced boot loader " "_options")) if self.dispatch.stepInSkipList("bootloaderadvanced"): self.advanced.set_active(False) else: self.advanced.set_active(True) thebox.pack_start(self.advanced, False) self.bootloaderChanged() return thebox
class MainBootloaderWindow(InstallWindow): windowTitle = N_("Boot Loader Configuration") def __init__(self, ics): InstallWindow.__init__(self, ics) self.parent = ics.getICW().window def getPrev(self): pass def getNext(self): # go ahead and set the device even if we already knew it # since that won't change anything self.bl.stage1_device = self.bldev self.bl.drive_order = self.driveorder if not self.grubCB.get_active(): # if we're not installing a boot loader, don't show the second # screen and don't worry about other options self.dispatch.skip_steps("instbootloader") return else: self.dispatch.request_steps("instbootloader") # set the password self.bl.password = self.blpass.getPassword() # set the bootloader images based on what's in our list self.oslist.setBootloaderImages() def bootloaderChanged(self, *args): active = self.grubCB.get_active() for widget in [ self.oslist.getWidget(), self.blpass.getWidget(), self.deviceButton ]: if widget: widget.set_sensitive(active) def _deviceChange(self, b, anaconda, *args): def __genStore(combo, disks, active): model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) combo.set_model(model) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text = 0) for disk in disks: i = model.append(None) model[i] = ("%s %8.0f MB %s" %(disk.name, disk.size, disk.description), disk) if disk.name == active: combo.set_active_iter(i) return model (dxml, dialog) = gui.getGladeWidget("blwhere.glade", "blwhereDialog") gui.addFrame(dialog) dialog.set_transient_for(self.parent) dialog.show() # XXX for md stage1, should we show md, first member disk, or first # disk? stage1 = anaconda.storage.bootLoaderDevice stage1_desc = anaconda.bootloader.device_description(stage1) choices = {"mbr": (stage1, stage1_desc)} stage2 = anaconda.storage.bootDevice try: stage2_desc = anaconda.bootloader.device_description(stage2) except ValueError: # stage2's type isn't valid as stage1, so don't offer "boot". pass else: choices["boot"] = (stage2, stage2_desc) for t in ("mbr", "boot"): if not choices.has_key(t): continue (device, desc) = choices[t] w = dxml.get_widget("%sRadio" %(t,)) w.set_label("%s - %s" %(desc, device.path)) w.show() w.set_active(self.bldev == device) w.set_data("bootDevice", device) bl_disks = anaconda.bootloader.drives for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) lbl = dxml.get_widget("bd%dLabel" %(i,)) combo.show() lbl.show() m = __genStore(combo, bl_disks, self.driveorder[i - 1]) while True: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break # set the boot device based on what they chose if dxml.get_widget("bootRadio").get_active(): self.bldev = dxml.get_widget("bootRadio").get_data("bootDevice") elif dxml.get_widget("mbrRadio").get_active(): self.bldev = dxml.get_widget("mbrRadio").get_data("bootDevice") else: raise RuntimeError, "No radio button selected!" # and adjust the boot order neworder = [] for i in range(1, 5): if len(self.driveorder) < i: break combo = dxml.get_widget("bd%dCombo" %(i,)) iter = combo.get_active_iter() if not iter: continue act = combo.get_model()[iter][1].name if act not in neworder: neworder.append(act) for d in self.driveorder: if d not in neworder: neworder.append(d) self.driveorder = neworder break dialog.destroy() self.grubCB.set_label(_("_Install boot loader on %s.") % (self.bldev.path,)) return rc def getScreen(self, anaconda): self.dispatch = anaconda.dispatch self.bl = anaconda.bootloader self.intf = anaconda.intf self.driveorder = [d.name for d in self.bl.drives] thebox = gtk.VBox (False, 12) thebox.set_border_width(18) # make sure we get a valid device to say we're installing to self.bldev = self.bl.stage1_device hb = gtk.HBox(False, 12) self.grubCB = gtk.CheckButton(_("_Install boot loader on %s.") % (self.bldev.path,)) self.grubCB.set_active(self.dispatch.step_enabled("instbootloader")) self.grubCB.connect("toggled", self.bootloaderChanged) hb.pack_start(self.grubCB, False) # no "Change device" button on EFI systems, since there should only # be one EFI System Partition available/usable self.deviceButton = None if not iutil.isEfi(): self.deviceButton = gtk.Button(_("_Change device")) self.deviceButton.connect("clicked", self._deviceChange, anaconda) hb.pack_start(self.deviceButton, False) thebox.pack_start(hb, False) # control whether or not there's a boot loader password and what it is self.blpass = BootloaderPasswordWidget(anaconda, self.parent) thebox.pack_start(self.blpass.getWidget(), False) # configure the systems available to boot from the boot loader self.oslist = OSBootWidget(anaconda, self.parent) if not self.bl.name == "GRUB2": # with grub2 we use os-prober to generate menu entries for all # other OS it finds without user interaction thebox.pack_end(self.oslist.getWidget(), True) self.bootloaderChanged() return thebox