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 RESPONSIBILITY + to 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'S + RESPONSIBILITY 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":
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())
I find this part weird. Basically how it looks to me is like there's a chance for the continue button to be clickable, but if you click it then you cannot continue. We're currently controlling the sensitivity of the continue button so it's only clickable if you are allowed to continue. I don't really like tricking the user like this.
- Chris
On Mon, 2013-06-17 at 15:18 -0400, Chris Lumens wrote:
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())
I find this part weird. Basically how it looks to me is like there's a chance for the continue button to be clickable, but if you click it then you cannot continue. We're currently controlling the sensitivity of the continue button so it's only clickable if you are allowed to continue. I don't really like tricking the user like this.
Well, the continue button is not sensitive when some mandatory spokes are not finished. But to warn user that something might be wrong and require confirmation, we use that 'double-click' policy. So in case of the Initial Setup if no user is created, the spokes are completed, but we want to warn the user that no user account was created. One way is to popup a dialog, the other way is to require them click once more on the continue button. Shall I go the "dialog way" instead? I cannot make the continue button insensitive, because continuing with no user created is a valid use case.
On Tue, 2013-06-18 at 10:13 +0200, Vratislav Podzimek wrote:
On Mon, 2013-06-17 at 15:18 -0400, Chris Lumens wrote:
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())
I find this part weird. Basically how it looks to me is like there's a chance for the continue button to be clickable, but if you click it then you cannot continue. We're currently controlling the sensitivity of the continue button so it's only clickable if you are allowed to continue. I don't really like tricking the user like this.
Well, the continue button is not sensitive when some mandatory spokes are not finished. But to warn user that something might be wrong and require confirmation, we use that 'double-click' policy. So in case of the Initial Setup if no user is created, the spokes are completed, but we want to warn the user that no user account was created. One way is to popup a dialog, the other way is to require them click once more on the continue button. Shall I go the "dialog way" instead? I cannot make the continue button insensitive, because continuing with no user created is a valid use case.
Any ideas on this? The bug [1] related to this patch is a freeze exception and I'd like to resolve it.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=965797
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 RESPONSIBILITY
to 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'S
RESPONSIBILITY 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":
anaconda-patches@lists.fedorahosted.org