diff --git a/notiframe/Notiframe.py b/notiframe/Notiframe.py index 9032030..209f326 100644 --- a/notiframe/Notiframe.py +++ b/notiframe/Notiframe.py @@ -3,6 +3,7 @@ from collections import namedtuple import uuid import os import toml +from PIL import Image mydir = os.path.dirname(os.path.abspath(__file__)) @@ -51,6 +52,19 @@ class Manager(): preserved_data = [device.save() for device in self.devices] with open(path, "w+") as config_file: config_file.write(toml.dumps({'devices': preserved_data})) + + def render(self): + """ + Render a canvas image from the present data + """ + pass + + def pull_latest(self): + """ + Pull the latest network data requested by each widget + """ + pass + class Device(): @@ -100,6 +114,15 @@ class Device(): Adds a new widget to the device's widget list """ self.widgets.append(widget) + + def remove_widget(self, widget_id): + """ + Removes a widget from the device's widget list + """ + for widg in self.widgets: + if widg.widget_id == widget_id: + self.widgets.remove(widg) + break class Widget(): """ @@ -165,10 +188,25 @@ class BasicTextWidget(Widget): return_state['w_type'] = 'BasicTextWidget' return return_state - def __init__(self, position, dimensions, widget_id, text): + def __init__(self, position, dimensions, widget_id, text, font_size, font): super().__init__(position, dimensions, widget_id) self.text = text + self.font_size = font_size + self.font = None + + def get_image(self): + """ + Returns a widget image via the cache or render method. For now just returns example black image + """ + img = Image.new('1', (self.dimensions[0], self.dimensions[1]), 0) #255 black + return img + + def render(self): + """ + Render an image of the widget from the present data + """ + pass # Global Functions #