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

 panorama_panel.py

View raw Download
text/x-script.python • 1.17 kiB
Python script, ASCII text executable
        
            
1
import gi
2
gi.require_version("Gtk", "4.0")
3
4
from gi.repository import Gtk
5
6
7
class Applet(Gtk.Box):
8
name = "Generic applet"
9
description = ""
10
11
def __init__(self, orientation=Gtk.Orientation.HORIZONTAL, config=None):
12
super().__init__(orientation=orientation)
13
if orientation == Gtk.Orientation.VERTICAL:
14
self.set_hexpand(True)
15
self.set_vexpand(False)
16
elif orientation == Gtk.Orientation.HORIZONTAL:
17
self.set_vexpand(True)
18
self.set_hexpand(False)
19
20
def get_config(self):
21
return {}
22
23
def set_panel_position(self, position: Gtk.PositionType):
24
return
25
26
27
def get_panel_position(applet: Applet) -> Gtk.PositionType:
28
return applet.get_root().position
29
30
31
OPPOSITE_POSITION = {
32
Gtk.PositionType.TOP: Gtk.PositionType.BOTTOM,
33
Gtk.PositionType.BOTTOM: Gtk.PositionType.TOP,
34
Gtk.PositionType.LEFT: Gtk.PositionType.RIGHT,
35
Gtk.PositionType.RIGHT: Gtk.PositionType.LEFT,
36
}
37
38
POSITION_TO_ARROW = {
39
Gtk.PositionType.TOP: Gtk.ArrowType.UP,
40
Gtk.PositionType.BOTTOM: Gtk.ArrowType.DOWN,
41
Gtk.PositionType.LEFT: Gtk.ArrowType.LEFT,
42
Gtk.PositionType.RIGHT: Gtk.ArrowType.RIGHT,
43
}
44