[master 7/8] Run set_status unconditionally from update_check_status

dashea installerbot-noreply at redhat.com
Wed Jun 17 18:07:17 UTC 2015


From: David Shea <dshea at redhat.com>

Having set_status called for every call of update_check_status makes
things work a bit nicer in a world where there may be a delay between an
update_check_status call and the status actually updating.

The only thing that really cared about avoiding set_status calls for
repeated statuses was the spoke checker, so track whether the status is
changing inside the spoke checker.
---
 pyanaconda/ui/gui/helpers.py | 15 +++++++++++++--
 pyanaconda/ui/helpers.py     |  8 ++------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/ui/gui/helpers.py b/pyanaconda/ui/gui/helpers.py
index 37f042a..2c45a80 100644
--- a/pyanaconda/ui/gui/helpers.py
+++ b/pyanaconda/ui/gui/helpers.py
@@ -110,14 +110,25 @@ class GUISpokeInputCheckHandler(GUIInputCheckHandler, metaclass=ABCMeta):
        prevent the user from exiting a spoke with bad input.
     """
 
+    def __init__(self):
+        GUIInputCheckHandler.__init__(self)
+
+        # Store the previous status to avoid setting the info bar to the same
+        # message multiple times
+        self._prev_status = None
+
     def set_status(self, inputcheck):
         """Update the warning with the input validation error from the first
            error message.
         """
         failed_check = next(self.failed_checks_with_message, None)
 
-        self.clear_info()
-        if failed_check:
+        if not failed_check:
+            self.clear_info()
+            self._prev_status = None
+        elif failed_check.check_status != self._prev_status:
+            self._prev_status = failed_check.check_status
+            self.clear_info()
             self.set_warning(failed_check.check_status)
 
     # Implemented by GUIObject
diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py
index 0730afb..724834f 100644
--- a/pyanaconda/ui/helpers.py
+++ b/pyanaconda/ui/helpers.py
@@ -243,12 +243,8 @@ def update_check_status(self):
         if not self.enabled:
             return
 
-        new_check_status = self._run_check(self)
-        check_status_changed = (self.check_status != new_check_status)
-        self._check_status = new_check_status
-
-        if check_status_changed:
-            self._parent.set_status(self)
+        self._check_status = self._run_check(self)
+        self._parent.set_status(self)
 
     @property
     def enabled(self):


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/7777689c2b20f70a3c3a9a229f868d5360ef790a


More information about the anaconda-patches mailing list