Skip to content

Commit 7b8802a

Browse files
committed
Refactor; memory bug in library not present anymore
1 parent 584cc0a commit 7b8802a

21 files changed

+298
-336
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
config.yaml
2+
__pycache__
3+
pics/

01_day.py

-26
This file was deleted.

02_day_of_week.py

-29
This file was deleted.

03_month_year.py

-24
This file was deleted.

04_web_calendar.py

-134
This file was deleted.

05_icon.py

-45
This file was deleted.

06_weather.py

-66
This file was deleted.

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
FONTCONFIG_FILE = fontsdotconf;
2525
};
2626
buildPhase = "true";
27-
installPhase = "mkdir -p $out/app; install -t $out/app *.py";
27+
installPhase = "mkdir -p $out/app; install -t $out/app src/**/*.py; ";
2828
buildInputs = [
2929
(pkgs.python3.withPackages(ppkgs: [
3030
ppkgs.recurring-ical-events

main.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from PIL import Image, ImageDraw
2+
import locale, yaml
3+
from src.drawerlist import drawers
4+
5+
locale.setlocale(locale.LC_ALL, "")
6+
7+
def main():
8+
black_img = Image.new("1", (640, 384), 0xFF)
9+
red_img = Image.new("1", (640, 384), 0xFF)
10+
11+
black_draw = ImageDraw.Draw(black_img)
12+
red_draw = ImageDraw.Draw(red_img)
13+
14+
config = yaml.load(open('config.yaml'), yaml.Loader)
15+
16+
for drawer in drawers:
17+
drawer().draw(red_draw, black_draw, config)
18+
19+
# Save to file
20+
with open("pics/black.bmp", "wb") as f:
21+
black_img.save(f, "BMP")
22+
with open("pics/red.bmp", "wb") as f:
23+
red_img.save(f, "BMP")
24+
25+
if __name__ == "__main__":
26+
main()

mkpic.sh

-5
This file was deleted.

src/__init__.py

Whitespace-only changes.

src/drawer.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Drawer:
2+
factor = 1
3+
def __init__(self) -> None:
4+
pass
5+
def draw(self, red_draw, black_draw, config):
6+
pass
7+
def f(self, i):
8+
return int(self.factor * i)

0 commit comments

Comments
 (0)