Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a minimum value for TEXTUAL_FPS (_get_environ_int was extended with new functionality) and set the FPS to 60 if you set the environment value to 0. #5176

Closed
wants to merge 2 commits into from

Conversation

GEOEGII555
Copy link

@GEOEGII555 GEOEGII555 commented Oct 25, 2024

Closes #5165.

This pull request adds a minimum value for TEXTUAL_FPS by updating the _get_environ_int function with 2 new optional keyword parameters, and sets the TEXTUAL_FPS value to 60 if you try setting it to 0 (so as to avoid zero division errors in src/textual/screen.py).

A new constant is introduced: TEXTUAL_FPS_DEFAULT, which, as the name suggests, holds the default value for the FPS in case the environment variable is not set or is set to something that's not an integer.

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

If you don't, Textual will crash in src/textual/screen.py (zero division).
Making it set the delay to 0 when TEXTUAL_FPS is also 0 caused the application to stop updating, and caused huge load on the CPU.
@willmcgugan
Copy link
Collaborator

Thanks. Closing in favor of #5192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Negative values for TEXTUAL_FPS freeze the application.
2 participants