-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from ty-porter/dev
Release v0.12.3
- Loading branch information
Showing
68 changed files
with
392 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: black | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11", "3.12", "3.13"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch | ||
- name: hatch run test:lint_check | ||
run: | | ||
hatch run test:lint_check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: unittest | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11", "3.12", "3.13"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install hatch | ||
- name: hatch run test:run | ||
run: | | ||
hatch run test:run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ __pycache__/ | |
dist | ||
MANIFEST | ||
tmp | ||
emulator_config.json | ||
emulator_config.json | ||
test/result/* | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from RGBMatrixEmulator.adapters.base import BaseAdapter | ||
|
||
from PIL import Image | ||
|
||
import numpy as np | ||
|
||
|
||
class RawAdapter(BaseAdapter): | ||
MAX_FRAMES_STORED = 128 | ||
DEFAULT_MAX_FRAME = -1 # Never halts | ||
|
||
def __init__(self, width, height, options): | ||
super().__init__(width, height, options) | ||
|
||
self._reset() | ||
|
||
def draw_to_screen(self, pixels): | ||
self.frames[self.frame] = pixels | ||
|
||
if self.frame - self.MAX_FRAMES_STORED in self.frames: | ||
del self.frames[self.frame - RawAdapter.MAX_FRAMES_STORED] | ||
|
||
self.frame += 1 | ||
|
||
if self.halt_after > 0 and self.frame >= self.halt_after: | ||
self.halt_fn() | ||
|
||
def load_emulator_window(self): | ||
pass | ||
|
||
def _dump_screenshot(self, path): | ||
image = Image.fromarray(np.array(self._last_frame(), dtype="uint8"), "RGB") | ||
image.save(path) | ||
|
||
def _last_frame(self): | ||
return self.frames[self.frame - 1] | ||
|
||
def _reset(self): | ||
self.frames = {} | ||
self.frame = 0 | ||
|
||
self.halt_after = RawAdapter.DEFAULT_MAX_FRAME | ||
self.halt_fn = lambda: 1 + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env python | ||
|
||
# package version | ||
__version__ = "0.12.2" | ||
__version__ = "0.12.3" | ||
"""Installed version of RGBMatrixEmulator.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import samples.samplebase |
Oops, something went wrong.