Skip to content

state_finish_validate return None does not work #643

@adrienhenry

Description

@adrienhenry

Describe the bug
I tried to create a plugin with a custom state. It seems quite hard to had a new custom state (I am happy to learn about such a project).

Instead I tried to create a hack of the finish state but the booth moves to the wait automatically.

Here is a small code to reproduce:

import time
import pygame
import pibooth
from pibooth import pictures, fonts

__version__ = "0.0.2"

@pibooth.hookimpl
def state_finish_enter(app, win):
    win_rect = win.surface.get_rect()
    message = "Hello world"
    font = pygame.font.Font(None, 80)  # Adjust font and size as needed
    text_surface = font.render(message, True, win.text_color)
    win.surface.fill(win.bg_color)
    win.surface.blit(text_surface, text_surface.get_rect(center=win_rect.center).topleft)
    pygame.display.update()
    pygame.event.pump()

@pibooth.hookimpl
def state_finish_validate(cfg, app, win, events):
    return None

The above plugin should remain stuck in the finish state, but it doesn't. It displays "hello world" for about 1sec and moves back to the wait state.

Is this an expected behavior?

Thank you for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions