Skip to content

Commit

Permalink
Fix inconsistencies in the payload messages.
Browse files Browse the repository at this point in the history
The software and source spokes were updating their messages on different
payload events, resulting in some confusing message mismatches.

On STATE_PACKAGE_MD, the statuses displayed would be:

  | Probing storage...              | Downloading package metadata...  |

Followed by STATE_GROUP_MD, which updated to:

  | Downloading package metadata... | Downloading group metadata...    |

Change the source spoke to set the package metadata on the right state
and update the status on STATE_GROUP_MD to match the software spoke.
Moved all the actual messages out of the spokes and into constants.py.
  • Loading branch information
dashea committed Jun 25, 2015
1 parent 73b3f4b commit f137bc3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
5 changes: 5 additions & 0 deletions pyanaconda/constants.py
Expand Up @@ -180,3 +180,8 @@

# X display number to use
X_DISPLAY_NUMBER = 1

# Payload status messages
PAYLOAD_STATUS_PROBING_STORAGE = N_("Probing storage...")
PAYLOAD_STATUS_PACKAGE_MD = N_("Downloading package metadata...")
PAYLOAD_STATUS_GROUP_MD = N_("Downloading group metadata...")
4 changes: 2 additions & 2 deletions pyanaconda/ui/gui/spokes/software.py
Expand Up @@ -103,10 +103,10 @@ def __init__(self, *args, **kwargs):

# Payload event handlers
def _downloading_package_md(self):
hubQ.send_message(self.__class__.__name__, _("Downloading package metadata..."))
hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PACKAGE_MD))

def _downloading_group_md(self):
hubQ.send_message(self.__class__.__name__, _("Downloading group metadata..."))
hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_GROUP_MD))

def _payload_finished(self):
self.environment = self.data.packages.environment
Expand Down
11 changes: 7 additions & 4 deletions pyanaconda/ui/gui/spokes/source.py
Expand Up @@ -53,7 +53,6 @@
__all__ = ["SourceSpoke"]

BASEREPO_SETUP_MESSAGE = N_("Setting up installation source...")
METADATA_DOWNLOAD_MESSAGE = N_("Downloading package metadata...")

# These need to match the IDs in protocolComboBox and repoProtocolComboBox in source.glade.
PROTOCOL_HTTP = 'http'
Expand Down Expand Up @@ -662,7 +661,8 @@ def initialize(self):
# Register listeners for payload events
payloadMgr.addListener(payloadMgr.STATE_START, self._payload_refresh)
payloadMgr.addListener(payloadMgr.STATE_STORAGE, self._probing_storage)
payloadMgr.addListener(payloadMgr.STATE_GROUP_MD, self._downloading_package_md)
payloadMgr.addListener(payloadMgr.STATE_PACKAGE_MD, self._downloading_package_md)
payloadMgr.addListener(payloadMgr.STATE_GROUP_MD, self._downloading_group_md)
payloadMgr.addListener(payloadMgr.STATE_FINISHED, self._payload_finished)
payloadMgr.addListener(payloadMgr.STATE_ERROR, self._payload_error)

Expand All @@ -679,13 +679,16 @@ def _payload_refresh(self):
time.sleep(1)

def _probing_storage(self):
hubQ.send_message(self.__class__.__name__, _("Probing storage..."))
hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PROBING_STORAGE))

def _downloading_package_md(self):
# Reset the error state from previous payloads
self._error = False

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

def _downloading_group_md(self):
hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_GROUP_MD))

def _payload_finished(self):
hubQ.send_ready("SoftwareSelectionSpoke", False)
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/ui/gui/spokes/storage.py
Expand Up @@ -587,7 +587,7 @@ def _add_disk_overview(self, disk, box):
overview.show_all()

def _initialize(self):
hubQ.send_message(self.__class__.__name__, _("Probing storage..."))
hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PROBING_STORAGE))

threadMgr.wait(constants.THREAD_STORAGE)
threadMgr.wait(constants.THREAD_CUSTOM_STORAGE_INIT)
Expand Down
3 changes: 2 additions & 1 deletion pyanaconda/ui/tui/spokes/source.py
Expand Up @@ -33,6 +33,7 @@
from pyanaconda.constants import THREAD_SOURCE_WATCHER, THREAD_PAYLOAD
from pyanaconda.constants import THREAD_STORAGE_WATCHER
from pyanaconda.constants import THREAD_CHECK_SOFTWARE, ISO_DIR, DRACUT_ISODIR, DRACUT_REPODIR
from pyanaconda.constants import PAYLOAD_STATUS_PROBING_STORAGE
from pyanaconda.constants_text import INPUT_PROCESSED

from pyanaconda.ui.helpers import SourceSwitchHandler
Expand Down Expand Up @@ -363,7 +364,7 @@ def refresh(self, args=None):
# storage refresh is running - just report it
# so that the user can refresh until it is done
# TODO: refresh once the thread is done ?
message = _("Probing storage...")
message = _(PAYLOAD_STATUS_PROBING_STORAGE)
self._window += [TextWidget(message), ""]
return True

Expand Down
3 changes: 2 additions & 1 deletion pyanaconda/ui/tui/spokes/storage.py
Expand Up @@ -38,6 +38,7 @@
from pyanaconda.kickstart import doKickstartStorage, resetCustomStorageData
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER, THREAD_DASDFMT, DEFAULT_AUTOPART_TYPE
from pyanaconda.constants import PAYLOAD_STATUS_PROBING_STORAGE
from pyanaconda.constants_text import INPUT_PROCESSED
from pyanaconda.i18n import _, P_, N_
from pyanaconda.bootloader import BootLoaderError
Expand Down Expand Up @@ -190,7 +191,7 @@ def refresh(self, args=None):

# Join the initialization thread to block on it
# This print is foul. Need a better message display
print(_("Probing storage..."))
print(_(PAYLOAD_STATUS_PROBING_STORAGE))
threadMgr.wait(THREAD_STORAGE_WATCHER)

# synchronize our local data store with the global ksdata
Expand Down

0 comments on commit f137bc3

Please sign in to comment.