roundabout,
created on Tuesday, 22 July 2025, 12:38:45 (1753187925),
received on Saturday, 9 August 2025, 12:22:36 (1754742156)
Author identity: vlad <vlad.muntoiu@gmail.com>
bc1635370d199c8d1016d3e82a2e02dbfc8b9836
config.yaml
@@ -1,21 +1,16 @@
panels:
- position: top
monitor: 0
size: 40
applets:
left:
- LabelApplet:
text: Hello, world
centre: []
right:
- ClockApplet:
formatting: '%T, %a %-d %b %Y'
- position: bottom
monitor: 0
size: 40
applets:
left: []
centre:
- LabelApplet:
text: Multi-panel support
text: ' One '
- LabelApplet:
text: ' Three '
- LabelApplet:
text: ' Two '
- ClockApplet:
formatting: '%T, %a %-d %b %Y'
right: []
main.py
@@ -26,7 +26,7 @@ import panorama_panel
custom_css = """
.panel-flash {
animation: flash 1000ms ease-in-out 0s 2;
animation: flash 333ms ease-in-out 0s 2;
}
@keyframes flash {
@@ -225,7 +225,25 @@ class AppletArea(Gtk.Box):
print(f"Type: {applet.__class__.__name__}")
old_area: AppletArea = applet.get_parent()
old_area.remove(applet)
self.append(applet)
# Find the position where to insert the applet
child = self.get_first_child()
while child:
allocation = child.get_allocation()
child_x, child_y = self.translate_coordinates(self, 0, 0)
if self.get_orientation() == Gtk.Orientation.HORIZONTAL:
midpoint = child_x + allocation.width / 2
if x < midpoint:
applet.insert_before(self, child)
break
elif self.get_orientation() == Gtk.Orientation.VERTICAL:
midpoint = child_y + allocation.height / 2
if y < midpoint:
applet.insert_before(self, child)
break
child = child.get_next_sibling()
else:
self.append(applet)
applet.show()
return True
def set_edit_mode(self, value):
shared/panorama_panel.py
@@ -19,6 +19,8 @@ class Applet(Gtk.Box):
self.drag_source = Gtk.DragSource(actions=Gdk.DragAction.MOVE)
self.drag_source.connect("prepare", self.provide_drag_data)
self.drag_source.connect("drag-begin", self.drag_begin)
self.drag_source.connect("drag-cancel", self.drag_cancel)
def provide_drag_data(self, source: Gtk.DragSource, x: float, y: float):
app = self.get_root().get_application()
@@ -29,6 +31,13 @@ class Applet(Gtk.Box):
print(value)
return Gdk.ContentProvider.new_for_value(value)
def drag_begin(self, source: Gtk.DragSource, drag: Gdk.Drag):
self.hide()
def drag_cancel(self, source: Gtk.DragSource, drag: Gdk.Drag, reason: Gdk.DragCancelReason):
self.show()
return False
def get_config(self):
return {}