Verified Commit a4414838 authored by Jakob Moser's avatar Jakob Moser
Browse files

Beautify payment success screen

parent 035704f7
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
from dataclasses import dataclass
from typing import cast

import pygame
from babel.numbers import format_currency

from poolpay.display.PygameDisplay import PygameDisplay
from poolpay.ui.pygame.colors import white
from poolpay.ui.pygame.resources import fira_sans, fira_sans_large
from poolpay.ui.scenes.PaymentSuccess import PaymentSuccess as PaymentSuccessBase


@@ -15,20 +16,22 @@ class PaymentSuccess(PaymentSuccessBase):
            self.new_balance_cents / 100, "EUR", locale="de_DE"
        )

        # Initialize fonts, and get the default system font (this could be improved)
        pygame.font.init()
        font = pygame.font.SysFont(None, 30)

        # We expect the director's display to be a PyGame display (after all, this is a PyGame scene)
        display = cast(PygameDisplay, self.director.display)

        display.surface.fill((0, 0, 0))
        display.surface.fill((0, 130, 80))

        display.surface.blit(
            fira_sans.render(f"Hallo {self.person_name}!", True, white),
            (180, 70),
        )
        display.surface.blit(
            font.render(
                f"{self.person_name}, du hast erfolgreich bezahlt. Saldo: {new_balance}",
                False,
                (255, 255, 255),
            ),
            (0, 0),
            fira_sans_large.render("Erfolgreich bezahlt", True, white),
            (110, 110),
        )
        display.surface.blit(
            fira_sans.render(f"Neuer Kontostand: {new_balance}", True, white),
            (120, 250),
        )

        display.refresh()