ip viewer upon boot

This commit is contained in:
Justin 2023-04-11 18:52:21 +08:00 committed by GitHub
parent d7d853b44a
commit b07a3820b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5125,6 +5125,28 @@ class StockTicker():
return self.stitchImage(image_list)
def ip_viewer(self):
font = ImageFont.load("./fonts/6x10.pil")
image = Image.new('RGB', (128, 32))
hostname = str(os.popen('hostname').read()).strip() + ".local:1024"
ip_add = str(os.popen('hostname -I').read()).replace(" ", "").strip() + ":1024"
mac_add = str(os.popen('cat /sys/class/net/wlan0/address').read()).replace(" ", "").strip()
hostname_img = self.textImage(hostname, font, r = 255, g = 255 , b = 255)
ip_img = self.textImage(ip_add, font, r = 255, g = 255 , b = 255)
mac_img = self.textImage(mac_add, font, r = 255, g = 255 , b = 255)
image.paste(hostname_img, (0,0))
image.paste(ip_img, (0,12))
image.paste(mac_img, (0,23))
stock_ticker.setImage(image)
time.sleep(10)
def displayStocks(self):
self.scrollImageTransition(['final.ppm', 'final.ppm'], offset_x = 0, offset_y = 0)
@ -5302,7 +5324,9 @@ class StockTicker():
time.sleep(2)
self.resetMatrix()
self.ip_viewer()
time.sleep(2)
self.resetMatrix()
def run_intro_screen(self):
dct = {"feature": "Custom Messages", "speed": "Medium", "animation": "Down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic!", "text_colour": "White", "size": "Large", "background_colour": "Black"}, {"name": "get_started", "text": "To get started, connect your device to the \"Fintic Hotspot\" and access \"fintic.local:1024\" on your web browser. You can connect your ticker to Wi-Fi there.", "text_colour": "White", "size": "Small", "background_colour": "Black"}]}