Skip to content

Commit

Permalink
Undo changes from OpenVoiceOS#48 that added ovos-config>0.X dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Dec 28, 2024
1 parent d09ffea commit 0c0d6ac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 19 additions & 13 deletions neon_phal_plugin_system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class SystemEventsPlugin(PHALPlugin):
def __init__(self, bus=None, config=None):
super().__init__(bus=bus, name="neon-phal-plugin-system", config=config)
self.gui = GUIInterface(bus=self.bus, skill_id=self.name,
ui_directories={"qt5": join(dirname(__file__), "ui")},
config=self.config_core.get('gui'))
self.bus.on("system.ssh.status", self.handle_ssh_status)
self.bus.on("system.ssh.enable", self.handle_ssh_enable_request)
Expand Down Expand Up @@ -195,7 +196,9 @@ def on_done(message):

def handle_clock_sync(self, message: Message):
if message.data.get("display", True):
self.gui.show_status_animation("Clock Synchronized", True)
self.gui["status"] = "Enabled"
self.gui["label"] = "Clock Synchronized"
self.gui.show_page("Status")

def handle_ssh_enable_request(self, message: Message):
subprocess.call(f"systemctl enable {self.ssh_service}", shell=True)
Expand All @@ -204,7 +207,9 @@ def handle_ssh_enable_request(self, message: Message):

def handle_ssh_enabled(self, message: Message):
if message.data.get("display", True):
self.gui.show_status_animation("SSH Enabled", True)
self.gui["status"] = "Enabled"
self.gui["label"] = "SSH Enabled"
self.gui.show_page("Status")

def handle_ssh_disable_request(self, message: Message):
subprocess.call(f"systemctl stop {self.ssh_service}", shell=True)
Expand All @@ -214,16 +219,17 @@ def handle_ssh_disable_request(self, message: Message):
def handle_ssh_disabled(self, message: Message):
# ovos-shell does not want to display
if message.data.get("display", True):
self.gui.show_status_animation("SSH Disabled", False)
self.gui["status"] = "Disabled"
self.gui["label"] = "SSH Disabled"
self.gui.show_page("Status")

def handle_rebooting(self, message: Message):
"""
reboot has started
"""
if message.data.get("display", True):
self.gui.show_loading_animation("Rebooting",
override_animations=True,
override_idle=True)
self.gui.show_page("Reboot", override_animations=True,
override_idle=True)

def handle_reboot_request(self, message: Message):
"""
Expand All @@ -242,9 +248,8 @@ def handle_shutting_down(self, message: Message):
shutdown has started
"""
if message.data.get("display", True):
self.gui.show_loading_animation("Shutting Down",
override_animations=True,
override_idle=True)
self.gui.show_page("Shutdown", override_animations=True,
override_idle=True)

def handle_shutdown_request(self, message: Message):
"""
Expand Down Expand Up @@ -272,16 +277,17 @@ def handle_configure_language_request(self, message: Message):
# it is usually part of other groups of actions that may
# provide their own UI
if message.data.get("display", False):
self.gui.show_status_animation(f"Language changed to {language_code}", True)
self.gui["status"] = "Enabled"
self.gui["label"] = f"Language changed to {language_code}"
self.gui.show_page("Status")

self.bus.emit(Message('system.configure.language.complete',
{"lang": language_code}))

def handle_mycroft_restarting(self, message: Message):
if message.data.get("display", True):
self.gui.show_loading_animation("Restarting",
override_animations=True,
override_idle=True)
self.gui.show_page("Restart", override_animations=True,
override_idle=True)

def handle_mycroft_restart_request(self, message: Message):
service = self.core_service_name
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ovos-plugin-manager>=0.0.26,<1.0.0
ovos-utils>=0.1.0,<1.0.0
ovos_config>=0.0.5,<1.0.0
ovos-bus-client>=1.1.0,<2.0.0
ovos-bus-client>=0.0.8,<2.0.0

0 comments on commit 0c0d6ac

Please sign in to comment.