Skip to content

Commit

Permalink
Show hints when error encountered
Browse files Browse the repository at this point in the history
  • Loading branch information
rocodes committed Feb 3, 2024
1 parent 5b6791c commit 275b38d
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def __init__(self, export, summary):
@pyqtSlot(object)
def on_status_received(self, status: ExportStatus) -> None:
super().on_status_received(status)
self.update_content(status)
should_show_hint = (status in (ExportStatus.NO_DEVICE_DETECTED, ExportStatus.MULTI_DEVICE_DETECTED, ExportStatus.INVALID_DEVICE_DETECTED))
self.update_content(status, should_show_hint)

def validatePage(self) -> bool:
"""
Expand All @@ -274,7 +275,7 @@ def validatePage(self) -> bool:
ExportStatus.NO_DEVICE_DETECTED,
ExportStatus.INVALID_DEVICE_DETECTED,
):
self.update_content(self.status)
self.update_content(self.status, should_show_hint=True)
else:
# Shouldn't reach
# Status may be None here
Expand Down Expand Up @@ -309,13 +310,13 @@ def on_status_received(self, status: ExportStatus) -> None:
self.update_content(status)

def update_content(self, status: ExportStatus, should_show_hint: bool = False):
if self.status == ExportStatus.SUCCESS_EXPORT:
if status == ExportStatus.SUCCESS_EXPORT:
header = _("Export successful")
body = _(
"Remember to be careful when working with files "
"outside of your Workstation machine."
)
elif self.status == ExportStatus.ERROR_EXPORT_CLEANUP:
elif status == ExportStatus.ERROR_EXPORT_CLEANUP:
header = header = _("Export sucessful, but drive was not locked")
body = STATUS_MESSAGES.get(ExportStatus.ERROR_EXPORT_CLEANUP)

Expand Down Expand Up @@ -378,4 +379,5 @@ def _build_layout(self) -> QVBoxLayout:
@pyqtSlot(object)
def on_status_received(self, status: ExportStatus) -> None:
super().on_status_received(status)
self.update_content(status)
should_show_hint = (status in ExportStatus.ERROR_UNLOCK_LUKS, ExportStatus.ERROR_UNLOCK_GENERIC)
self.update_content(status, should_show_hint)

0 comments on commit 275b38d

Please sign in to comment.