Commit a7213228 authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

Add short repr for objects to simplify logging

parent 3c80e38a
......@@ -90,6 +90,9 @@ class AlbumArtCache(GObject.GObject):
default_icon_width = 256
default_icon_height = 256
def __repr__(self):
return '<AlbumArt>'
@classmethod
def get_default(self):
if not self.instance:
......
......@@ -43,6 +43,10 @@ logger = logging.getLogger(__name__)
class Application(Gtk.Application):
def __repr__(self):
return '<Application>'
@log
def __init__(self):
Gtk.Application.__init__(self,
......
......@@ -62,6 +62,9 @@ class Grilo(GObject.GObject):
CHANGED_MEDIA_MAX_ITEMS = 500
CHANGED_MEDIA_SIGNAL_TIMEOUT = 2000
def __repr__(self):
return '<Grilo>'
@log
def __init__(self):
GObject.GObject.__init__(self)
......
......@@ -47,6 +47,9 @@ class MediaPlayer2Service(dbus.service.Object):
MEDIA_PLAYER2_TRACKLIST_IFACE = 'org.mpris.MediaPlayer2.TrackList'
MEDIA_PLAYER2_PLAYLISTS_IFACE = 'org.mpris.MediaPlayer2.Playlists'
def __repr__(self):
return '<MediaPlayer2Service>'
def __init__(self, app):
DBusGMainLoop(set_as_default=True)
name = dbus.service.BusName('org.mpris.MediaPlayer2.GnomeMusic', dbus.SessionBus())
......
......@@ -36,6 +36,10 @@ IMAGE_SIZE = 125
class NotificationManager:
def __repr__(self):
return '<NotificationManager>'
@log
def __init__(self, player):
self._player = player
......
......@@ -95,6 +95,9 @@ class Player(GObject.GObject):
'thumbnail-updated': (GObject.SignalFlags.RUN_FIRST, None, (str,)),
}
def __repr__(self):
return '<Player>'
@log
def __init__(self, parent_window):
GObject.GObject.__init__(self)
......@@ -1068,6 +1071,9 @@ class Player(GObject.GObject):
class MissingCodecsDialog(Gtk.MessageDialog):
def __repr__(self):
return '<MissingCodecsDialog>'
@log
def __init__(self, parent_window, install_helper_name):
Gtk.MessageDialog.__init__(self,
......@@ -1102,6 +1108,9 @@ class MissingCodecsDialog(Gtk.MessageDialog):
class SelectionToolbar():
def __repr__(self):
return '<SelectionToolbar>'
@log
def __init__(self):
self._ui = Gtk.Builder()
......
......@@ -41,6 +41,10 @@ logger = logging.getLogger(__name__)
class StaticPlaylists:
def __repr__(self):
return '<StaticPlaylists>'
class MostPlayed:
ID = None
QUERY = Query.get_most_played_songs()
......@@ -97,6 +101,9 @@ class Playlists(GObject.GObject):
instance = None
tracker = None
def __repr__(self):
return '<Playlists>'
@classmethod
def get_default(self, tracker=None):
if self.instance:
......
......@@ -56,6 +56,9 @@ class Query():
except TypeError:
logger.warn("XDG user dirs are not set")
def __repr__(self):
return '<Query>'
@staticmethod
def order_by_statement(attr):
"""Returns a SPARQL ORDER BY statement sorting by the given attribute, ignoring
......
......@@ -40,6 +40,10 @@ class BaseModelColumns():
class BaseManager:
def __repr__(self):
return '<BaseManager>'
@log
def __init__(self, id, label, entry):
self.id = id
......@@ -94,6 +98,9 @@ class BaseManager:
class SourceManager(BaseManager):
def __repr__(self):
return '<SourceManager>'
@log
def __init__(self, id, label, entry):
super(SourceManager, self).__init__(id, label, entry)
......@@ -124,6 +131,10 @@ class SourceManager(BaseManager):
class FilterView():
def __repr__(self):
return '<FilterView>'
@log
def __init__(self, manager, dropdown):
self.manager = manager
......@@ -186,6 +197,10 @@ class FilterView():
class DropDown(Gtk.Revealer):
def __repr__(self):
return '<DropDown>'
@log
def __init__(self):
Gtk.Revealer.__init__(self, halign=Gtk.Align.CENTER, valign=Gtk.Align.START)
......@@ -227,6 +242,9 @@ class DropDown(Gtk.Revealer):
class Searchbar(Gtk.Revealer):
def __repr__(self):
return '<Searchbar>'
@log
def __init__(self, stack_switcher, search_button, dropdown):
Gtk.Revealer.__init__(self)
......
......@@ -50,6 +50,9 @@ class Toolbar(GObject.GObject):
}
_selectionMode = False
def __repr__(self):
return '<Toolbar>'
@log
def __init__(self):
GObject.GObject.__init__(self)
......
......@@ -59,6 +59,9 @@ class ViewContainer(Gtk.Stack):
nowPlayingIconName = 'media-playback-start-symbolic'
errorIconName = 'dialog-error-symbolic'
def __repr__(self):
return '<ViewContainer>'
@log
def __init__(self, name, title, window, view_type, use_sidebar=False, sidebar=None):
Gtk.Stack.__init__(self,
......@@ -256,6 +259,10 @@ class ViewContainer(Gtk.Stack):
# Class for the Empty View
class Empty(Gtk.Stack):
def __repr__(self):
return '<EmptyView>'
@log
def __init__(self, window, player):
Gtk.Stack.__init__(self,
......@@ -275,6 +282,10 @@ class Empty(Gtk.Stack):
# Class for the Initial State
class InitialState(Empty):
def __repr__(self):
return '<InitialState>'
@log
def __init__(self, window, player):
Empty.__init__(self, window, player)
......@@ -294,6 +305,10 @@ class InitialState(Empty):
class Albums(ViewContainer):
def __repr__(self):
return '<Albums>'
@log
def __init__(self, window, player):
ViewContainer.__init__(self, 'albums', _("Albums"), window, Gd.MainViewType.ICON)
......@@ -385,6 +400,10 @@ class Albums(ViewContainer):
class Songs(ViewContainer):
def __repr__(self):
return '<Songs>'
@log
def __init__(self, window, player):
ViewContainer.__init__(self, 'songs', _("Songs"), window, Gd.MainViewType.LIST)
......@@ -583,6 +602,10 @@ class Songs(ViewContainer):
class Artists (ViewContainer):
def __repr__(self):
return '<Artists>'
@log
def __init__(self, window, player):
ViewContainer.__init__(self, 'artists', _("Artists"),
......@@ -787,6 +810,9 @@ class Playlist(ViewContainer):
'playlist-songs-loaded': (GObject.SignalFlags.RUN_FIRST, None, ()),
}
def __repr__(self):
return '<Playlist>'
@log
def __init__(self, window, player):
self.playlists_sidebar = Gd.MainView(
......@@ -1285,6 +1311,10 @@ class Playlist(ViewContainer):
class EmptySearch(ViewContainer):
def __repr__(self):
return '<EmptySearch>'
@log
def __init__(self, window, player):
ViewContainer.__init__(self, 'emptysearch', None, window, Gd.MainViewType.LIST)
......@@ -1314,6 +1344,9 @@ class Search(ViewContainer):
'no-music-found': (GObject.SignalFlags.RUN_FIRST, None, ())
}
def __repr__(self):
return '<Search>'
@log
def __init__(self, window, player):
ViewContainer.__init__(self, 'search', None, window, Gd.MainViewType.LIST)
......
......@@ -57,6 +57,10 @@ playlists = Playlists.get_default()
class StarHandler():
def __repr__(self):
return '<StarHandler>'
@log
def __init__(self, parent, star_index):
self.star_index = star_index
......@@ -95,6 +99,9 @@ class AlbumWidget(Gtk.EventBox):
loadingIcon = ALBUM_ART_CACHE.get_default_icon(256, 256, True)
noArtworkIcon = ALBUM_ART_CACHE.get_default_icon(256, 256, False)
def __repr__(self):
return '<AlbumWidget>'
@log
def __init__(self, player, parentview):
Gtk.EventBox.__init__(self)
......@@ -361,6 +368,9 @@ class AlbumWidget(Gtk.EventBox):
class ArtistAlbums(Gtk.Box):
def __repr__(self):
return '<ArtistAlbums>'
@log
def __init__(self, artist, albums, player,
header_bar, selection_toolbar, window, selectionModeAllowed=False):
......@@ -519,6 +529,9 @@ class ArtistAlbums(Gtk.Box):
class AllArtistsAlbums(ArtistAlbums):
def __repr__(self):
return '<AllArtistsAlbums>'
@log
def __init__(self, player, header_bar, selection_toolbar, selectionModeAllowed=False):
ArtistAlbums.__init__(self, _("All Artists"), [], player,
......@@ -551,6 +564,9 @@ class ArtistAlbumWidget(Gtk.Box):
loadingIcon = AlbumArtCache.get_default().get_default_icon(128, 128, True)
noArtworkIcon = ALBUM_ART_CACHE.get_default_icon(128, 128, False)
def __repr__(self):
return '<ArtistAlbumWidget>'
@log
def __init__(self, artist, album, player, model, header_bar, selectionModeAllowed):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
......@@ -704,6 +720,10 @@ class ArtistAlbumWidget(Gtk.Box):
class PlaylistDialog():
def __repr__(self):
return '<PlaylistDialog>'
@log
def __init__(self, parent):
self.ui = Gtk.Builder()
......@@ -833,6 +853,9 @@ class CellRendererClickablePixbuf(Gtk.CellRendererPixbuf):
starIcon = 'starred-symbolic'
nonStarIcon = 'non-starred-symbolic'
def __repr__(self):
return '<CellRendererClickablePixbuf>'
def __init__(self, view, hidden=False, *args, **kwargs):
Gtk.CellRendererPixbuf.__init__(self, *args, **kwargs)
self.set_property('mode', Gtk.CellRendererMode.ACTIVATABLE)
......
......@@ -52,6 +52,9 @@ playlist = Playlists.get_default()
class Window(Gtk.ApplicationWindow):
def __repr__(self):
return '<Window>'
@log
def __init__(self, app):
Gtk.ApplicationWindow.__init__(self,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment