Beispiel #1
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)

        self.ui.installFirstMBR.setChecked(True)

        # initialize all storage devices
        if not yali.storage.initDevices():
            raise GUIException, _("No storage device found.")

        # fill device list
        for dev in yali.storage.devices:
            DeviceItem(self.ui.device_list, dev)
        # select the first disk by default
        self.ui.device_list.setCurrentRow(0)
        # be sure first is selected device
        self.device = self.ui.device_list.item(0).getDevice()

        if len(yali.storage.devices) < 1:
            # don't show device list if we have just one disk
            self.ui.installMBR.hide()
            self.ui.device_list.hide()

            self.device = yali.storage.devices[0]

        self.connect(
            self.ui.device_list, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.slotDeviceChanged
        )
        self.connect(self.ui.installFirstMBR, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.installPart, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.noInstall, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.installMBR, SIGNAL("clicked()"), self.slotEnableList)
        self.connect(self.ui.device_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.slotSelect)
Beispiel #2
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = None
        self.default = None
        self.device = None
        self.boot_disk = None
        self.boot_partition = None

        self.connect(self.ui.defaultSettings, SIGNAL("toggled(bool)"), self.showDefaultSettings)
        self.connect(self.ui.noInstall, SIGNAL("toggled(bool)"), self.deactivateBootloader)
        self.connect(self.ui.installPartition, SIGNAL("toggled(bool)"), self.activateInstallPartition)
        self.connect(self.ui.drives, SIGNAL("currentIndexChanged(int)"), self.currentDeviceChanged)

        self.ui.advancedSettingsBox.show()
        self.ui.defaultSettings.setChecked(True)
Beispiel #3
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = ctx.bootloader
        self.bootloader.storage = ctx.storage
        self.default = None
        self.device = None
        self.bootDisk = None
        self.bootPartition = None

        self.connect(self.ui.noInstall, SIGNAL("toggled(bool)"), self.deactivateBootloader)
        self.connect(self.ui.installPartition, SIGNAL("toggled(bool)"), self.activateInstallPartition)
        self.connect(self.ui.drives, SIGNAL("currentIndexChanged(int)"), self.currentDeviceChanged)
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = None
        self.default = None
        self.device = None
        self.boot_disk = None
        self.boot_partition = None

        self.ui.defaultSettings.toggled[bool].connect(self.showDefaultSettings)
        self.ui.noInstall.toggled[bool].connect(self.deactivateBootloader)
#        self.ui.installPartition.toggled[bool].connect(self.activateInstallPartition)
        self.ui.drives.currentIndexChanged[int].connect(self.currentDeviceChanged)

        self.ui.advancedSettingsBox.show()
        self.ui.defaultSettings.setChecked(True)
class Widget(QWidget, ScreenWidget):
    name = "bootloadersetup"

    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = None
        self.default = None
        self.device = None
        self.boot_disk = None
        self.boot_partition = None

        self.ui.defaultSettings.toggled[bool].connect(self.showDefaultSettings)
        self.ui.noInstall.toggled[bool].connect(self.deactivateBootloader)
#        self.ui.installPartition.toggled[bool].connect(self.activateInstallPartition)
        self.ui.drives.currentIndexChanged[int].connect(self.currentDeviceChanged)

        self.ui.advancedSettingsBox.show()
        self.ui.defaultSettings.setChecked(True)

    def fillDrives(self):
        self.ui.drives.clear()
        for drive in self.bootloader.drives:
            device = ctx.storage.devicetree.getDeviceByName(drive)
            item = u"%s" % (device.name)
            self.ui.drives.addItem(item, device)

    def shown(self):
        if ctx.flags.install_type == ctx.STEP_RESCUE:
            ctx.mainScreen.disableBack()
        self.bootloader = ctx.bootloader
        self.bootloader.storage = ctx.storage
        self.fillDrives()
        self.activateChoices()

    def backCheck(self):
        if ctx.storage.doAutoPart:
            ctx.mainScreen.step_increment = 2
            ctx.storage.reset()

        return True

    def execute(self):
        self.bootloader.stage1Device = self.device

        if self.ui.noInstall.isChecked():
            self.bootloader.bootType = BOOT_TYPE_NONE
