Merge pull request #187 from dadav/feature/show_peer_in_preview

Add --show-peer to preview.py
This commit is contained in:
evilsocket 2019-10-06 21:23:25 +02:00 committed by GitHub
commit 86f7af450a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ sys.path.insert(0,
os.path.join(os.path.dirname(os.path.realpath(__file__)),
'../'))
import pwnagotchi.ui.faces as faces
from pwnagotchi.ui.display import Display, VideoHandler
from PIL import Image
@ -33,10 +34,26 @@ class CustomDisplay(Display):
class DummyPeer:
def __init__(self):
self.rssi = -50
@staticmethod
def name():
return "beta"
@staticmethod
def pwnd_run():
return 50
@staticmethod
def pwnd_total():
return 100
@staticmethod
def face():
return faces.FRIEND
def append_images(images, horizontal=True, xmargin=0, ymargin=0):
w, h = zip(*(i.size for i in images))
@ -71,8 +88,9 @@ def main():
parser.add_argument('--lang', help="Language to use",
default="en")
parser.add_argument('--output', help="Path to output image (PNG)", default="preview.png")
parser.add_argument('--xmargin', type=int, default=5)
parser.add_argument('--ymargin', type=int, default=5)
parser.add_argument('--show-peer', dest="showpeer", help="This options will show a dummy peer", action="store_true")
parser.add_argument('--xmargin', help="Add X-Margin", type=int, default=5)
parser.add_argument('--ymargin', help="Add Y-Margin", type=int, default=5)
args = parser.parse_args()
config_template = '''
@ -103,7 +121,8 @@ def main():
for display in list_of_displays:
emotions = list()
# Starting
if args.showpeer:
display.set_closest_peer(DummyPeer())
display.on_starting()
display.update()
emotions.append(display.get_image())