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,11 +97,12 @@ class ThreadPlumbing:
if self.ui_caller: if self.ui_caller:
self.ui_caller(result) self.ui_caller(result)
# Show popup and wait for user choice # do we need to decide on an action?
choice = bool(result.function_choice) 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( popup = self.error_implementation(
choice=bool(result.function_choice), choice=bool(result.function_choice),
title=f"Error: {result.error_type.value}", title=f"Error: {result.error_type.value}",
@ -113,6 +114,12 @@ class ThreadPlumbing:
# framework neutral show method # framework neutral show method
popup.show() popup.show()
# otherwise return it as is:
else:
if self.ui_caller:
self.ui_caller(passed_result)
def _on_popup_answer(self, user_choice: bool, passed_result: Result): def _on_popup_answer(self, user_choice: bool, passed_result: Result):
"""User responded to popup""" """User responded to popup"""
if user_choice and passed_result.function_choice: if user_choice and passed_result.function_choice: