Skip to content

Commit

Permalink
Show source errors from refresh method
Browse files Browse the repository at this point in the history
Trying to display errors/warnings using gtk_call_once while the spoke is
closed doesn't work. So instead cache them in self._error_msg and
display them when refresh() is called.
  • Loading branch information
bcl committed Jul 16, 2015
1 parent 12d0d1f commit abb70c9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pyanaconda/ui/gui/spokes/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ def __init__(self, *args, **kwargs):
self._currentIsoFile = None
self._ready = False
self._error = False
self._error_msg = ""
self._proxyUrl = ""
self._proxyChange = False
self._cdrom = None
Expand Down Expand Up @@ -496,8 +497,8 @@ def _method_changed(self):
(self.data.method.server, self.data.method.dir) = url.split(":", 2)
except ValueError as e:
log.error("ValueError: %s", e)
gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url"))
self._error = True
self._error_msg = _("Failed to set up installation source; check the repo url")
return

self.data.method.opts = self.builder.get_object("nfsOptsEntry").get_text() or ""
Expand Down Expand Up @@ -688,6 +689,7 @@ def _probing_storage(self):
def _downloading_package_md(self):
# Reset the error state from previous payloads
self._error = False
self._error_msg = ""

hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PACKAGE_MD))

Expand All @@ -702,9 +704,9 @@ def _payload_error(self):
self._error = True
hubQ.send_message(self.__class__.__name__, payloadMgr.error)
if not (hasattr(self.data.method, "proxy") and self.data.method.proxy):
gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url"))
self._error_msg = _("Failed to set up installation source; check the repo url")
else:
gtk_call_once(self.set_warning, _("Failed to set up installation source; check the repo url and proxy settings"))
self._error_msg = _("Failed to set up installation source; check the repo url and proxy settings")
hubQ.send_ready(self.__class__.__name__, False)

def _initialize(self):
Expand Down Expand Up @@ -895,6 +897,9 @@ def refresh(self):

self.clear_info()
self.set_warning(_("You need to configure the network to use a network installation source."))
elif self._error:
self.clear_info()
self.set_error(self._error_msg)

def _setup_no_updates(self):
""" Setup the state of the No Updates checkbox.
Expand Down

0 comments on commit abb70c9

Please sign in to comment.