diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ce8f6eb..d877b03 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,9 @@ test: before_script: - ./cicd/install-project-deps.sh - ./cicd/start-dbus.sh + - apt install xvfb + - Xvfb :119 -screen 0 1024x768x16 & + - export DISPLAY=:119 script: - pipenv run ./cicd/pytest.sh artifacts: diff --git a/cicd/python-build/Dockerfile b/cicd/python-build/Dockerfile index c50725d..875517f 100644 --- a/cicd/python-build/Dockerfile +++ b/cicd/python-build/Dockerfile @@ -33,6 +33,7 @@ RUN apt update && \ python3-pip \ tk-dev \ wget \ + xvfb \ xz-utils \ zlib1g-dev diff --git a/sublime-music.metainfo.xml b/sublime-music.metainfo.xml index 47270f0..4f63396 100644 --- a/sublime-music.metainfo.xml +++ b/sublime-music.metainfo.xml @@ -5,7 +5,7 @@ FSFAP GPL-3.0+ Sublime Music - Native Subsonic client for Linux + A native GTK music player with *sonic support

diff --git a/sublime/app.py b/sublime/app.py index f05c7f4..d7e0318 100644 --- a/sublime/app.py +++ b/sublime/app.py @@ -258,14 +258,14 @@ class SublimeMusicApp(Gtk.Application): inital_sync_result = AdapterManager.initial_sync() inital_sync_result.add_done_callback(lambda _: self.update_window()) - # Start a loop for testing the ping. - def ping_update(): + # Start a loop for periodically updating the window every 10 seconds. + def periodic_update(): if self.exiting: return self.update_window() - GLib.timeout_add(10000, ping_update) + GLib.timeout_add(10000, periodic_update) - GLib.timeout_add(10000, ping_update) + GLib.timeout_add(10000, periodic_update) # Prompt to load the play queue from the server. if self.app_config.server.sync_enabled: @@ -536,6 +536,8 @@ class SublimeMusicApp(Gtk.Application): if self.app_config.state.current_song_index < 0: return + self.app_config.state.playing = not self.app_config.state.playing + if self.player.song_loaded: self.player.toggle_play() self.save_play_queue() @@ -543,7 +545,6 @@ class SublimeMusicApp(Gtk.Application): # This is from a restart, start playing the file. self.play_song(self.app_config.state.current_song_index) - self.app_config.state.playing = not self.app_config.state.playing self.update_window() def on_next_track(self, *args): diff --git a/tests/common_ui_tests.py b/tests/common_ui_tests.py old mode 100644 new mode 100755 index d6bed19..368a318 --- a/tests/common_ui_tests.py +++ b/tests/common_ui_tests.py @@ -1,5 +1,10 @@ from pathlib import Path +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk # noqa: F401 + from sublime.ui import common