Skip to content

Commit

Permalink
fix:homescreen app (#152)
Browse files Browse the repository at this point in the history
* fix:homescreen app

use the new decorator to ensure app drawer is populated

* ovos-workshop>=2.4.0,<3.0.0

* fix:icon file path

use self.res_dir not self.root_dir to allow non standard locations (eg. OCP)

allow skills to load even if icon is missing, but log an error and dont register app with homescreen

* Update requirements.txt

* test
  • Loading branch information
JarbasAl authored Nov 15, 2024
1 parent 41687b1 commit 989a791
Show file tree
Hide file tree
Showing 88 changed files with 10 additions and 35 deletions.
21 changes: 7 additions & 14 deletions ovos_plugin_common_play/ocp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import time
from os.path import join, dirname, isfile
from threading import Event, Lock
from os.path import join, dirname
from typing import Optional, List
from ovos_config import Configuration
from ovos_plugin_common_play.ocp.gui import OCPMediaPlayerGUI
from ovos_plugin_common_play.ocp.player import OCPMediaPlayer
from ovos_utils.gui import can_use_gui

from ovos_plugin_manager.ocp import load_stream_extractors
from ovos_utils.log import LOG
from ovos_utils.messagebus import Message

from padacioso import IntentContainer

from ovos_workshop.app import OVOSAbstractApplication
from ovos_workshop.decorators.ocp import *
from ovos_plugin_manager.ocp import load_stream_extractors
from ovos_workshop.decorators import homescreen_app

from ovos_plugin_common_play.ocp.constants import OCP_ID
from ovos_plugin_common_play.ocp.gui import OCPMediaPlayerGUI
from ovos_plugin_common_play.ocp.player import OCPMediaPlayer


class OCP(OVOSAbstractApplication):
Expand Down Expand Up @@ -79,14 +73,13 @@ def handle_get_SEIs(self, message):
xtract = load_stream_extractors() # @lru_cache, its a lazy loaded singleton
self.bus.emit(message.response({"SEI": xtract.supported_seis}))

@homescreen_app(icon="OCP.png", name="OCP")
def handle_home(self, message=None):
"""
Handle ovos.common_play.home Messages and show the homescreen
@param message: message associated with request
"""
# homescreen / launch from .desktop
self.gui.show_home(app_mode=True)

def default_shutdown(self):
self.player.shutdown()

2 changes: 1 addition & 1 deletion ovos_plugin_common_play/ocp/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, bus=None):
# the skill_id is chosen so the namespace matches the regular bus api
# ie, the gui event "XXX" is sent in the bus as "ovos.common_play.XXX"
gui_config = Configuration().get("gui") or {}
ui_dirs = {"qt5": f"{dirname(__file__)}/res/ui"}
ui_dirs = {"qt5": f"{dirname(__file__)}/res/gui/qt5"}
super(OCPMediaPlayerGUI, self).__init__(bus=bus,
skill_id=OCP_ID,
ui_directories=ui_dirs,
Expand Down
18 changes: 0 additions & 18 deletions ovos_plugin_common_play/ocp/res/desktop/OCP.desktop

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ovos-plugin-manager>=0.0.26,<1.0.0
ovos_bus_client>=0.0.7,<2.0.0
ovos-utils>=0.1.0,<1.0.0
ovos-workshop>=0.0.16,<3.0.0
ovos-workshop>=2.4.2,<3.0.0
padacioso>=0.1.1,<2.0.0
dbus-next
2 changes: 1 addition & 1 deletion test/unittests/test_ocp_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_00_player_init(self):
from ovos_plugin_common_play.ocp.media import NowPlaying, Playlist
from ovos_plugin_common_play.ocp.mpris import MprisPlayerCtl
from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface
from ovos_workshop import OVOSAbstractApplication
from ovos_workshop.app import OVOSAbstractApplication

self.assertIsInstance(self.player, OVOSAbstractApplication)
self.assertIsInstance(self.player.gui, OCPMediaPlayerGUI)
Expand Down

0 comments on commit 989a791

Please sign in to comment.