On Tue, 2013-06-04 at 13:27 -0400, Chris Lumens wrote:
This allows for clearing all editable disks in one button click. It is positioned on the far right of the list of action buttons and schedules a delete action for all disks. Should you later wish to undo this action, the button will also do a preserve all.
This also required moving the shrink slider down.
pyanaconda/ui/gui/spokes/lib/resize.glade | 50 ++++++++++++++++++++----------- pyanaconda/ui/gui/spokes/lib/resize.py | 39 ++++++++++++++++++------ 2 files changed, 63 insertions(+), 26 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py index 30518aa..2df4c59 100644 --- a/pyanaconda/ui/gui/spokes/lib/resize.py +++ b/pyanaconda/ui/gui/spokes/lib/resize.py @@ -317,18 +317,18 @@ class ResizeDialog(GUIObject): return False
def on_preserve_clicked(self, button):
self._actionChanged(PRESERVE)
(model, itr) = self.builder.get_object("diskView-selection").get_selected()
self._actionChanged(itr, PRESERVE)
def on_shrink_clicked(self, button):
self._actionChanged(SHRINK)
(model, itr) = self.builder.get_object("diskView-selection").get_selected()
self._actionChanged(itr, SHRINK)
def on_delete_clicked(self, button):
self._actionChanged(DELETE)
- def _actionChanged(self, newAction):
selection = self.builder.get_object("diskView-selection")
(model, itr) = selection.get_selected()
(model, itr) = self.builder.get_object("diskView-selection").get_selected()
self._actionChanged(itr, DELETE)
I think the "diskView-selection" widget should be pulled once and stored as e.g. "self._viewSelection". If nothing else, in case of changing the widget's ID in the .glade file, it won't require a change in multiple places.
- def _actionChanged(self, itr, newAction): if not itr: return
@@ -340,7 +340,7 @@ class ResizeDialog(GUIObject): # it contains. device = self.storage.devicetree.getDeviceByID(selectedRow[DEVICE_ID_COL]) if device.isDisk and device.partitioned:
partItr = model.iter_children(itr)
partItr = self._diskStore.iter_children(itr) while partItr: self._diskStore[partItr][ACTION_COL] = _(newAction)
@@ -352,7 +352,7 @@ class ResizeDialog(GUIObject): part = self.storage.devicetree.getDeviceByID(self._diskStore[partItr][DEVICE_ID_COL]) self._diskStore[partItr][EDITABLE_COL] = not part.protected
partItr = model.iter_next(partItr)
partItr = self._diskStore.iter_next(partItr) # And then we're keeping a running tally of how much space the user # has selected to reclaim, so reflect that in the UI.
@@ -386,6 +386,27 @@ class ResizeDialog(GUIObject): def on_resize_clicked(self, *args): self._diskStore.foreach(self._scheduleActions, None)
- def on_delete_all_clicked(self, button, *args):
if button.get_label() == _("Delete _all"):
action = DELETE
button.set_label(_("Preserve _all"))
else:
action = PRESERVE
button.set_label(_("Delete _all"))
itr = self._diskStore.get_iter_first()
while itr:
if not self._diskStore[itr][EDITABLE_COL]:
itr = self._diskStore.iter_next(itr)
continue
(ident, ) = self._diskStore.get(itr, DEVICE_ID_COL)
Is there any particular reason for using 'get' instead of [itr][DEVICE_ID_COL]?