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

fix:wallpaper_paths #111

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
33 changes: 19 additions & 14 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from os import environ, listdir, path

import datetime
import os
import tempfile
from os import environ, listdir, path

from lingua_franca.format import get_date_strings
from ovos_workshop.skills.api import SkillApi
from ovos_workshop.skills.ovos import OVOSSkill
from ovos_workshop.decorators import intent_handler, resting_screen_handler
from ovos_bus_client import Message
from ovos_config.locations import get_xdg_cache_save_path
from ovos_utils import classproperty
from ovos_utils.log import LOG
from ovos_utils.time import now_local
from ovos_utils.process_utils import RuntimeRequirements
from ovos_workshop.decorators import intent_handler, resting_screen_handler
from ovos_workshop.skills.api import SkillApi
from ovos_workshop.skills.ovos import OVOSSkill


class OVOSHomescreenSkill(OVOSSkill):
def __init__(self, *args, **kwargs):
self.notifications_storage_model = []
self.def_wallpaper_folder = path.dirname(__file__) + '/ui/wallpapers/'
self.loc_wallpaper_folder = None
self.selected_wallpaper_path = None
self.selected_wallpaper = None
Expand Down Expand Up @@ -288,14 +288,19 @@ def on_no_internet(self, message):
# Follows OVOS PHAL Wallpaper Manager API

def collect_wallpapers(self):
def_wallpaper_collection, loc_wallpaper_collection = None, None
for dirname, dirnames, filenames in os.walk(self.def_wallpaper_folder):
def_wallpaper_collection = filenames
def_wallpaper_collection = [os.path.join(dirname, wallpaper) for wallpaper in def_wallpaper_collection]

for dirname, dirnames, filenames in os.walk(self.loc_wallpaper_folder):
loc_wallpaper_collection = filenames
loc_wallpaper_collection = [os.path.join(dirname, wallpaper) for wallpaper in loc_wallpaper_collection]
# this path is hardcoded in ovos_gui.constants and follows XDG spec
GUI_CACHE_PATH = get_xdg_cache_save_path('ovos_gui')

def_wallpaper_collection, loc_wallpaper_collection = [], []

for _, _, filenames in os.walk(f'{self.root_dir}/ui/wallpapers/'):
# we use cache path to ensure files are available to other docker containers etc
# on load the full "ui" folder is cached in the standard dir
def_wallpaper_collection = [f"{GUI_CACHE_PATH}/qt5/wallpapers/{wallpaper}"
for wallpaper in filenames]

for root, _, filenames in os.walk(self.loc_wallpaper_folder):
loc_wallpaper_collection = [os.path.join(root, wallpaper) for wallpaper in filenames]

self.wallpaper_collection = def_wallpaper_collection + loc_wallpaper_collection

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ovos-utils>=0.0.38,<2.0.0
ovos-workshop>=0.0.15,<3.0.0
ovos-lingua-franca>=0.4.7
ovos-bus-client>=1.0.0,<2.0.0
Loading