#        elif self.ui.installPartition.isChecked():
#            self.bootloader.bootType = BOOT_TYPE_PARTITION
        elif self.ui.installMBR.isChecked():
            self.bootloader.bootType = BOOT_TYPE_MBR

        if ctx.flags.install_type == ctx.STEP_RESCUE:
            ctx.mainScreen.step_increment = 2
        else:
            if ctx.flags.collection:
                ctx.collections = yali.util.get_collections()
                if len(ctx.collections) <= 1:
                    ctx.flags.collection = False
                    ctx.mainScreen.step_increment = 2
            else:
                ctx.mainScreen.step_increment = 2

        return True

    def showDefaultSettings(self, state):
        if state:
            self.device = self.default
            self.ui.advancedSettingsBox.hide()
        else:
            self.ui.advancedSettingsBox.show()

    def activateChoices(self):
        for choice in self.bootloader.choices.keys():
            if choice == BOOT_TYPE_MBR:
                self.ui.installMBR.setText(_("The first sector of"))
                self.boot_disk = self.bootloader.choices[BOOT_TYPE_MBR][0]
#            elif choice == BOOT_TYPE_RAID:
#                self.ui.installPartition.setText("The RAID array where Pardus is installed")
#                self.boot_partition = self.bootloader.choices[BOOT_TYPE_RAID][0]
#            elif choice == BOOT_TYPE_PARTITION:
#                self.ui.installPartition.setText(_("The partition where Pardus is installed"))
#                self.boot_partition = self.bootloader.choices[BOOT_TYPE_PARTITION][0]

        if self.boot_disk:
            self.default = self.boot_disk
            self.ui.installMBR.setChecked(True)
#        else:
#            self.default = self.boot_partition
#            self.ui.installPartition.setChecked(True)

    def deactivateBootloader(self):
        self.device = None

    def activateInstallPartition(self, state):
        if state:
            self.device =  self.boot_partition

    def currentDeviceChanged(self, index):
        if index != -1:
            self.device = self.ui.drives.itemData(index).name
Beispiel #6
0
class Widget(QWidget, ScreenWidget):
    name = "bootloadersetup"

    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = None
        self.default = None
        self.device = None
        self.boot_disk = None
        self.boot_partition = None

        self.ui.defaultSettings.toggled[bool].connect(self.showDefaultSettings)
        self.ui.noInstall.toggled[bool].connect(self.deactivateBootloader)
        #        self.ui.installPartition.toggled[bool].connect(self.activateInstallPartition)
        self.ui.drives.currentIndexChanged[int].connect(
            self.currentDeviceChanged)

        self.ui.advancedSettingsBox.show()
        self.ui.defaultSettings.setChecked(True)

    def fillDrives(self):
        self.ui.drives.clear()
        for drive in self.bootloader.drives:
            device = ctx.storage.devicetree.getDeviceByName(drive)
            item = u"%s" % (device.name)
            self.ui.drives.addItem(item, device)

    def shown(self):
        if ctx.flags.install_type == ctx.STEP_RESCUE:
            ctx.mainScreen.disableBack()
        self.bootloader = ctx.bootloader
        self.bootloader.storage = ctx.storage
        self.fillDrives()
        self.activateChoices()

    def backCheck(self):
        if ctx.storage.doAutoPart:
            ctx.mainScreen.step_increment = 2
            ctx.storage.reset()

        return True

    def execute(self):
        self.bootloader.stage1Device = self.device

        if self.ui.noInstall.isChecked():
            self.bootloader.bootType = BOOT_TYPE_NONE
