Пример #1
0
    def forward(self):
        if self.skip:
            return 0

        # Carry out the requested operation!
        devpart="%s%d" % (self.device, self.partitionnum)
        if self.ntfs.deletestate:
            install.rmpart(self.device, self.partitionnum)
            self.partlist.remove(devpart)
            self.diskChanged(self.device)

        elif self.ntfs.shrinkstate and popupWarning(
                _("You are about to shrink %s."
                " Make sure you have backed up"
                " any important data.\n\n"
                "Continue?") % devpart):
            newsize = int(self.ntfs.size * 1e9 / self.secsize)  # sectors
            message = install.doNTFSshrink(self.device, self.partitionnum,
                    newsize, self.pstart, self.dinfo)
            if message:
                # resize failed
                popupMessage(_("Sorry, resizing failed. Here is the"
                        " error report:\n\n") + message)
            self.diskChanged(self.device)

        if (devpart == self.partlist[-1]):
            # Last NTFS partition
            return 0

        self.reinit()
        # Don't go to next stage
        return -1
Пример #2
0
    def __init__(self):
        Stage.__init__(self, moduleDescription)

        # Info on drive
        self.device = install.get_config('autodevice', trap=False)
        if not self.device:
            self.device = install.listDevices()[0][0]
        self.dinfo = install.getDeviceInfo(self.device)

        # Info: total drive size
        totalsize = self.addWidget(ShowInfoWidget(
                _("Total capacity of drive %s:  ") % self.device))
        totalsize.set(self.dinfo[0])

        # Get partition info (consider only space after NTFS partitions)
        parts = install.getParts(self.device)
        self.startpart = 1
        self.startsector = 0
        for p in parts:
            if (p[1] == 'ntfs'):
                self.startpart = p[0] + 1
                self.startsector = p[4] + 1

        avsec = (self.dinfo[1] * self.dinfo[2] - self.startsector)
        self.avG = avsec * self.dinfo[3] / 1.0e9
        if (self.startpart > 1):
            popupMessage(_("One or more NTFS (Windows) partitions were"
                    " found. These will be retained. The available space"
                    " is thus reduced to %3.1f GB.\n"
                    "Allocation will begin at partition %d.") %
                        (self.avG, self.startpart))

        self.homesizeG = 0.0
        self.swapsizeG = 0.0
        self.root = None    # To suppress writing before widget is created

        self.swapfc = None  # To suppress errors due to widget not yet ready
        # swap size
        self.swapWidget()

        self.swapfc = self.addCheckButton(_("Check for bad blocks "
                "when formatting swap partition.\nClear this when running "
                "in VirtualBox (it takes forever)."))
        self.setCheck(self.swapfc, True)

        # home size
        self.homeWidget()

        # root size
        self.root = self.addWidget(ShowInfoWidget(
                _("Space for Linux system:  ")))
        self.adjustroot()
Пример #3
0
    def forward(self):
        # Check entered passwords are identical
        pw = self.pwe.get_text1()
        if (pw != self.pwe.get_text2()):
            popupMessage(_("The passwords are not identical,\n"
                    "  Please try again."))

        # Set the password
        elif install.set_rootpw(pw):
            return 0

        self.reinit()
        return -1
Пример #4
0
 def on_buttonHelp_clicked(self, widget, data=None):
     popupMessage(currentstage.getHelp(), title=_("larchin Help"))