Skip to content

Commit

Permalink
fix: make it compatible with kivy 3
Browse files Browse the repository at this point in the history
  • Loading branch information
sassanh committed Aug 13, 2024
1 parent 5420238 commit 61ad609
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 34 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.9.6

- fix: make it compatible with kivy 3

## Version 0.9.5

- refactor: set minimum version of `kivy` to `2.1.0` (used to be `2.3.0`)
Expand Down
15 changes: 9 additions & 6 deletions headless_kivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,26 +253,29 @@ def render_on_display(self: HeadlessWidget, *_: object) -> None:
except Empty:
last_thread = None

data = data.reshape(self.height, self.width, -1)
height = int(self.height)
width = int(self.width)

data = data.reshape(height, width, -1)
data = apply_tranformations(data)

if config.rotation() % 2 == 0:
HeadlessWidget.raw_data[
self.y : self.y + self.height,
self.x : self.x + self.width,
self.y : self.y + height,
self.x : self.x + width,
:,
] = data
else:
HeadlessWidget.raw_data[
self.x : self.x + self.width,
self.y : self.y + self.height,
self.x : self.x + width,
self.y : self.y + height,
:,
] = data

thread = Thread(
target=config.callback(),
kwargs={
'rectangle': (self.x, self.y, self.width, self.height),
'rectangle': (self.x, self.y, width, height),
'data': data,
'data_hash': data_hash,
'last_render_thread': last_thread,
Expand Down
55 changes: 28 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "headless-kivy"
version = "0.9.5"
version = "0.9.6"
description = "Headless renderer for Kivy framework"
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -21,6 +21,7 @@ pypng = { version = "^0.20220715.0", optional = true }
python-strtobool = "^1.0.0"

[tool.poetry.extras]
default = []
test = ['pypng']

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 61ad609

Please sign in to comment.