This looks good except for the hunk in storage/formats/__init__.py. That is intended to match the "name" attr, not the class itself. If you have a format class, just use it -- no need to do any lookups. On Tue, 2009-03-03 at 18:19 -1000, David Cantrell wrote: > Hook up the migrate fs UI components with the new storage backend. > Highlights: > - If user selects Migrate filesystem to, the Format checkbox is > disabled. Same for the reverse, selecting Format disables > the Migrate options. > - Mount point entry box is not disabled for migrate selections. > - Wrap the return value in storage.formats.fs.FS.migratable > in bool(). If the filter() operation returns a list, that's > what we get in the return value rather than True. > - Other minor typo and syntax fixes. > --- > iw/partition_ui_helpers_gui.py | 45 ++++++++++++++++++++++----------------- > storage/formats/__init__.py | 2 +- > storage/formats/fs.py | 11 +++++---- > 3 files changed, 32 insertions(+), 26 deletions(-) > > diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py > index 723367c..4179ab9 100644 > --- a/iw/partition_ui_helpers_gui.py > +++ b/iw/partition_ui_helpers_gui.py > @@ -30,7 +30,7 @@ import iutil > from constants import * > from partIntfHelpers import * > from partedUtils import * > -from storage.formats import device_formats, getFormat, get_default_filesystem_type > +from storage.formats import * > > import gettext > _ = lambda x: gettext.ldgettext("anaconda", x) > @@ -89,17 +89,18 @@ def createMountPointCombo(request, excludeMountPoints=[]): > if request.exists and label and label.startswith("/"): > mntptlist.append(label) > idx = 0 > - > + > for p in defaultMountPoints: > - if p in excludeMountPoints: > - continue > - > - if not p in mntptlist and (p[0] == "/"): > - mntptlist.append(p) > + if p in excludeMountPoints: > + continue > + > + if not p in mntptlist and (p[0] == "/"): > + mntptlist.append(p) > > map(mountCombo.append_text, mntptlist) > > - if request.format.type and request.format.mountable: > + if (request.format.type or request.format.migrate) and \ > + request.format.mountable: > mountpoint = request.format.mountpoint > mountCombo.set_sensitive(1) > if mountpoint: > @@ -248,9 +249,12 @@ def formatOptionResizeCB(widget, resizesb): > if resizesb.get_value_as_int() < lower: > resizesb.set_value(adj.lower) > > -def formatOptionCB(widget, data): > - (combowidget, mntptcombo, ofstype, lukscb) = data > +def formatMigrateOptionCB(widget, data): > + (combowidget, mntptcombo, ofstype, lukscb, othercombo, othercb) = data > combowidget.set_sensitive(widget.get_active()) > + othercb.set_sensitive(not widget.get_active()) > + othercombo.set_sensitive(not widget.get_active()) > + > if lukscb is not None: > lukscb.set_data("formatstate", widget.get_active()) > if not widget.get_active(): > @@ -262,11 +266,11 @@ def formatOptionCB(widget, data): > > # inject event for fstype menu > if widget.get_active(): > - fstype = combowidget.get_active_value() > - setMntPtComboStateFromType(fstype, mntptcombo) > + fstype = combowidget.get_active_value() > + setMntPtComboStateFromType(fstype, mntptcombo) > combowidget.grab_focus() > else: > - setMntPtComboStateFromType(ofstype, mntptcombo) > + setMntPtComboStateFromType(ofstype, mntptcombo) > > def noformatCB(widget, data): > (combowidget, mntptcombo, ofstype) = data > @@ -274,7 +278,7 @@ def noformatCB(widget, data): > > # inject event for fstype menu > if widget.get_active(): > - setMntPtComboStateFromType(ofstype, mntptcombo) > + setMntPtComboStateFromType(ofstype, mntptcombo) > > > """ createPreExistFSOptionSection: given inputs for a preexisting partition, > @@ -314,10 +318,6 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo, > # this gets added to the table a bit later on > lukscb = gtk.CheckButton(_("_Encrypt")) > > - formatcb.connect("toggled", formatOptionCB, > - (fstypeCombo, mountCombo, ofstype, lukscb)) > - > - > if origrequest.format.migratable: > migratecb = gtk.CheckButton(label=_("Mi_grate filesystem to:")) > migratecb.set_active(istruefalse(origrequest.format.migrate)) > @@ -333,12 +333,17 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo, > row = row + 1 > rc["migratecb"] = migratecb > rc["migfstypeCombo"] = migfstypeCombo > - migratecb.connect("toggled", formatOptionCB, > - (migfstypeCombo, mountCombo, ofstype, None)) > + migratecb.connect("toggled", formatMigrateOptionCB, > + (migfstypeCombo, mountCombo, ofstype, None, > + fstypeCombo, formatcb)) > else: > migratecb = None > migfstypeCombo = None > > + formatcb.connect("toggled", formatMigrateOptionCB, > + (fstypeCombo, mountCombo, ofstype, lukscb, > + migfstypeCombo, migratecb)) > + > if origrequest.resizable: > resizecb = gtk.CheckButton(label=_("_Resize")) > resizecb.set_active(origrequest.targetSize != origrequest.currentSize) > diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py > index 8602923..c072f91 100644 > --- a/storage/formats/__init__.py > +++ b/storage/formats/__init__.py > @@ -118,7 +118,7 @@ def get_device_format_class(fmt_type): > fmt = device_formats.get(fmt_type) > if not fmt: > for fmt_class in device_formats.values(): > - if fmt_type == fmt_class.name: > + if fmt_type == fmt_class: > fmt = fmt_class > break > elif fmt_type in fmt_class._udevTypes: > diff --git a/storage/formats/fs.py b/storage/formats/fs.py > index 694b1f4..7c73ff4 100644 > --- a/storage/formats/fs.py > +++ b/storage/formats/fs.py > @@ -599,11 +599,12 @@ class FS(DeviceFormat): > @property > def migratable(self): > """ Can filesystems of this type be migrated? """ > - return (self._migratable and self.migratefsProg and > - filter(lambda d: os.access("%s/%s" % (d, self.migratefsProg), > - os.X_OK), > - os.environ["PATH"].split(":")) and > - self.migrationTarget) > + return bool(self._migratable and self.migratefsProg and > + filter(lambda d: os.access("%s/%s" > + % (d, self.migratefsProg,), > + os.X_OK), > + os.environ["PATH"].split(":")) and > + self.migrationTarget) > > def _setMigrate(self, migrate): > if not migrate: _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list