[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 4/5] Make Format and Resize checkboxes mutually exclusive (#589977)



In the Edit Partition dialog, disable Resize if Format is checked and
disable Format if Resize is checked.  Users cannot check both Format and
Resize and have it perform a useful operation.  Technically, it's
possible, but our UI workflow in anaconda does not really allow an easy
way to accomplish this.  For now, prevent users from selecting both
Format and Resize.  If we want to let people shrink a filesystem and
reformat it, we can get creative with that later.
---
 iw/partition_ui_helpers_gui.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 543d82d..d81fe4f 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -231,11 +231,13 @@ def mountptchangeCB(widget, fstypecombo):
     if widget.get_children()[0].get_text() == "/boot":
         fstypecombo.set_active_text(get_default_filesystem_type(boot=True))
 
-def resizeOptionCB(widget, resizesb):
+def resizeOptionCB(widget, data):
+    (formatcb, resizesb) = data
+    formatcb.set_sensitive(not widget.get_active())
     resizesb.set_sensitive(widget.get_active())
 
 def formatOptionResizeCB(widget, data):
-    (resizesb, fmt) = data
+    (resizecb, resizesb, fmt) = data
 
     if widget.get_active():
         lower = 1
@@ -249,6 +251,9 @@ def formatOptionResizeCB(widget, data):
     if resizesb.get_value_as_int() < lower:
         resizesb.set_value(adj.lower)
 
+    resizecb.set_sensitive(not widget.get_active())
+    resizesb.set_sensitive(resizecb.get_active())
+
 def formatMigrateOptionCB(widget, data):
     (sensitive,) = widget.get_properties('sensitive')
     if not sensitive:
@@ -392,12 +397,13 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
         resizesb.set_data("reqlower", reqlower)
         rc["resizesb"] = resizesb
         maintable.attach(resizesb, 1, 2, row, row + 1)
-        resizecb.connect('toggled', resizeOptionCB, resizesb)
-        resizeOptionCB(resizecb, resizesb)
+        resizecb.connect('toggled', resizeOptionCB, (formatcb, resizesb))
+        resizeOptionCB(resizecb, (formatcb, resizesb))
         row = row + 1
 
         if formatcb:
-            formatcb.connect("toggled", formatOptionResizeCB, (resizesb, origfs))
+            formatcb.connect("toggled", formatOptionResizeCB,
+                             (resizecb, resizesb, origfs))
 
     if luksdev:
         lukscb.set_active(1)
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]