Ejemplo n.º 1
0
def fillFilesystemMenu(widget, format, availables=None, ignores=None):
    if availables:
        names =availables
    else:
        names = device_formats.keys()

    if format and format.supported and format.formattable:
        default = format.type
    else:
        default = get_default_filesystem_type()

    index = 0
    i = 0
    for name in names:
        format = device_formats[name]()
        if not format.supported:
            continue

        if ignores and name in ignores:
            continue

        if format.formattable:
            widget.addItem(name)
            if default == name:
                index = i
            i += 1

    widget.setCurrentIndex(index)
Ejemplo n.º 2
0
def createFSTypeMenu(parent, format, mountCombo, availablefstypes=None, ignorefs=None,
                     filesystemComboCB=None, mountComboCB=None):
    fstypeCombo = QtGui.QComboBox(parent)

    if availablefstypes:
        names = availablefstypes
    else:
        names = device_formats.keys()

    if format and format.supported and format.formattable:
        default = format.type
    else:
        default = get_default_filesystem_type()

    index = 0
    i = 0
    for name in names:
        format = device_formats[name]()
        if not format.supported:
            continue

        if ignorefs and name in ignorefs:
            continue

        if format.formattable:
            fstypeCombo.addItem(name)
            if default == name:
                index = i
            i += 1

    fstypeCombo.setCurrentIndex(index)

    if filesystemComboCB and mountCombo:
        QObject.connect(fstypeCombo, SIGNAL("currentIndexChanged(int)"), filesystemComboCB)

    if mountCombo and mountComboCB:
        QObject.connect(mountCombo, SIGNAL("currentIndexChanged(int)"), mountComboCB)

    return fstypeCombo