import panorama_panel

import gi
gi.require_version("Gtk", "4.0")

from gi.repository import Gtk


class LabelApplet(panorama_panel.Applet):
    name = "Label"
    description = "Show a text"

    def __init__(self, orientation=Gtk.Orientation.HORIZONTAL, config=None):
        super().__init__(orientation=orientation, config=config)
        if config is None:
            config = {}
        self.label = Gtk.Label()
        self.label.set_text(config.get("text", "Label"))
        self.append(self.label)

    def get_config(self):
        return {"text": self.label.get_text()}
