feat(modules/panel/components): adjust dropdown capture layer and pointer widget assignments

Changed the default layer used by `create_dropdown_with_capture` from `"bottom"` to `"top"` and updated the call site accordingly. Added safety checks to set `_pointing_widget` on indicator windows when they exist, preventing potential errors when the windows are not created.

- Enhancements:
  - Updated default `layer` parameter in `create_dropdown_with_capture` to `"top"`.
- Bug Fixes:
  - Ensured `BluetoothIndicator`, `NetworkIndicator`, and `BatteryIndicator` properly assign `_pointing_widget` to their respective buttons when the associated windows are present.
This commit is contained in:
sankalp committed 2026-04-10 01:13:29 +05:45
1 parent 38de0c66ed
commit ad6d35fe46
2 files changed
+8 -4

No files matched your search

+2 -4
View File
@@ -34,9 +34,7 @@ def create_menu_button(label, on_clicked=None):
return button
def create_dropdown_with_capture(
dropdown_id, parent, dropdown_children, layer="bottom"
):
def create_dropdown_with_capture(dropdown_id, parent, dropdown_children, layer="top"):
dropdown = ModusDropdown(
dropdown_id=dropdown_id,
parent=parent,
@@ -140,7 +138,7 @@ class GlobalMenuDropdowns:
self.system_dropdown = SystemDropdown(parent=parent)
self.menu_button_dropdown = DropDownMouseCapture(
layer="bottom", child_window=self.system_dropdown
layer="top", child_window=self.system_dropdown
)
self.menu_button = Button(
label="Modus",
+6
View File
@@ -85,6 +85,8 @@ class BluetoothIndicator(Box):
self,
show_back_button=False,
)
if self.bluetooth_window:
self.bluetooth_window._pointing_widget = self.bt_button
modus_service.connect("bluetooth-changed", self.on_bluetooth_changed)
self.bluetooth.connect("changed", self.on_bluetooth_direct_changed)
@@ -194,6 +196,8 @@ class NetworkIndicator(Box):
self,
show_back_button=False,
)
if self.wifi_window:
self.wifi_window._pointing_widget = self.network_button
modus_service.connect("wlan-changed", self.on_wlan_changed)
self.network_service.connect("wifi-device-added", self.on_wifi_device_added)
@@ -348,6 +352,8 @@ class BatteryIndicator(Box):
self,
show_back_button=False,
)
if self.battery_window:
self.battery_window._pointing_widget = self.battery_button
modus_service.connect("battery-changed", self.on_battery_changed)
self.battery_service.connect("changed", self.on_battery_direct_changed)