"""
Label applet for the Panorama panel.
Copyright 2025, roundabout-host.com <vlad@roundabout-host.com>

The main purpose of this file is a demo, as such, this file,
and no other files unless otherwise stated, is subject to the
following licence notice:

Usage of the works is permitted provided that this instrument is
retained with the works, so that any entity that uses the works is
notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
"""

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()}
