--- iw/partition_ui_helpers_gui.py | 98 +++++++++++++++++++++++----------------- 1 files changed, 57 insertions(+), 41 deletions(-) diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py index 0b45e5f..66234ad 100644 --- a/iw/partition_ui_helpers_gui.py +++ b/iw/partition_ui_helpers_gui.py @@ -309,97 +309,95 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo, resizesb - spinbutton with resize target """ rc = {} + formatcb = None # File system type checkbox and combo. + fstypeCombo = None # formatcb is the checkbox for "Format as" + #lukscb # LUKS checkbox + migratecb = None # migrate check box and combo + migfstypeCombo = None + resizecb = None # resize ceckbox and spin button. + resizesb = None if luksdev: origfs = luksdev.format else: origfs = origrequest.format + # this gets added to the table a bit later on + lukscb = gtk.CheckButton(_("_Encrypt")) + + # Formatable stuff if origfs.formattable: + # gtk initializers formatcb = gtk.CheckButton(label=_("_Format as:")) - maintable.attach(formatcb, 0, 1, row, row + 1) formatcb.set_active(origfs.formattable and not origfs.exists) - rc["formatcb"] = formatcb - fstypeCombo = createFSTypeMenu(origfs, fstypechangeCB, mountCombo, ignorefs=ignorefs) fstypeCombo.set_sensitive(formatcb.get_active()) - maintable.attach(fstypeCombo, 1, 2, row, row + 1) - row += 1 - rc["fstypeCombo"] = fstypeCombo - else: - formatcb = None - fstypeCombo = None - - if not formatcb.get_active() and not origfs.migrate: - mountCombo.set_data("prevmountable", origfs.mountable) + if not formatcb.get_active() and not origfs.migrate: + mountCombo.set_data("prevmountable", origfs.mountable) - # this gets added to the table a bit later on - lukscb = gtk.CheckButton(_("_Encrypt")) + # Updates the return value + rc["formatcb"] = formatcb + rc["fstypeCombo"] = fstypeCombo + # Migratable stuff if origfs.migratable: + # gtk initializers migratecb = gtk.CheckButton(label=_("Mi_grate filesystem to:")) if formatcb is not None: migratecb.set_active(origfs.migrate and (not formatcb.get_active())) else: migratecb.set_active(origfs.migrate) - migtypes = [origfs.migrationTarget] - - maintable.attach(migratecb, 0, 1, row, row + 1) - migfstypeCombo = createFSTypeMenu(origfs, - None, None, - availablefstypes = migtypes) + migfstypeCombo = createFSTypeMenu(origfs, None, None, + availablefstypes = [origfs.migrationTarget]) migfstypeCombo.set_sensitive(migratecb.get_active()) - maintable.attach(migfstypeCombo, 1, 2, row, row + 1) - row = row + 1 - rc["migratecb"] = migratecb - rc["migfstypeCombo"] = migfstypeCombo migratecb.connect("toggled", formatMigrateOptionCB, (migfstypeCombo, mountCombo, origfs, None, fstypeCombo, formatcb, FLAG_MIGRATE)) - else: - migratecb = None - migfstypeCombo = None + + + # Update the return value + rc["migratecb"] = migratecb + rc["migfstypeCombo"] = migfstypeCombo if formatcb: formatcb.connect("toggled", formatMigrateOptionCB, (fstypeCombo, mountCombo, origfs, lukscb, migfstypeCombo, migratecb, FLAG_FORMAT)) - + # Resize stuff. if origrequest.resizable: resizecb = gtk.CheckButton(label=_("_Resize")) resizecb.set_active(origfs.resizable and \ (origfs.currentSize != origfs.targetSize) and \ (origfs.currentSize != 0)) - rc["resizecb"] = resizecb - maintable.attach(resizecb, 0, 1, row, row + 1) if origrequest.targetSize is not None: value = origrequest.targetSize else: value = origrequest.size - reqlower = origrequest.minSize - requpper = origrequest.maxSize if origfs.exists: - lower = reqlower + lower = origrequest.minSize else: lower = 1 - adj = gtk.Adjustment(value = value, lower = lower, - upper = requpper, step_incr = 1) + adj = gtk.Adjustment(value=value, lower=lower, upper=origrequest.maxSize, + step_incr = 1) resizesb = gtk.SpinButton(adj, digits = 0) resizesb.set_property('numeric', True) - resizesb.set_data("requpper", requpper) - resizesb.set_data("reqlower", reqlower) - rc["resizesb"] = resizesb - maintable.attach(resizesb, 1, 2, row, row + 1) + resizesb.set_data("requpper", origrequest.maxSize) + resizesb.set_data("reqlower", origrequest.minSize) resizecb.connect('toggled', resizeOptionCB, resizesb) resizeOptionCB(resizecb, resizesb) - row = row + 1 - formatcb.connect("toggled", formatOptionResizeCB, (resizesb, origfs)) + if formatcb is not None: + formatcb.connect("toggled", formatOptionResizeCB, (resizesb, origfs)) + + # Update return value. + rc["resizecb"] = resizecb + rc["resizesb"] = resizesb + # LUKS stuff if luksdev: lukscb.set_active(1) lukscb.set_data("encrypted", 1) @@ -409,8 +407,26 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo, lukscb.set_sensitive(formatcb.get_active()) lukscb.set_data("formatstate", formatcb.get_active()) rc["lukscb"] = lukscb + + # Here starts the gtk crap. + if formatcb is not None and fstypeCombo is not None: + maintable.attach(formatcb, 0, 1, row, row + 1) + maintable.attach(fstypeCombo, 1, 2, row, row + 1) + row += 1 + + if migratecb is not None and migfstypeCombo is not None: + maintable.attach(migratecb, 0, 1, row, row + 1) + maintable.attach(migfstypeCombo, 1, 2, row, row + 1) + row += 1 + + if resizecb is not None and resizesb is not None: + maintable.attach(resizecb, 0, 1, row, row + 1) + maintable.attach(resizesb, 1, 2, row, row + 1) + row += 1 + maintable.attach(lukscb, 0, 2, row, row + 1) row = row + 1 + # Here ends the gtk crap. return (row, rc) -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list