コード例 #1
0
ファイル: DiskWidgets.py プロジェクト: Tayyib/uludag
    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)
コード例 #2
0
ファイル: DiskWidgets.py プロジェクト: Tayyib/uludag
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)