Skip to content

Commit

Permalink
feat: cancel clock event when kivy app stops
Browse files Browse the repository at this point in the history
  • Loading branch information
sassanh committed Dec 19, 2023
1 parent 7152be2 commit f531d4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit f531d4b

Please sign in to comment.