gui: gray out OK button while adding raid set (#587161).
This has a tricky part: the checkbox toggle callback in our implementation
(WideCheckList.toggled_item) is called *before* the actual toggle
occurs. This has to be considered in the button-enabling code. An
alternative would be to change/extend the toggle callback hook mechanism.
---
iw/raid_dialog_gui.py | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)
+ def allow_ok_button(self, path=None):
+ """
+ Determine if the OK button should be enabled.
+
+ If path is given it points to the row where the toggle state is about to
+ change.
+ """
+ model = self.raidlist.get_model()
+ allow = False
+ iter = model.get_iter_first()
+ toggled_iter = None
+ if path:
+ toggled_iter = model.get_iter(path)
+ while iter:
+ val = model.get_value(iter, 0)
+ if toggled_iter and
+ model.get_value(toggled_iter, 1) ==
+ model.get_value(iter, 1):
+ # this is being toggled, negate the value:
+ if not val:
+ allow = True
+ else:
+ if val:
+ allow = True
+ iter = model.iter_next(iter)
+
+ self.ok_button.set_sensitive(allow)
class RaidCloneDialog:
def createDriveList(self, disks):
--
1.6.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
04-30-2010, 08:10 PM
David Cantrell
gui: gray out OK button while adding raid set (#587161).
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ack with one minor nit below.
On Fri, 30 Apr 2010, Ales Kozumplik wrote:
This has a tricky part: the checkbox toggle callback in our implementation
(WideCheckList.toggled_item) is called *before* the actual toggle
occurs. This has to be considered in the button-enabling code. An
alternative would be to change/extend the toggle callback hook mechanism.
---
iw/raid_dialog_gui.py | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)
+ def allow_ok_button(self, path=None):
+ """
+ Determine if the OK button should be enabled.
+
+ If path is given it points to the row where the toggle state is about to
+ change.
+ """
+ model = self.raidlist.get_model()
+ allow = False
+ iter = model.get_iter_first()
+ toggled_iter = None
+ if path:
+ toggled_iter = model.get_iter(path)
+ while iter:
+ val = model.get_value(iter, 0)
+ if toggled_iter and
+ model.get_value(toggled_iter, 1) ==
+ model.get_value(iter, 1):
+ # this is being toggled, negate the value:
+ if not val:
+ allow = True
+ else:
+ if val:
+ allow = True
+ iter = model.iter_next(iter)
+
+ self.ok_button.set_sensitive(allow)