Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wallpaper rotation to handle changes from GUI #25

Merged
merged 7 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ovos_gui_plugin_shell_companion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import platform

from os.path import join, dirname

from ovos_bus_client.message import GUIMessage
NeonDaniel marked this conversation as resolved.
Show resolved Hide resolved

from ovos_bus_client.client import MessageBusClient
from ovos_bus_client import Message
from ovos_utils import network_utils
Expand Down Expand Up @@ -155,11 +158,17 @@ def handle_device_about_page(self, message):
self.gui['system_info'] = system_information
self.gui.show_page("SYSTEM_AdditionalSettings.qml", override_idle=True)

def handle_display_wallpaper_rotation_config_set(self, message):
def handle_display_wallpaper_rotation_config_set(self, message: GUIMessage):
"""
Handle a GUI event requesting a new wallpaper rotation setting
@param message: `speaker.extension.display.set.wallpaper.rotation`
"""
wallpaper_rotation = message.data.get("wallpaper_rotation", False)
self.local_display_config["wallpaper_rotation"] = wallpaper_rotation
self.local_display_config.store()
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
self.bus.emit(Message("speaker.extension.display.wallpaper.rotation.changed"))

# TODO Is the below message consumed anywhere?
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
self.bus.emit(message.forward("speaker.extension.display.wallpaper.rotation.changed"))

def handle_display_auto_dim_config_set(self, message):
auto_dim = message.data.get("auto_dim", False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ Item {
onClicked: {
console.log(autoWallpaperRotationSwitch.checked)
Mycroft.SoundEffects.playClickedSound(Qt.resolvedUrl("../snd/clicked.wav"))
if (autoWallpaperRotationSwitch.checked) {
Mycroft.MycroftController.sendRequest("ovos.wallpaper.manager.enable.auto.rotation")
}
else {
Mycroft.MycroftController.sendRequest("ovos.wallpaper.manager.disable.auto.rotation")
}
// TODO: deprecate this event?
NeonDaniel marked this conversation as resolved.
Show resolved Hide resolved
triggerGuiEvent("speaker.extension.display.set.wallpaper.rotation", {"wallpaper_rotation": autoWallpaperRotationSwitch.checked})
}
}
Expand Down
Loading