From b4d7ea7dbf2b8c6aed3b03854fcdd0d01f579da1 Mon Sep 17 00:00:00 2001
From: dadav <33197631+dadav@users.noreply.github.com>
Date: Sun, 6 Oct 2019 19:59:03 +0200
Subject: [PATCH] Add peer

---
 scripts/preview.py | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/scripts/preview.py b/scripts/preview.py
index 4f69a3d..06be3c6 100755
--- a/scripts/preview.py
+++ b/scripts/preview.py
@@ -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())