def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescueGrubWidget() self.ui.setupUi(self) self.ui.installFirstMBR.setChecked(True) # fill device list for dev in yali.storage.devices: DeviceItem(self.ui.deviceList, dev) # select the first disk by default self.ui.deviceList.setCurrentRow(0) # be sure first is selected device self.device = self.ui.deviceList.item(0).getDevice() self.connect(self.ui.deviceList, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.slotDeviceChanged) self.connect(self.ui.deviceList, SIGNAL("itemClicked(QListWidgetItem*)"), self.slotSelect)
class Widget(QtGui.QWidget, ScreenWidget): title = _("Repair the Bootloader") icon = "iconBootloader" help = _(""" <font size="+2">Repair bootloader</font> <font size="+1"> <p> A bootloader is a tiny program that runs when a computer is first powered up. It is responsible for loading the operating system into memory and then transferring the control to it. </p> <p> Pardus uses GRUB (GRand Unified Bootloader) as the default bootloader. GRUB allows you to boot any supported operating system by presenting the user with a menu. </p> <p> You may want to repair GRUB bootloader if you installed another operating system which replaces GRUB with its own bootloader thus avoiding you to boot into Pardus. You may also want to repair GRUB if you're stuck with strange GRUB errors during boot. <p> The recommended way to use GRUB is to install it to the beginning of the boot disk. You can always choose another installation method if you know what you are doing. </p> </font> """) def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescueGrubWidget() self.ui.setupUi(self) self.ui.installFirstMBR.setChecked(True) # fill device list for dev in yali.storage.devices: DeviceItem(self.ui.deviceList, dev) # select the first disk by default self.ui.deviceList.setCurrentRow(0) # be sure first is selected device self.device = self.ui.deviceList.item(0).getDevice() self.connect(self.ui.deviceList, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.slotDeviceChanged) self.connect(self.ui.deviceList, SIGNAL("itemClicked(QListWidgetItem*)"), self.slotSelect) def shown(self): ctx.mainScreen.disableBack() yali.storage.setOrderedDiskList() ctx.debugger.log("Disks BIOS Boot order : %s " % ','.join(ctx.installData.orderedDiskList)) def slotSelect(self): self.ui.installSelectedDisk.toggle() def slotDeviceChanged(self, o, n): self.device = o.getDevice() ctx.bootLoaderOptionalDev = self.device def execute(self): ctx.installData.bootLoaderOptionalDev = self.device # Apply GRUB Options if self.ui.installSelectedPart.isChecked(): ctx.installData.bootLoaderOption = B_INSTALL_PART ctx.installData.bootLoaderDev = ctx.installData.rescuePartition.getPath() elif self.ui.installSelectedDisk.isChecked(): ctx.installData.bootLoaderOption = B_INSTALL_MBR ctx.installData.bootLoaderDev = os.path.basename(ctx.installData.bootLoaderOptionalDev.getPath()) elif self.ui.installFirstMBR: ctx.installData.bootLoaderOption = B_INSTALL_SMART ctx.yali.guessBootLoaderDevice(ctx.installData.rescuePartition.getPath()) ctx.debugger.log("Bootloader Option is %s" % ctx.installData.bootLoaderOption) ctx.debugger.log("Bootloader Device is %s" % ctx.installData.bootLoaderDev) ctx.debugger.log("Bootloader Partition is %s" % ctx.installData.rescuePartition.getPath()) ctx.mainScreen.moveInc = 3 return True