On Mon, 2009-03-30 at 18:18 -1000, David Cantrell wrote: > Add wantFormat, wantMigrate, and wantResize to indicate whether or > not the user actually wants a format (initialize), migrate, or resize > operation to occur for the format. This is mainly for the UI components > because right now we base the UI elements on the properties that > indicate whether or an operation is possible, not if the user wants the > operation done. For example, a format could be resizable, but the user > might not want that. We already have this information in the format classes. I don't like the idea of having multiple sources for any given piece of information as keeping them in sync is extra work, (not to mention error-prone). > --- > storage/formats/__init__.py | 30 ++++++++++++++++++++++++++++++ > 1 files changed, 30 insertions(+), 0 deletions(-) > > diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py > index 9ec0999..60be55e 100644 > --- a/storage/formats/__init__.py > +++ b/storage/formats/__init__.py > @@ -149,6 +149,9 @@ class DeviceFormat(object): > _minSize = 0 # minimum size in MB > _dump = False > _check = False > + _wantFormat = False wantFormat is equivalent to 'not self.exists' > + _wantMigrate = False DeviceFormat already has a 'migrate' property for exactly this purpose. > + _wantResize = False Isn't wantResize equivalent to 'self.currentSize != self.targetSize' ? Surely we already have this information. Dave > > def __init__(self, *args, **kwargs): > """ Create a DeviceFormat instance. > @@ -294,6 +297,15 @@ class DeviceFormat(object): > self.device and > os.path.exists(self.device)) > > + def _getWantFormat(self): > + return self._wantFormat > + > + def _setWantFormat(self, want): > + self._wantFormat = want > + > + wantFormat = property(_getWantFormat, _setWantFormat, > + "Initialize this format?") > + > @property > def formattable(self): > """ Can we create formats of this type? """ > @@ -309,6 +321,15 @@ class DeviceFormat(object): > """ Packages required to manage formats of this type. """ > return self._packages > > + def _getWantResize(self): > + return self._wantResize > + > + def _setWantResize(self, want): > + self._wantResize = want > + > + wantResize = property(_getWantResize, _setWantResize, > + "Resize this format?") > + > @property > def resizable(self): > """ Can formats of this type be resized? """ > @@ -319,6 +340,15 @@ class DeviceFormat(object): > """ Is this format type suitable for a boot partition? """ > return self._bootable > > + def _getWantMigrate(self): > + return self._wantMigrate > + > + def _setWantMigrate(self, want): > + self._wantMigrate = want > + > + wantMigrate = property(_getWantMigrate, _setWantMigrate, > + "Migrate this format?") > + > @property > def migratable(self): > """ Can formats of this type be migrated? """ _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list