Don't show a popup if there's nothing to say

This commit is contained in:
SimplifiedPrivacy 2026-10-17 17:26:53 -04:00
parent f59c39be6e
commit 06e5470c4d

View file

@ -97,21 +97,28 @@ class ThreadPlumbing:
if self.ui_caller:
self.ui_caller(result)
# Show popup and wait for user choice
# do we need to decide on an action?
choice = bool(result.function_choice)
logger.info(f"On the main thread, the choice is {choice}")
# if there's a message or a choice to make:
if result.message or choice:
# Then Show popup and wait for user choice
popup = self.error_implementation(
choice=bool(result.function_choice),
title=f"Error: {result.error_type.value}",
message=result.message,
on_answer=self._on_popup_answer,
passed_result=result,
end_app=False
)
# framework neutral show method
popup.show()
# otherwise return it as is:
else:
if self.ui_caller:
self.ui_caller(passed_result)
popup = self.error_implementation(
choice=bool(result.function_choice),
title=f"Error: {result.error_type.value}",
message=result.message,
on_answer=self._on_popup_answer,
passed_result=result,
end_app=False
)
# framework neutral show method
popup.show()
def _on_popup_answer(self, user_choice: bool, passed_result: Result):
"""User responded to popup"""