Any better any on implementing these checks? Bug #965797 is still not fixed and may become quite and issue.
On Wed, 2013-06-12 at 16:14 +0200, Vratislav Podzimek wrote:
Related: rhbz#965797
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/ui/gui/hubs/__init__.py | 29 +++++++++++++++++++++++++++-- pyanaconda/ui/gui/spokes/__init__.py | 18 ++++++++++++++++-- 2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py index 37daf47..bb473b6 100644 --- a/pyanaconda/ui/gui/hubs/__init__.py +++ b/pyanaconda/ui/gui/hubs/__init__.py @@ -354,11 +354,36 @@ class Hub(GUIObject, common.Hub):
self._update_spoke_id = GLib.timeout_add_seconds(1, self._update_spokes)
- ### SIGNAL HANDLERS
@property
def continue_possible(self):
"""Indicates whether it is possible to continue to the next action (hub,standalone spoke,...). When overridden, IT IS THE HUB'S RESPONSIBILITYto inform user, where the problem is and how to fix it."""return True### SIGNAL HANDLING
def _checked_continue(self, cb):
"""Checks if continue is possible (from the hub's perspective and if yes,runs the callback."""if self.continue_possible:cb()def _register_continue_event_cb(self, cb):
"""Registers the callback for the continue event adding the check."""self.continueButton.connect("clicked", lambda *args: self._checked_continue(cb))def register_event_cb(self, event, cb): if event == "continue" and hasattr(self, "continueButton"):
self.continueButton.connect("clicked", lambda *args: cb())
self._register_continue_event_cb(cb) elif event == "quit" and hasattr(self, "quitButton"): self.quitButton.connect("clicked", lambda *args: cb())diff --git a/pyanaconda/ui/gui/spokes/__init__.py b/pyanaconda/ui/gui/spokes/__init__.py index c1a35b3..bb85e1e 100644 --- a/pyanaconda/ui/gui/spokes/__init__.py +++ b/pyanaconda/ui/gui/spokes/__init__.py @@ -63,9 +63,23 @@ class StandaloneSpoke(Spoke, common.StandaloneSpoke): Spoke.__init__(self, data) common.StandaloneSpoke.__init__(self, data, storage, payload, instclass)
- @property
- def continue_possible(self):
"""Indicates whether it is possible to continue to the next action (hub,standalone spoke,...). When overridden, IT IS THE SPOKES'SRESPONSIBILITY to inform user, where the problem is and how to fix it."""return True- ### SIGNAL HANDLING def _on_continue_clicked(self, cb):
self.apply()cb()
if self.continue_possible:self.apply()cb()def register_event_cb(self, event, cb): if event == "continue":