diff --git a/bin/Config.py b/bin/Config.py index 0f2b15f..37f6ba1 100755 --- a/bin/Config.py +++ b/bin/Config.py @@ -42,6 +42,7 @@ class Config: 'compact': 'compact', 'supervizor_token': 'supervizor_token', 'screen_size': 'screen_size' + 'icon_stats': 'icon_stats' } logger = logging.getLogger('Config') @@ -122,9 +123,10 @@ def _init_display(self): show_hint = self.get_option_value('show_hint') compact = self.get_option_value('compact') size = self.get_option_value('screen_size') + icon_stats = self.get_option_value('icon_stats') self.display = Display(busnum=busnum, screenshot=screenshot, - rotate=rotate, size = size, show_icons=show_icons, + rotate=rotate, size = size, icon_stats=icon_stats, show_icons=show_icons, show_hint=show_hint, compact=compact) except Exception as e: diff --git a/bin/Screens.py b/bin/Screens.py index 7bf29fd..dca9fa7 100755 --- a/bin/Screens.py +++ b/bin/Screens.py @@ -16,7 +16,7 @@ class Display: SCREENSHOT_PATH = "./img/examples/" def __init__(self, busnum = None, screenshot = False, rotate = False, config = None, show_icons = True, - compact = False, show_hint = False, size = '32'): + compact = False, show_hint = False, size = '32', icon_stats='text'): self.logger = logging.getLogger('Display') if not isinstance(busnum, int): @@ -33,6 +33,7 @@ def __init__(self, busnum = None, screenshot = False, rotate = False, config = N self.compact = compact self.show_icons = show_icons self.show_hint = show_hint + self.icon_stats = icon_stats self.hint_right = True if self.show_icons and self.show_hint: @@ -533,12 +534,24 @@ def render(self): temp = self.get_temp() mem = Utils.shell_cmd("free -m | awk 'NR==2{printf \"Mem: %s/%sMB %.2f%%\", $3,$2,$3*100/$2 }'") storage = Utils.shell_cmd("df -h | awk '$NF==\"/\"{printf \"Disk: %d/%dGB %s\", $3,$2,$5}'") - - self.display.draw.text((0, 0), "IP: " + ipv4, font=self.font(16), fill=255) - self.display.draw.text((0, 16), "CPU: " + str(cpu) + "LA", font=self.font(16), fill=255) - self.display.draw.text((80, 16), temp, font=self.font(16), fill=255) - self.display.draw.text((0, 32), mem, font=self.font(16), fill=255) - self.display.draw.text((0, 48), storage, font=self.font(16), fill=255) + + if(self.icon_stats == 'text'): + self.display.draw.text((0, 0), "IP: " + ipv4, font=self.font(16), fill=255)Add commentMore actions + self.display.draw.text((0, 16), "CPU: " + str(cpu) + "LA", font=self.font(16), fill=255) + self.display.draw.text((80, 16), temp, font=self.font(16), fill=255) + self.display.draw.text((0, 32), mem, font=self.font(16), fill=255)Add commentMore actions + self.display.draw.text((0, 48), storage, font=self.font(16), fill=255) + else: + self.display.draw.text((x, top + 5), chr(62609), font=icon_font, fill=255) + self.display.draw.text((x + 65, top + 5), chr(62776), font=icon_font, fill=255) + self.display.draw.text((x, top + 25), chr(63426), font=icon_font, fill=255) + self.display.draw.text((x + 65, top + 25), chr(62171), font=icon_font, fill=255) + self.display.draw.text((x, top + 45), chr(61931), font=icon_font, fill=255) + self.display.draw.text((x + 19, top + 5), str(temp, 'utf-8'), font=font, fill=255) + self.display.draw.text((x + 87, top + 5), str(mem, 'utf-8'), font=font, fill=255) + self.display.draw.text((x + 19, top + 25), str(storage, 'utf-8'), font=font, fill=255) + self.display.draw.text((x + 87, top + 25), str(cpu, 'utf-8'), font=font, fill=255) + self.display.draw.text((x + 19, top + 45), str(ipv4, 'utf-8'), font=font, fill=255) self.capture_screenshot() self.display.show()