mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
@ -1,21 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import argparse
|
||||
from http.server import HTTPServer
|
||||
import shutil
|
||||
import logging
|
||||
import yaml
|
||||
|
||||
sys.path.insert(0,
|
||||
os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
'../sdcard/rootfs/root/pwnagotchi/scripts/'))
|
||||
'../pwnagotchi/'))
|
||||
|
||||
from pwnagotchi.ui.display import Display, VideoHandler
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class CustomDisplay(Display):
|
||||
|
||||
def __init__(self, config, state):
|
||||
@ -41,6 +37,7 @@ class DummyPeer:
|
||||
def name():
|
||||
return "beta"
|
||||
|
||||
|
||||
def append_images(images, horizontal=True, xmargin=0, ymargin=0):
|
||||
w, h = zip(*(i.size for i in images))
|
||||
|
||||
@ -65,6 +62,7 @@ def append_images(images, horizontal=True, xmargin=0, ymargin=0):
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="This program emulates\
|
||||
the pwnagotchi display")
|
||||
@ -101,7 +99,6 @@ def main():
|
||||
display = CustomDisplay(config=config, state={'name': f"{display_type}>"})
|
||||
list_of_displays.append(display)
|
||||
|
||||
|
||||
columns = list()
|
||||
|
||||
for display in list_of_displays:
|
||||
@ -162,10 +159,10 @@ def main():
|
||||
# append them all together (vertical)
|
||||
columns.append(append_images(emotions, horizontal=False, xmargin=args.xmargin, ymargin=args.ymargin))
|
||||
|
||||
|
||||
# append columns side by side
|
||||
final_image = append_images(columns, horizontal=True, xmargin=args.xmargin, ymargin=args.ymargin)
|
||||
final_image.save(args.output, 'PNG')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
SystemExit(main())
|
||||
|
Reference in New Issue
Block a user