Пример #1
0
class PartEdit(QtGui.QWidget):

    currentPart = None
    currentPartNum = 0
    isPartitionUsed = False

    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_PartEdit()
        self.ui.setupUi(self)

    def updateContent(self):
        part = self.currentPart
        self.ui.deletePartition.setVisible(True)
        self.ui.resizePartition.setVisible(True)
        self.ui.formatType.setCurrentIndex(0)
        self.ui.formatCheck.setChecked(False)

        self.ui.resizePartition.setVisible(part.isResizable())
        if part._parted_type == parteddata.freeSpaceType:
            self.ui.deletePartition.setVisible(False)
            self.ui.resizePartition.setVisible(False)
            self.ui.partitionSize.setEnabled(True)
            self.ui.partitionSlider.setEnabled(True)
        elif part._parted_type == parteddata.raidPartitionType:
            self.ui.formatType.setCurrentIndex(5)
            self.ui.formatType.setEnabled(False)
            self.ui.formatCheck.setChecked(True)
            self.ui.formatCheck.setEnabled(False)
        else:
            self.ui.partitionSize.setEnabled(False)
            self.ui.partitionSlider.setEnabled(False)

        self.ui.devicePath.setText(part.getPath())
        self.ui.fileSystem.setText(part.getFSName())
        self.ui.partitionSize.setMaximum(part.getMB()-1)
        self.ui.partitionSlider.setMaximum(part.getMB()-1)
        self.ui.partitionSize.setValue(part.getMB()-1)
        self.ui.information.setText("")
        self.ui.partitionSize.setMinimum(10)
        self.ui.partitionSlider.setMinimum(10)

        # We must select formatType after GUI update
        partitionType = getPartitionType(part)
        if partitionType:
            self.isPartitionUsed = True
            for i,j in partitionTypes.items():
                if j == partitionType:
                    self.ui.formatType.setCurrentIndex(i)
        else:
            self.isPartitionUsed = False

        isFormatChecked = getPartitionType(part,0)
        if isFormatChecked:
            self.ui.formatCheck.setChecked(True)
Пример #2
0
    def __init__(self, useTypes):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_PartEdit()
        self.ui.setupUi(self)
        self.ui.formatType.clear()

        for useType in useTypes:
            if not useType:
                self.ui.formatType.addItem("")
            else:
                self.ui.formatType.addItem(useType.desc)
Пример #3
0
    def __init__(self, useTypes):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_PartEdit()
        self.ui.setupUi(self)
        self.ui.formatType.clear()

        for useType in useTypes:
            if not useType:
                self.ui.formatType.addItem("")
            else:
                self.ui.formatType.addItem(useType.desc)
Пример #4
0
class PartEdit(QtGui.QWidget):

    currentPart = None
    currentPartNum = 0
    isPartitionUsed = False

    def __init__(self, useTypes):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_PartEdit()
        self.ui.setupUi(self)
        self.ui.formatType.clear()

        for useType in useTypes:
            if not useType:
                self.ui.formatType.addItem("")
            else:
                self.ui.formatType.addItem(useType.desc)

    def updateContent(self):
        part = self.currentPart
        self.ui.deletePartition.setVisible(True)
        self.ui.resizePartition.setVisible(True)
        self.ui.formatType.setCurrentIndex(0)
        self.ui.formatCheck.setChecked(True)

        if part._parted_type == parteddata.freeSpaceType:
            self.ui.deletePartition.setVisible(False)
            self.ui.resizePartition.setVisible(False)
            self.ui.partitionSize.setEnabled(True)
            self.ui.partitionSlider.setEnabled(True)
        else:
            self.ui.partitionSize.setEnabled(False)
            self.ui.partitionSlider.setEnabled(False)

        self.ui.deviceGroup.setTitle("%s - %s" % (self.ui.deviceGroup.title(), part.getPath()))
        self.ui.fileSystem.setText(part.getFSName())
        self.ui.partitionSize.setMaximum(part.getMB()-1)
        self.ui.partitionSlider.setMaximum(part.getMB()-1)
        self.ui.partitionSize.setValue(part.getMB()-1)
        self.ui.information.setText("")
        self.ui.partitionSize.setMinimum(minimumSize)
        self.ui.partitionSlider.setMinimum(minimumSize)

        # We must select formatType after GUI update
        partitionType = getPartitionType(part)
        if partitionType:
            self.isPartitionUsed = True
            for i in range(len(partitionTypes)):
                if partitionTypes[i] == partitionType:
                    self.ui.formatType.setCurrentIndex(i)
            key = part.getFSName()
            if part.getFSName() == 'linux-swap':
                key = 'swap'
            self.ui.fileSystemBox.setCurrentIndex(self.ui.fileSystemBox.findText(key))
        else:
            self.isPartitionUsed = False

        self.ui.resizePartition.setVisible(part.isResizable() and not self.isPartitionUsed)

        isFormatChecked = getPartitionType(part,0)
        if isFormatChecked:
            self.ui.formatCheck.setChecked(True)
        else:
            self.ui.formatCheck.setChecked(False)
Пример #5
0
class PartEdit(QtGui.QWidget):

    currentPart = None
    currentPartNum = 0
    isPartitionUsed = False

    def __init__(self, useTypes):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_PartEdit()
        self.ui.setupUi(self)
        self.ui.formatType.clear()

        for useType in useTypes:
            if not useType:
                self.ui.formatType.addItem("")
            else:
                self.ui.formatType.addItem(useType.desc)

    def updateContent(self):
        part = self.currentPart
        self.ui.deletePartition.setVisible(True)
        self.ui.resizePartition.setVisible(True)
        self.ui.formatType.setCurrentIndex(0)
        self.ui.formatCheck.setChecked(True)

        if part._type == parteddata.freeSpaceType:
            self.ui.deletePartition.setVisible(False)
            self.ui.resizePartition.setVisible(False)
            self.ui.partitionSize.setEnabled(True)
            self.ui.partitionSlider.setEnabled(True)
        else:
            self.ui.partitionSize.setEnabled(False)
            self.ui.partitionSlider.setEnabled(False)

        self.ui.deviceGroup.setTitle("%s - %s" % (self.ui.deviceGroup.title(), part.getPath()))
        self.ui.fileSystem.setText(part.getFSName())
        self.ui.partitionSize.setMaximum(part.getMB() - 1)
        self.ui.partitionSlider.setMaximum(part.getMB() - 1)
        self.ui.partitionSize.setValue(part.getMB() - 1)
        self.ui.information.setText("")
        self.ui.partitionSize.setMinimum(160)
        self.ui.partitionSlider.setMinimum(160)

        #  We must select formatType after GUI update
        partitionType = getPartitionType(part)
        if partitionType:
            self.isPartitionUsed = True
            for i in range(len(partitionTypes)):
                if partitionTypes[i] == partitionType:
                    self.ui.formatType.setCurrentIndex(i)
            key = part.getFSName()
            if part.getFSName() == "linux-swap":
                key = "swap"
            self.ui.fileSystemBox.setCurrentIndex(self.ui.fileSystemBox.findText(key))
        else:
            self.isPartitionUsed = False

        self.ui.resizePartition.setVisible(part.isResizable() and not self.isPartitionUsed)

        isFormatChecked = getPartitionType(part, 0)
        if isFormatChecked:
            self.ui.formatCheck.setChecked(True)
        else:
            self.ui.formatCheck.setChecked(False)
Пример #6
0
 def __init__(self, *args):
     QtGui.QWidget.__init__(self,None)
     self.ui = Ui_PartEdit()
     self.ui.setupUi(self)