import json

from lib.helpers import JSONEncoder
from ui.widget import Widget


class Test_Home(Widget):
    def __init__(self, components):
        super().__init__()
        for component in components:
            component.out.connect(self.update)

    def update(self, data):
        self.readout_t.setPlainText(json.dumps(data, indent=4, sort_keys=True, cls=JSONEncoder))
