forked from Support/sp-hydra-veil-gui
Improved UI for notifications and billing feedback. Invoices now show connecting on repeat. And popups can be enabled by core push notification.
This commit is contained in:
parent
707935f80f
commit
d1dfa788db
5 changed files with 22 additions and 2 deletions
|
|
@ -50,7 +50,7 @@ def dispatch_individual(profile_id: int, ui_caller: Callable) -> Result:
|
||||||
else:
|
else:
|
||||||
error_msg = "There's an error in the dispatch_individual function"
|
error_msg = "There's an error in the dispatch_individual function"
|
||||||
logger.error(f"This shouldn't be going off. {error_msg}")
|
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:
|
else:
|
||||||
# Starting fresh. Pick a billing type:
|
# Starting fresh. Pick a billing type:
|
||||||
return navigate_to_new_sub_page()
|
return navigate_to_new_sub_page()
|
||||||
|
|
|
||||||
|
|
@ -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.utils.type_checker import type_checker
|
||||||
from core.models.Result import Result, ResultError
|
from core.models.Result import Result, ResultError
|
||||||
from core.errors.logger import logger
|
from core.errors.logger import logger
|
||||||
|
from core.observers.Notifications import Notifications, EventType
|
||||||
|
|
||||||
# gui
|
# gui
|
||||||
from gui.v2.infrastructure.action_registry import register_action
|
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:
|
def start_ticket(ui_caller: Callable) -> Result:
|
||||||
logger.info("started ticketing billing state")
|
logger.info("started ticketing billing state")
|
||||||
|
notification = "Started Ticket Billing"
|
||||||
|
Notifications.emit(EventType.STATUS_UPDATE, notification)
|
||||||
return take_action(
|
return take_action(
|
||||||
action=start_new_payment_cycle,
|
action=start_new_payment_cycle,
|
||||||
category=PaymentCategory.TICKET,
|
category=PaymentCategory.TICKET,
|
||||||
|
|
@ -148,6 +151,8 @@ class TicketUser():
|
||||||
|
|
||||||
def begin_thread(self):
|
def begin_thread(self):
|
||||||
"""Step 1, begin a background thread with use"""
|
"""Step 1, begin a background thread with use"""
|
||||||
|
notification = "Using Ticket.."
|
||||||
|
Notifications.emit(EventType.STATUS_UPDATE, notification)
|
||||||
take_action(
|
take_action(
|
||||||
action=use_ticket,
|
action=use_ticket,
|
||||||
ui_caller=self.apply_code,
|
ui_caller=self.apply_code,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
from gui.v2.ui.popups.error_popup import ErrorPopup
|
from gui.v2.ui.popups.error_popup import ErrorPopup
|
||||||
|
|
||||||
|
from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool
|
||||||
|
mainthread = ThreadSafetyTool()
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from PyQt6.QtWidgets import QWidget, QLabel, QPushButton
|
from PyQt6.QtWidgets import QWidget, QLabel, QPushButton
|
||||||
|
|
@ -110,7 +114,7 @@ class Page(QWidget):
|
||||||
pass
|
pass
|
||||||
button.clicked.connect(handler)
|
button.clicked.connect(handler)
|
||||||
|
|
||||||
|
@mainthread
|
||||||
def show_a_popup(self, message: str, title: str = "Error"):
|
def show_a_popup(self, message: str, title: str = "Error"):
|
||||||
"""Display a popup with an error"""
|
"""Display a popup with an error"""
|
||||||
error_popup = ErrorPopup(
|
error_popup = ErrorPopup(
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,7 @@ class MenuPage(Page):
|
||||||
Notifications.subscribe(EventType.SYSTEM_ENABLE, self.turn_on_system_visuals)
|
Notifications.subscribe(EventType.SYSTEM_ENABLE, self.turn_on_system_visuals)
|
||||||
Notifications.subscribe(EventType.SYSTEM_DISABLE, self.turn_off_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.RESUME_ACTIONS, self.trigger_action_button_visuals)
|
||||||
|
Notifications.subscribe(EventType.SHOW_POPUP, self.show_a_popup)
|
||||||
|
|
||||||
take_action(
|
take_action(
|
||||||
action=evaluate_state_on_startup,
|
action=evaluate_state_on_startup,
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,14 @@ class PaymentDetailsPage(Page):
|
||||||
main_layout.addLayout(action_bar)
|
main_layout.addLayout(action_bar)
|
||||||
self.button_reverse.clicked.connect(self.reverse)
|
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):
|
def begin_invoice(self):
|
||||||
""" "Fetches an Invoice from GUI's actions modules"""
|
""" "Fetches an Invoice from GUI's actions modules"""
|
||||||
self.update_status.update_status("Getting Invoice...")
|
self.update_status.update_status("Getting Invoice...")
|
||||||
|
|
@ -193,6 +201,8 @@ class PaymentDetailsPage(Page):
|
||||||
self.custom_window.navigator.navigate("currency_selection")
|
self.custom_window.navigator.navigate("currency_selection")
|
||||||
return # error is already displayed in subfunction.
|
return # error is already displayed in subfunction.
|
||||||
|
|
||||||
|
self.clear_pre_existing_invoice()
|
||||||
|
|
||||||
# launches background thread tasks:
|
# launches background thread tasks:
|
||||||
error_msg = gui_starts_invoice(
|
error_msg = gui_starts_invoice(
|
||||||
invoice_ui_caller=self.receive_invoice,
|
invoice_ui_caller=self.receive_invoice,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue