[gnome-music/wip/mschraal/glib-logging: 9/65] grlsearchwrapper: Cleanups
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/glib-logging: 9/65] grlsearchwrapper: Cleanups
- Date: Sat, 1 Feb 2020 15:37:50 +0000 (UTC)
commit a804e8d2b9890b1d96331e81643726c3c8b8108d
Author: Marinus Schraal <mschraal gnome org>
Date: Mon Jan 27 19:35:22 2020 +0100
grlsearchwrapper: Cleanups
* pass application as argument, in line with GrlSearchWrapper
* add docstrings
* remove repr
gnomemusic/coregrilo.py | 2 +-
gnomemusic/grilowrappers/grlsearchwrapper.py | 25 +++++++++++++++++++++----
2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index c17f0fac..d9455f56 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -150,7 +150,7 @@ class CoreGrilo(GObject.GObject):
and source.get_supported_media() & Grl.MediaType.AUDIO
and source.supported_operations() & Grl.SupportedOps.SEARCH):
self._search_wrappers[source.props.source_id] = GrlSearchWrapper(
- source, self._coremodel, self._coreselection, self)
+ source, self._coremodel, self._application, self)
self._log.debug("Adding search source {}".format(source))
def _on_source_removed(self, registry, source):
diff --git a/gnomemusic/grilowrappers/grlsearchwrapper.py b/gnomemusic/grilowrappers/grlsearchwrapper.py
index 1b50dcba..8e9a70dc 100644
--- a/gnomemusic/grilowrappers/grlsearchwrapper.py
+++ b/gnomemusic/grilowrappers/grlsearchwrapper.py
@@ -30,6 +30,12 @@ from gnomemusic.coresong import CoreSong
class GrlSearchWrapper(GObject.GObject):
+ """Wrapper for a generic Grilo source search.
+
+ Grilo has -besides source specific queries- an option to do a
+ generic source search, if the source supports it. This class wraps
+ such a search.
+ """
METADATA_KEYS = [
Grl.METADATA_KEY_ALBUM,
@@ -48,14 +54,21 @@ class GrlSearchWrapper(GObject.GObject):
Grl.METADATA_KEY_URL
]
- def __repr__(self):
- return "<GrlSearchWrapper>"
+ def __init__(self, source, coremodel, application, grilo):
+ """Initialize a search wrapper
+
+ Initialize a generic Grilo source search wrapper.
- def __init__(self, source, coremodel, coreselection, grilo):
+ :param Grl.Source source: The Grilo source to wrap
+ :param CoreModel coremodel: CoreModel instance to use models
+ from
+ :param Application application: Application instance
+ :param CoreGrilo grilo: The CoreGrilo instance
+ """
super().__init__()
self._coremodel = coremodel
- self._coreselection = coreselection
+ self._coreselection = application.props.coreselection
self._grilo = grilo
self._source = source
@@ -75,6 +88,10 @@ class GrlSearchWrapper(GObject.GObject):
Grl.ResolutionFlags.FAST_ONLY | Grl.ResolutionFlags.IDLE_RELAY)
def search(self, text):
+ """Initiate a search
+
+ :param str text: The text to search
+ """
with self._song_search_store.freeze_notify():
self._song_search_store.remove_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]