#        elif self.ui.installPartition.isChecked():
#            self.bootloader.bootType = BOOT_TYPE_PARTITION
        elif self.ui.installMBR.isChecked():
            self.bootloader.bootType = BOOT_TYPE_MBR

        if ctx.flags.install_type == ctx.STEP_RESCUE:
            ctx.mainScreen.step_increment = 2
        else:
            if ctx.flags.collection:
                ctx.collections = yali.util.get_collections()
                if len(ctx.collections) <= 1:
                    ctx.flags.collection = False
                    ctx.mainScreen.step_increment = 2
            else:
                ctx.mainScreen.step_increment = 2

        return True

    def showDefaultSettings(self, state):
        if state:
            self.device = self.default
            self.ui.advancedSettingsBox.hide()
        else:
            self.ui.advancedSettingsBox.show()

    def activateChoices(self):
        for choice in self.bootloader.choices.keys():
            if choice == BOOT_TYPE_MBR:
                self.ui.installMBR.setText(_("General", "The first sector of"))
                self.boot_disk = self.bootloader.choices[BOOT_TYPE_MBR][0]
#            elif choice == BOOT_TYPE_RAID:
#                self.ui.installPartition.setText("The RAID array where Pardus is installed")
#                self.boot_partition = self.bootloader.choices[BOOT_TYPE_RAID][0]
#            elif choice == BOOT_TYPE_PARTITION:
#                self.ui.installPartition.setText(_("General", "The partition where Pardus is installed"))
#                self.boot_partition = self.bootloader.choices[BOOT_TYPE_PARTITION][0]

        if self.boot_disk:
            self.default = self.boot_disk
            self.ui.installMBR.setChecked(True)
#        else:
#            self.default = self.boot_partition
#            self.ui.installPartition.setChecked(True)

    def deactivateBootloader(self):
        self.device = None

    def activateInstallPartition(self, state):
        if state:
            self.device = self.boot_partition

    def currentDeviceChanged(self, index):
        if index != -1:
            self.device = self.ui.drives.itemData(index).name
Beispiel #7
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = _("Configure Bootloader")
    icon = "utilities-terminal"
    helpSummary = _("A bootloader is a tiny program that runs when a computer is first powered up.")
    help = _("""
<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>
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>
""")

    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_BootLoaderWidget()
        self.ui.setupUi(self)
        self.bootloader = ctx.bootloader
        self.bootloader.storage = ctx.storage
        self.default = None
        self.device = None
        self.bootDisk = None
        self.bootPartition = None

        self.connect(self.ui.noInstall, SIGNAL("toggled(bool)"), self.deactivateBootloader)
        self.connect(self.ui.installPartition, SIGNAL("toggled(bool)"), self.activateInstallPartition)
        self.connect(self.ui.drives, SIGNAL("currentIndexChanged(int)"), self.currentDeviceChanged)

    def fillDrives(self):
        self.ui.drives.clear()
        for drive in self.bootloader.drives:
            device = ctx.storage.devicetree.getDeviceByName(drive)
            item = u"%s" % (device.name)
            self.ui.drives.addItem(item, device)

    def shown(self):
        self.fillDrives()
        self.activateChoices()

    def backCheck(self):
        if ctx.storage.doAutoPart:
            ctx.mainScreen.stepIncrement = 2
        return True

    def execute(self):
        self.bootloader.device = self.device
        if self.ui.noInstall.isChecked():
            self.bootloader.bootType = BOOT_TYPE_NONE
        elif self.ui.installPartition.isChecked():
            self.bootloader.bootType = BOOT_TYPE_PARTITION
        elif self.ui.installMBR.isChecked():
            self.bootloader.bootType = BOOT_TYPE_MBR

        return True

    def activateChoices(self):
        for choice, (device, bootType) in self.bootloader.choices.items():
            if choice == BOOT_TYPE_MBR:
                self.ui.installMBR.setText("The first sector of")
                self.bootDisk = self.bootloader.choices[BOOT_TYPE_MBR][0]
            elif choice == BOOT_TYPE_RAID:
                self.ui.installMBR.setText("The RAID array where Pardus is installed")
                self.bootPartition = self.bootloader.choices[BOOT_TYPE_RAID][0]
            elif choice == BOOT_TYPE_PARTITION:
                self.ui.installPartition.setText("The partition where Pardus is installed")
                self.bootPartition = self.bootloader.choices[BOOT_TYPE_PARTITION][0]

        if self.bootDisk:
            self.default = self.bootDisk
            self.ui.installMBR.setChecked(True)
        else:
            self.default = self.bootPartition
            self.ui.installPartition.setChecked(True)

    def deactivateBootloader(self):
        self.device = None

    def activateInstallPartition(self, state):
        if state:
            self.device =  self.bootPartition

    def currentDeviceChanged(self, index):
        if index != -1:
            self.device = self.ui.drives.itemData(index).toPyObject().name
