From d1dfa788dbea85f2b4b396f343b5ff30ade67ecb Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Wed, 21 Oct 2026 13:39:20 -0400 Subject: [PATCH] Improved UI for notifications and billing feedback. Invoices now show connecting on repeat. And popups can be enabled by core push notification. --- gui/v2/actions/menu_coordinator.py | 2 +- gui/v2/actions/ticket_actions.py | 5 +++++ gui/v2/ui/pages/Page.py | 6 +++++- gui/v2/ui/pages/menu_page.py | 1 + gui/v2/ui/pages/payments2.py | 10 ++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gui/v2/actions/menu_coordinator.py b/gui/v2/actions/menu_coordinator.py index ffd2ece..414f76c 100644 --- a/gui/v2/actions/menu_coordinator.py +++ b/gui/v2/actions/menu_coordinator.py @@ -50,7 +50,7 @@ def dispatch_individual(profile_id: int, ui_caller: Callable) -> Result: else: error_msg = "There's an error in the dispatch_individual function" logger.error(f"This shouldn't be going off. {error_msg}") - return Result(valid=False, error_type=ResultError.NAVIGATE_TO, navigate_to="home", message=error_msg) + return Result(valid=False, error_type=ResultError.NAVIGATE_TO, navigate_to="menu", message=error_msg) else: # Starting fresh. Pick a billing type: return navigate_to_new_sub_page() diff --git a/gui/v2/actions/ticket_actions.py b/gui/v2/actions/ticket_actions.py index 80c70a8..fa7254e 100644 --- a/gui/v2/actions/ticket_actions.py +++ b/gui/v2/actions/ticket_actions.py @@ -13,6 +13,7 @@ from core.services.prepare_tickets.ticket_tracker import get_all_unused_tickets from core.utils.type_checker import type_checker from core.models.Result import Result, ResultError from core.errors.logger import logger +from core.observers.Notifications import Notifications, EventType # gui from gui.v2.infrastructure.action_registry import register_action @@ -80,6 +81,8 @@ def dispatch_ticketing(profile_id: int, passed_ui_caller: Callable) -> Result: def start_ticket(ui_caller: Callable) -> Result: logger.info("started ticketing billing state") + notification = "Started Ticket Billing" + Notifications.emit(EventType.STATUS_UPDATE, notification) return take_action( action=start_new_payment_cycle, category=PaymentCategory.TICKET, @@ -148,6 +151,8 @@ class TicketUser(): def begin_thread(self): """Step 1, begin a background thread with use""" + notification = "Using Ticket.." + Notifications.emit(EventType.STATUS_UPDATE, notification) take_action( action=use_ticket, ui_caller=self.apply_code, diff --git a/gui/v2/ui/pages/Page.py b/gui/v2/ui/pages/Page.py index 367205e..60eba85 100755 --- a/gui/v2/ui/pages/Page.py +++ b/gui/v2/ui/pages/Page.py @@ -1,5 +1,9 @@ from gui.v2.ui.popups.error_popup import ErrorPopup +from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool +mainthread = ThreadSafetyTool() + + import os from typing import Any from PyQt6.QtWidgets import QWidget, QLabel, QPushButton @@ -110,7 +114,7 @@ class Page(QWidget): pass button.clicked.connect(handler) - + @mainthread def show_a_popup(self, message: str, title: str = "Error"): """Display a popup with an error""" error_popup = ErrorPopup( diff --git a/gui/v2/ui/pages/menu_page.py b/gui/v2/ui/pages/menu_page.py index 40916f7..dce8729 100755 --- a/gui/v2/ui/pages/menu_page.py +++ b/gui/v2/ui/pages/menu_page.py @@ -825,6 +825,7 @@ class MenuPage(Page): Notifications.subscribe(EventType.SYSTEM_ENABLE, self.turn_on_system_visuals) Notifications.subscribe(EventType.SYSTEM_DISABLE, self.turn_off_system_visuals) Notifications.subscribe(EventType.RESUME_ACTIONS, self.trigger_action_button_visuals) + Notifications.subscribe(EventType.SHOW_POPUP, self.show_a_popup) take_action( action=evaluate_state_on_startup, diff --git a/gui/v2/ui/pages/payments2.py b/gui/v2/ui/pages/payments2.py index 2dfb150..c904319 100644 --- a/gui/v2/ui/pages/payments2.py +++ b/gui/v2/ui/pages/payments2.py @@ -176,6 +176,14 @@ class PaymentDetailsPage(Page): main_layout.addLayout(action_bar) self.button_reverse.clicked.connect(self.reverse) + def clear_pre_existing_invoice(self): + text = "connecting.." + self.fields["billing_code"].setText(text) + self.fields["duration"].setText(text) + self.fields["amount"].setText(text) + self.fields["address"].setText(text) + self.fields["currency"].setText(text) + def begin_invoice(self): """ "Fetches an Invoice from GUI's actions modules""" self.update_status.update_status("Getting Invoice...") @@ -193,6 +201,8 @@ class PaymentDetailsPage(Page): self.custom_window.navigator.navigate("currency_selection") return # error is already displayed in subfunction. + self.clear_pre_existing_invoice() + # launches background thread tasks: error_msg = gui_starts_invoice( invoice_ui_caller=self.receive_invoice,