Example #1
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_RescueWidget()
        self.ui.setupUi(self)
        self.ui.info.hide()
        self.radios = [self.ui.useGrub, self.ui.usePisiHs, self.ui.usePassword]
        self.isSuitableForRescue = True

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

        # Get usable partitions for rescue
        self.partitionList = PardusPartitions(self)

        # Set Radio actions
        for radio in self.radios:
            if not self.isSuitableForRescue:
                radio.hide()
            else:
                self.connect(radio, SIGNAL("toggled(bool)"), ctx.mainScreen.enableNext)

        # Reboot Button
        self.connect(self.ui.rebootButton, SIGNAL("clicked()"), yali.sysutils.reboot)
Example #2
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = _("System Repair")
    icon = ""
    help = _("""
<font size="+2">System Repair</font>
<font size="+1">
<p>
This is a rescue mode help document.
</p>
</font>
""")

    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_RescueWidget()
        self.ui.setupUi(self)
        self.ui.info.hide()
        self.radios = [self.ui.useGrub, self.ui.usePisiHs, self.ui.usePassword]
        self.isSuitableForRescue = True

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

        # Get usable partitions for rescue
        self.partitionList = PardusPartitions(self)

        # Set Radio actions
        for radio in self.radios:
            if not self.isSuitableForRescue:
                radio.hide()
            else:
                self.connect(radio, SIGNAL("toggled(bool)"), ctx.mainScreen.enableNext)

        # Reboot Button
        self.connect(self.ui.rebootButton, SIGNAL("clicked()"), yali.sysutils.reboot)

    def updateNext(self):
        for radio in self.radios:
            if radio.isChecked():
                ctx.mainScreen.enableNext()
                return
        ctx.mainScreen.disableNext()
        ctx.mainScreen.processEvents()

    def shown(self):
        ctx.mainScreen.disableBack()
        self.updateNext()
        if not self.isSuitableForRescue:
            self.ui.solutionLabel.hide()
            ctx.mainScreen.disableNext()
        else:
            self.ui.rebootButton.hide()

    def execute(self):
        if self.ui.usePisiHs.isChecked():
            ctx.rescueMode = "pisi"
            ctx.mainScreen.moveInc = 2
        elif self.ui.usePassword.isChecked():
            ctx.rescueMode = "pass"
            ctx.mainScreen.moveInc = 3
        elif self.ui.useGrub.isChecked():
            ctx.rescueMode = "grub"

        ctx.installData.rescuePartition = self.ui.partitionList.currentItem().getPartition()
        ctx.debugger.log("Selected Partition for rescue is %s" % ctx.installData.rescuePartition.getPath())

        ctx.yali.info.updateAndShow(_("Mounting disk partition..."))
        # Mount selected partition
        ctx.partrequests.append(request.MountRequest(ctx.installData.rescuePartition, parttype.root))
        ctx.partrequests.applyAll()
        ctx.yali.info.hide()

        return True