Beispiel #8
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = _("Configure Bootloader")
    icon = "iconBootloader"
    help = _(
        """
<font size="+2">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>
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_BootLoaderWidget()
        self.ui.setupUi(self)

        self.ui.installFirstMBR.setChecked(True)

        # initialize all storage devices
        if not yali.storage.initDevices():
            raise GUIException, _("No storage device found.")

        # fill device list
        for dev in yali.storage.devices:
            DeviceItem(self.ui.device_list, dev)
        # select the first disk by default
        self.ui.device_list.setCurrentRow(0)
        # be sure first is selected device
        self.device = self.ui.device_list.item(0).getDevice()

        if len(yali.storage.devices) < 1:
            # don't show device list if we have just one disk
            self.ui.installMBR.hide()
            self.ui.device_list.hide()

            self.device = yali.storage.devices[0]

        self.connect(
            self.ui.device_list, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.slotDeviceChanged
        )
        self.connect(self.ui.installFirstMBR, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.installPart, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.noInstall, SIGNAL("clicked()"), self.slotDisableList)
        self.connect(self.ui.installMBR, SIGNAL("clicked()"), self.slotEnableList)
        self.connect(self.ui.device_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.slotSelect)

    def shown(self):
        yali.storage.setOrderedDiskList()
        ctx.debugger.log("Disks BIOS Boot order : %s " % ",".join(ctx.installData.orderedDiskList))
        self.getBootable().setBootable()

    def getBootable(self):
        # opts = get_kernel_option("mudur")
        opts = yali.sysutils.liveMediaSystem()
        for i in range(self.ui.device_list.count()):
            item = self.ui.device_list.item(i)
            if opts.__eq__("harddisk"):
                if item.getDevice().getPath() == ctx.installData.orderedDiskList[1]:
                    return item
            else:
                if item.getDevice().getPath() == ctx.installData.orderedDiskList[0]:
                    return item

    def backCheck(self):
        if ctx.autoInstall:
            # we need to go partition auto screen, not manual ;)
            ctx.mainScreen.moveInc = 2
        return True

    def slotDisableList(self):
        self.ui.device_list.setEnabled(False)
        self.ui.device_list.setCurrentItem(self.getBootable())

    def slotEnableList(self):
        self.ui.device_list.setEnabled(True)

    def slotSelect(self):
        self.ui.installMBR.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.noInstall.isChecked():
            ctx.installData.bootLoaderOption = B_DONT_INSTALL
        elif self.ui.installPart.isChecked():
            ctx.installData.bootLoaderOption = B_INSTALL_PART
        elif self.ui.installMBR.isChecked():
            ctx.installData.bootLoaderOption = B_INSTALL_MBR
        else:
            ctx.installData.bootLoaderOption = B_INSTALL_SMART
        ctx.installData.bootLoaderDetectOthers = self.ui.autoAddOthers.isChecked()
        return True