Commit c9e34c89 authored by Marinus Schraal's avatar Marinus Schraal

Use Python 3 style super calls

The codebase was using mixed style (Python 2 & 3) superclass calls,
replace it with Python 3 super() calls only.
parent 1aa98d90
......@@ -165,7 +165,8 @@ class DefaultIcon(GObject.GObject):
@log
def __init__(self, scale=1):
GObject.GObject.__init__(self)
super().__init__()
self._scale = scale
@log
......@@ -236,7 +237,8 @@ class AlbumArtCache(GObject.GObject):
@log
def __init__(self, scale=1):
GObject.GObject.__init__(self)
super().__init__()
self._scale = scale
self.cache_dir = os.path.join(GLib.get_user_cache_dir(), 'media-art')
......
......@@ -48,8 +48,10 @@ class Application(Gtk.Application):
@log
def __init__(self):
Gtk.Application.__init__(self, application_id='org.gnome.Music',
flags=Gio.ApplicationFlags.FLAGS_NONE)
super().__init__(
application_id='org.gnome.Music',
flags=Gio.ApplicationFlags.FLAGS_NONE)
GLib.set_application_name(_("Music"))
GLib.set_prgname('gnome-music')
GLib.setenv("PULSE_PROP_media.role", "music", True)
......
......@@ -80,7 +80,8 @@ class Grilo(GObject.GObject):
@log
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self.playlist_path = GLib.build_filenamev([GLib.get_user_data_dir(),
"gnome-music", "playlists"])
if not (GLib.file_test(self.playlist_path, GLib.FileTest.IS_DIR)):
......
......@@ -101,7 +101,8 @@ class Player(GObject.GObject):
@log
def __init__(self, parent_window):
GObject.GObject.__init__(self)
super().__init__()
self._parent_window = parent_window
self.playlist = None
self.playlistType = None
......@@ -1158,13 +1159,10 @@ class MissingCodecsDialog(Gtk.MessageDialog):
@log
def __init__(self, parent_window, install_helper_name):
Gtk.MessageDialog.__init__(self,
transient_for=parent_window,
modal=True,
destroy_with_parent=True,
message_type=Gtk.MessageType.ERROR,
buttons=Gtk.ButtonsType.CANCEL,
text=_("Unable to play the file"))
super().__init__(
transient_for=parent_window, modal=True, destroy_with_parent=True,
message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.CANCEL,
text=_("Unable to play the file"))
# TRANSLATORS: this is a button to launch a codec installer.
# %s will be replaced with the software installer's name, e.g.
......
......@@ -144,7 +144,8 @@ class Playlists(GObject.GObject):
@log
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self.tracker = TrackerWrapper().tracker
self._static_playlists = StaticPlaylists()
......
......@@ -104,8 +104,9 @@ class SourceManager(BaseManager):
return '<SourceManager>'
@log
def __init__(self, id, label, entry):
super(SourceManager, self).__init__(id, label, entry)
def __init__(self, id_, label, entry):
super().__init__(id_, label, entry)
self.values.append(['', '', self.label])
self.values.append(['all', _("All"), ""])
self.values.append(['grl-tracker-source', _("Local"), ''])
......@@ -207,7 +208,7 @@ class DropDown(Gtk.Revealer):
@log
def __init__(self):
Gtk.Revealer.__init__(self, halign=Gtk.Align.CENTER, valign=Gtk.Align.START)
super().__init__(halign=Gtk.Align.CENTER, valign=Gtk.Align.START)
self._grid = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL)
......@@ -251,7 +252,8 @@ class Searchbar(Gtk.SearchBar):
@log
def __init__(self, stack_switcher, search_button, dropdown):
Gtk.Revealer.__init__(self)
super().__init__()
self.timeout = None
self.stack_switcher = stack_switcher
self._search_button = search_button
......
......@@ -52,7 +52,8 @@ class Toolbar(GObject.GObject):
@log
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self._stack_switcher = Gtk.StackSwitcher(can_focus=False,
halign="center")
self._stack_switcher.show()
......
......@@ -41,7 +41,7 @@ class AlbumsView(BaseView):
@log
def __init__(self, window, player):
BaseView.__init__(self, 'albums', _("Albums"), window, None)
super().__init__('albums', _("Albums"), window, None)
self._album_widget = AlbumWidget(player, self)
self.player = player
self.add(self._album_widget)
......
......@@ -52,8 +52,8 @@ class ArtistsView(BaseView):
:param GtkWidget window: The main window
:param player: The main player object
"""
BaseView.__init__(self, 'artists', _("Artists"), window,
Gd.MainViewType.LIST, True)
super().__init__(
'artists', _("Artists"), window, Gd.MainViewType.LIST, True)
self.player = player
self._artists = {}
......
......@@ -54,8 +54,8 @@ class BaseView(Gtk.Stack):
:param sidebar: The sidebar object (Default: Gtk.Box)
"""
Gtk.Stack.__init__(self,
transition_type=Gtk.StackTransitionType.CROSSFADE)
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
self._grid = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL)
self._offset = 0
self.model = Gtk.ListStore(
......
......@@ -37,8 +37,8 @@ class EmptySearchView(BaseView):
@log
def __init__(self, window, player):
BaseView.__init__(
self, 'emptysearch', None, window, Gd.MainViewType.LIST)
super().__init__('emptysearch', None, window, Gd.MainViewType.LIST)
self._artist_albums_widget = None
self.player = player
......
......@@ -36,8 +36,8 @@ class EmptyView(Gtk.Stack):
@log
def __init__(self, window, player):
Gtk.Stack.__init__(self,
transition_type=Gtk.StackTransitionType.CROSSFADE)
super().__init__(transition_type=Gtk.StackTransitionType.CROSSFADE)
self.builder = Gtk.Builder()
self.builder.add_from_resource('/org/gnome/Music/NoMusic.ui')
widget = self.builder.get_object('container')
......
......@@ -36,7 +36,7 @@ class InitialStateView(EmptyView):
@log
def __init__(self, window, player):
EmptyView.__init__(self, window, player)
super().__init__(window, player)
# Update image
icon = self.builder.get_object('icon')
......
......@@ -51,7 +51,7 @@ class SearchView(BaseView):
@log
def __init__(self, window, player):
BaseView.__init__(self, 'search', None, window, Gd.MainViewType.LIST)
super().__init__('search', None, window, Gd.MainViewType.LIST)
scale = self.get_scale_factor()
loading_icon_surface = DefaultIcon(scale).get(
......
......@@ -52,8 +52,7 @@ class SongsView(BaseView):
:param GtkWidget window: The main window
:param player: The main player object
"""
BaseView.__init__(self, 'songs', _("Songs"),
window, Gd.MainViewType.LIST)
super().__init__('songs', _("Songs"), window, Gd.MainViewType.LIST)
self._offset = 0
self._iter_to_clean = None
......
......@@ -51,7 +51,7 @@ class AlbumWidget(Gtk.EventBox):
:param player: The player object
:param parent_view: The view this widget is part of
"""
Gtk.EventBox.__init__(self)
super().__init__()
self._songs = []
......
......@@ -48,7 +48,7 @@ class ArtistAlbumsWidget(Gtk.Box):
@log
def __init__(self, artist, albums, player, header_bar, selection_toolbar,
window, selection_mode_allowed=False):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
super().__init__(orientation=Gtk.Orientation.VERTICAL)
self._player = player
self.artist = artist
self._window = window
......
......@@ -44,7 +44,7 @@ class ArtistAlbumWidget(Gtk.Box):
def __init__(self, media, player, model, header_bar,
selection_mode_allowed, size_group=None,
cover_size_group=None):
super().__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
self._size_group = size_group
self._cover_size_group = cover_size_group
......
......@@ -40,7 +40,7 @@ class StarImage(Gtk.Image):
@log
def __init__(self):
super().__init__(self)
super().__init__()
self._favorite = False
......@@ -104,7 +104,7 @@ class DiscSongsFlowBox(Gtk.FlowBox):
:param int columns: The number of columns the widget uses
"""
super().__init__(self)
super().__init__()
super().set_selection_mode(Gtk.SelectionMode.NONE)
self._columns = columns
......
......@@ -63,9 +63,8 @@ class Window(Gtk.ApplicationWindow):
@log
def __init__(self, app):
Gtk.ApplicationWindow.__init__(self,
application=app,
title=_("Music"))
super().__init__(application=app, title=_("Music"))
self.connect('focus-in-event', self._windows_focus_cb)
self.settings = Gio.Settings.new('org.gnome.Music')
self.add_action(self.settings.create_action('repeat'))
......
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