Skip to content

Commit

Permalink
Refactor; memory bug in library not present anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmue committed Nov 3, 2024
1 parent 584cc0a commit 7b8802a
Show file tree
Hide file tree
Showing 21 changed files with 298 additions and 336 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
config.yaml
__pycache__
pics/
26 changes: 0 additions & 26 deletions 01_day.py

This file was deleted.

29 changes: 0 additions & 29 deletions 02_day_of_week.py

This file was deleted.

24 changes: 0 additions & 24 deletions 03_month_year.py

This file was deleted.

134 changes: 0 additions & 134 deletions 04_web_calendar.py

This file was deleted.

45 changes: 0 additions & 45 deletions 05_icon.py

This file was deleted.

66 changes: 0 additions & 66 deletions 06_weather.py

This file was deleted.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
FONTCONFIG_FILE = fontsdotconf;
};
buildPhase = "true";
installPhase = "mkdir -p $out/app; install -t $out/app *.py";
installPhase = "mkdir -p $out/app; install -t $out/app src/**/*.py; ";
buildInputs = [
(pkgs.python3.withPackages(ppkgs: [
ppkgs.recurring-ical-events
Expand Down
26 changes: 26 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from PIL import Image, ImageDraw
import locale, yaml
from src.drawerlist import drawers

locale.setlocale(locale.LC_ALL, "")

def main():
black_img = Image.new("1", (640, 384), 0xFF)
red_img = Image.new("1", (640, 384), 0xFF)

black_draw = ImageDraw.Draw(black_img)
red_draw = ImageDraw.Draw(red_img)

config = yaml.load(open('config.yaml'), yaml.Loader)

for drawer in drawers:
drawer().draw(red_draw, black_draw, config)

# Save to file
with open("pics/black.bmp", "wb") as f:
black_img.save(f, "BMP")
with open("pics/red.bmp", "wb") as f:
red_img.save(f, "BMP")

if __name__ == "__main__":
main()
5 changes: 0 additions & 5 deletions mkpic.sh

This file was deleted.

Empty file added src/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions src/drawer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Drawer:
factor = 1
def __init__(self) -> None:
pass
def draw(self, red_draw, black_draw, config):
pass
def f(self, i):
return int(self.factor * i)
Loading

0 comments on commit 7b8802a

Please sign in to comment.