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

feat: cancel clock event when kivy app stops #6

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.5.7

- feat: cancel clock event when kivy app stops

## Version 0.5.6

- fix: ignore data hash and render a single frame after resume
Expand Down
5 changes: 4 additions & 1 deletion headless_kivy_pi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import kivy
import numpy as np
from kivy.app import ObjectProperty, Widget
from kivy.app import App, ObjectProperty, Widget
from kivy.clock import Clock
from kivy.config import Config
from kivy.graphics import (
Expand Down Expand Up @@ -305,6 +305,9 @@ def __init__(self: HeadlessWidget, **kwargs: Any) -> None: # noqa: ANN401
True,
)
self.render_on_display_event()
App.get_running_app().bind(
on_stop=lambda _: self.render_on_display_event.cancel(),
)

def add_widget(
self: HeadlessWidget,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "headless-kivy-pi"
version = "0.5.6"
version = "0.5.7"
description = "Headless renderer for Kivy framework on Raspberry Pi"
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand Down