By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 __init__.py

View raw Download
text/plain • 1.02 kiB
Python script, ASCII text executable
        
            
1
"""
2
Label applet for the Panorama panel.
3
Copyright 2025, roundabout-host.com <vlad@roundabout-host.com>
4
5
The main purpose of this file is a demo, as such, this file,
6
and no other files unless otherwise stated, is subject to the
7
following licence notice:
8
9
Usage of the works is permitted provided that this instrument is
10
retained with the works, so that any entity that uses the works is
11
notified of this instrument.
12
13
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
14
"""
15
16
import panorama_panel
17
18
import gi
19
gi.require_version("Gtk", "4.0")
20
21
from gi.repository import Gtk
22
23
24
class LabelApplet(panorama_panel.Applet):
25
name = "Label"
26
description = "Show a text"
27
28
def __init__(self, orientation=Gtk.Orientation.HORIZONTAL, config=None):
29
super().__init__(orientation=orientation, config=config)
30
if config is None:
31
config = {}
32
self.label = Gtk.Label()
33
self.label.set_text(config.get("text", "Label"))
34
self.append(self.label)
35
36
def get_config(self):
37
return {"text": self.label.get_text()}
38