Loading poolpay/ui/pygame/scenes/Idle.py +13 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ 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.scenes.Idle import Idle as IdleBase Loading @@ -10,12 +11,20 @@ from poolpay.ui.scenes.Idle import Idle as IdleBase @dataclass(frozen=True) class Idle(IdleBase): def present(self) -> None: # TODO Add actual UI price = format_currency(self.price_cents / 100, "EUR", locale="de_DE") # Initialize fonts, and get the default system font (this could be improved) pygame.font.init() defaultFont = pygame.font.SysFont(None, 30) 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((128, 128, 128)) display.surface.fill((0, 0, 0)) display.surface.blit( defaultFont.render("Hello World!", False, (0, 0, 0)), (0, 0) font.render( f"Poolkarte auflegen, um {price} zu bezahlen", False, (255, 255, 255) ), (0, 0), ) display.refresh() poolpay/ui/pygame/scenes/PaymentSuccess.py 0 → 100644 +34 −0 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.scenes.PaymentSuccess import PaymentSuccess as PaymentSuccessBase @dataclass(frozen=True) class PaymentSuccess(PaymentSuccessBase): def present(self) -> None: new_balance = format_currency( 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.blit( font.render( f"{self.person_name}, du hast erfolgreich bezahlt. Saldo: {new_balance}", False, (255, 255, 255), ), (0, 0), ) display.refresh() Loading
poolpay/ui/pygame/scenes/Idle.py +13 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ 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.scenes.Idle import Idle as IdleBase Loading @@ -10,12 +11,20 @@ from poolpay.ui.scenes.Idle import Idle as IdleBase @dataclass(frozen=True) class Idle(IdleBase): def present(self) -> None: # TODO Add actual UI price = format_currency(self.price_cents / 100, "EUR", locale="de_DE") # Initialize fonts, and get the default system font (this could be improved) pygame.font.init() defaultFont = pygame.font.SysFont(None, 30) 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((128, 128, 128)) display.surface.fill((0, 0, 0)) display.surface.blit( defaultFont.render("Hello World!", False, (0, 0, 0)), (0, 0) font.render( f"Poolkarte auflegen, um {price} zu bezahlen", False, (255, 255, 255) ), (0, 0), ) display.refresh()
poolpay/ui/pygame/scenes/PaymentSuccess.py 0 → 100644 +34 −0 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.scenes.PaymentSuccess import PaymentSuccess as PaymentSuccessBase @dataclass(frozen=True) class PaymentSuccess(PaymentSuccessBase): def present(self) -> None: new_balance = format_currency( 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.blit( font.render( f"{self.person_name}, du hast erfolgreich bezahlt. Saldo: {new_balance}", False, (255, 255, 255), ), (0, 0), ) display.refresh()