[gnome-music/wip/merge: 202/343] Eradicate remaining CamelCase
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/merge: 202/343] Eradicate remaining CamelCase
- Date: Thu, 25 Jul 2013 11:29:57 +0000 (UTC)
commit 688b07f0f456b97f304e6eccc3cd41f12c5cac64
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Tue Jul 16 20:14:32 2013 +0200
Eradicate remaining CamelCase
gnomemusic/grilo.py | 12 ++--
gnomemusic/player.py | 192 ++++++++++++++++++++++++------------------------
gnomemusic/toolbar.py | 10 ++--
gnomemusic/view.py | 62 ++++++++--------
gnomemusic/widgets.py | 58 ++++++++--------
gnomemusic/window.py | 14 ++--
6 files changed, 174 insertions(+), 174 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 506d80a..601428b 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -26,10 +26,10 @@ class Grilo(GObject.GObject):
self.sources = {}
self.tracker = None
- self.registry.connect('source_added', self._onSourceAdded)
- self.registry.connect('source_removed', self._onSourceRemoved)
+ self.registry.connect('source_added', self._on_source_added)
+ self.registry.connect('source_removed', self._on_source_removed)
- def _onSourceAdded(self, pluginRegistry, mediaSource):
+ def _on_source_added(self, pluginRegistry, mediaSource):
id = mediaSource.get_id()
if id == "grl-tracker-source":
ops = mediaSource.supported_operations()
@@ -43,7 +43,7 @@ class Grilo(GObject.GObject):
if self.tracker is not None:
self.emit('ready')
- def _onSourceRemoved(self):
+ def _on_source_removed(self):
print('source removed')
def populate_artists(self, offset, callback):
@@ -70,7 +70,7 @@ class Grilo(GObject.GObject):
Grl.ResolutionFlags.IDLE_RELAY)
self.tracker.query(query, self.METADATA_KEYS, options, callback, None)
- def _searchCallback(self):
+ def _search_callback(self):
print("yeah")
def search(self, q):
@@ -79,7 +79,7 @@ class Grilo(GObject.GObject):
source.search(q, [Grl.METADATA_KEY_ID], 0, 10,
Grl.MetadataResolutionFlags.FULL |
Grl.MetadataResolutionFlags.IDLE_RELAY,
- self._searchCallback, source)
+ self._search_callback, source)
Grl.init(None)
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 790ce6a..3d9ea10 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -83,28 +83,28 @@ class Player(GObject.GObject):
self.bus.add_signal_watch()
self._settings = Gio.Settings.new('org.gnome.Music')
- self._settings.connect('changed::repeat', self._onSettingsChanged)
+ self._settings.connect('changed::repeat', self._on_settings_changed)
self.repeat = self._settings.get_enum('repeat')
#self._dbusImpl = Gio.DBusExportedObject.wrapJSObject(MediaPlayer2PlayerIface, self)
#self._dbusImpl.export(Gio.DBus.session, '/org/mpris/MediaPlayer2')
- self.bus.connect("message::state-changed", self._onBusStateChanged)
+ self.bus.connect("message::state-changed", self._on_bus_state_changed)
self.bus.connect("message::error", self._onBusError)
- self.bus.connect("message::eos", self._onBusEos)
- self._setupView()
+ self.bus.connect("message::eos", self._on_bus_eos)
+ self._setup_view()
- def _onSettingsChanged(self, settings, value):
+ def _on_settings_changed(self, settings, value):
self.repeat = settings.get_enum('repeat')
- self._syncPrevNext()
- self._syncRepeatImage()
+ self._sync_prev_next()
+ self._sync_repeat_image()
- def _onBusStateChanged(self, bus, message):
+ def _on_bus_state_changed(self, bus, message):
#Note: not all state changes are signaled through here, in particular
#transitions between Gst.State.READY and Gst.State.NULL are never async
#and thus don't cause a message
#In practice, self means only Gst.State.PLAYING and Gst.State.PAUSED are
- self._syncPlaying()
+ self._sync_playing()
self.emit('playing-changed')
def _onBusError(self, bus, message):
@@ -118,11 +118,11 @@ class Player(GObject.GObject):
self.stop()
return True
- def _onBusEos(self, bus, message):
- self.nextTrack = self._getNextTrack()
+ def _on_bus_eos(self, bus, message):
+ self.nextTrack = self._get_next_track()
if self.nextTrack:
- GLib.idle_add(self._onGLibIdle)
+ GLib.idle_add(self._on_glib_idle)
elif (self.repeat == RepeatType.NONE):
self.stop()
self.playBtn.set_image(self._playImage)
@@ -138,11 +138,11 @@ class Player(GObject.GObject):
self.progressScale.set_value(0)
self.progressScale.set_sensitive(False)
- def _onGLibIdle(self):
+ def _on_glib_idle(self):
self.currentTrack = self.nextTrack
self.play()
- def _getNextTrack(self):
+ def _get_next_track(self):
currentTrack = self.currentTrack
nextTrack = None
if self.repeat == RepeatType.SONG:
@@ -161,7 +161,7 @@ class Player(GObject.GObject):
return nextTrack
- def _getIterLast(self):
+ def _get_iter_last(self):
iter = self.playlist.get_iter_first()
last = None
@@ -171,7 +171,7 @@ class Player(GObject.GObject):
return last
- def _getPreviousTrack(self):
+ def _get_previous_track(self):
currentTrack = self.currentTrack
previousTrack = None
@@ -180,7 +180,7 @@ class Player(GObject.GObject):
elif self.repeat == RepeatType.ALL:
previousTrack = self.playlist.iter_previous(currentTrack)
if previousTrack is None:
- previousTrack = self._getIterLast()
+ previousTrack = self._get_iter_last()
elif self.repeat == RepeatType.NONE:
previousTrack = self.playlist.iter_previous(previousTrack)
elif self.repeat == RepeatType.SHUFFLE:
@@ -191,21 +191,21 @@ class Player(GObject.GObject):
return previousTrack
- def _hasNext(self):
+ def _has_next(self):
if self.repeat in [RepeatType.ALL, RepeatType.SONG, RepeatType.SHUFFLE]:
return True
else:
tmp = self.currentTrack.copy()
return self.playlist.iter_next(tmp) is not None
- def _hasPrevious(self):
+ def _has_previous(self):
if self.repeat in [RepeatType.ALL, RepeatType.SONG, RepeatType.SHUFFLE]:
return True
else:
tmp = self.currentTrack.copy()
return self.playlist.iter_previous(tmp) is not None
- def getPlaying(self):
+ def _get_playing(self):
ok, state, pending = self.player.get_state(0)
#log('get playing(), [ok, state, pending] = [%s, %s, %s]'.format(ok, state, pending))
if ok == Gst.StateChangeReturn.ASYNC:
@@ -215,14 +215,14 @@ class Player(GObject.GObject):
else:
return False
- def _syncPlaying(self):
- image = self._pauseImage if self.getPlaying() else self._playImage
+ def _sync_playing(self):
+ image = self._pauseImage if self._get_playing() else self._playImage
if self.playBtn.get_image() != image:
self.playBtn.set_image(image)
- def _syncPrevNext(self):
- hasNext = self._hasNext()
- hasPrevious = self._hasPrevious()
+ def _sync_prev_next(self):
+ hasNext = self._has_next()
+ hasPrevious = self._has_previous()
self.nextBtn.set_sensitive(hasNext)
self.prevBtn.set_sensitive(hasPrevious)
@@ -230,7 +230,7 @@ class Player(GObject.GObject):
#self._dbusImpl.emit_property_changed('CanGoNext', GLib.Variant.new('b', hasNext))
#self._dbusImpl.emit_property_changed('CanGoPrevious', GLib.Variant.new('b', hasPrevious))
- def setPlaying(self, value):
+ def set_playing(self, value):
self.eventBox.show()
if value:
@@ -243,15 +243,15 @@ class Player(GObject.GObject):
return media
def load(self, media):
- self._setDuration(media.get_duration())
- self.songTotalTimeLabel.label = self.secondsToString(media.get_duration())
+ self._set_duration(media.get_duration())
+ self.songTotalTimeLabel.label = self.seconds_to_string(media.get_duration())
self.progressScale.set_sensitive(True)
self.playBtn.set_sensitive(True)
- self._syncPrevNext()
+ self._sync_prev_next()
self.coverImg.set_from_pixbuf(self._symbolicIcon)
- self.cache.lookup(ART_SIZE, media.get_artist(), media.get_string(Grl.METADATA_KEY_ALBUM),
self._onCacheLookup)
+ self.cache.lookup(ART_SIZE, media.get_artist(), media.get_string(Grl.METADATA_KEY_ALBUM),
self._on_cache_lookup)
if media.get_title() is not None:
self.titleLabel.set_label(media.get_title())
@@ -273,7 +273,7 @@ class Player(GObject.GObject):
#Store next available url
#(not really useful because we can't connect to about-to-finish, but still)
- nextTrack = self._getNextTrack()
+ nextTrack = self._get_next_track()
if nextTrack:
nextMedia = self.playlist.get_value(self.currentTrack, self.playlistField)
@@ -288,7 +288,7 @@ class Player(GObject.GObject):
self.emit("playlist-item-changed", self.playlist, self.currentTrack)
self.emit('current-changed')
- def _onCacheLookup(self, pixbuf, path):
+ def _on_cache_lookup(self, pixbuf, path):
if pixbuf is not None:
self.coverImg.set_from_pixbuf(pixbuf)
@@ -302,9 +302,9 @@ class Player(GObject.GObject):
self.load(self.playlist.get_value(self.currentTrack, self.playlistField))
self.player.set_state(Gst.State.PLAYING)
- self._updatePositionCallback()
+ self._update_position_callback()
if not self.timeout:
- self.timeout = GLib.timeout_add(1000, self._updatePositionCallback)
+ self.timeout = GLib.timeout_add(1000, self._update_position_callback)
#self._dbusImpl.emit_property_changed('PlaybackStatus', GLib.Variant.new('s', 'Playing'))
@@ -326,7 +326,7 @@ class Player(GObject.GObject):
#self._dbusImpl.emit_property_changed('PlaybackStatus', GLib.Variant.new('s', 'Stopped'))
self.emit('playing-changed')
- def playNext(self):
+ def play_next(self):
if self.playlist is None:
return True
@@ -334,12 +334,12 @@ class Player(GObject.GObject):
return True
self.stop()
- self.currentTrack = self._getNextTrack()
+ self.currentTrack = self._get_next_track()
if self.currentTrack:
self.play()
- def playPrevious(self):
+ def play_previous(self):
if self.playlist is None:
return
@@ -347,12 +347,12 @@ class Player(GObject.GObject):
return
self.stop()
- self.currentTrack = self._getPreviousTrack()
+ self.currentTrack = self._get_previous_track()
if self.currentTrack:
self.play()
- def setPlaylist(self, type, id, model, iter, field):
+ def set_playlist(self, type, id, model, iter, field):
self.stop()
self.playlist = model
@@ -362,13 +362,13 @@ class Player(GObject.GObject):
self.playlistField = field
self.emit('current-changed')
- def runningPlaylist(self, type, id):
+ def running_playlist(self, type, id):
if type == self.playlistType and id == self.playlistId:
return self.playlist
else:
return None
- def _setupView(self):
+ def _setup_view(self):
self._ui = Gtk.Builder()
self._ui.add_from_resource('/org/gnome/music/PlayerToolbar.ui')
self.eventBox = self._ui.get_object('eventBox')
@@ -393,28 +393,28 @@ class Player(GObject.GObject):
self._playImage.modify_fg(Gtk.StateType.ACTIVE, color)
self._pauseImage.modify_fg(Gtk.StateType.ACTIVE, color)
- self._syncRepeatImage()
+ self._sync_repeat_image()
- self.prevBtn.connect("clicked", self._onPrevBtnClicked)
- self.playBtn.connect("clicked", self._onPlayBtnClicked)
- self.nextBtn.connect("clicked", self._onNextBtnClicked)
- self.progressScale.connect("button-press-event", self._onProgressScaleEvent)
- self.progressScale.connect("value-changed", self._onProgressValueChanged)
- self.progressScale.connect("button-release-event", self._onProgressScaleButtonReleased)
+ self.prevBtn.connect("clicked", self._on_prev_btn_clicked)
+ self.playBtn.connect("clicked", self._on_play_btn_clicked)
+ self.nextBtn.connect("clicked", self._on_next_btn_clicked)
+ self.progressScale.connect("button-press-event", self._on_progress_scale_event)
+ self.progressScale.connect("value-changed", self._on_progress_value_changed)
+ self.progressScale.connect("button-release-event", self._on_progress_scale_button_released)
- def _onProgressScaleButtonReleased(self, scale, data):
- self.onProgressScaleChangeValue(self.progressScale)
- self._updatePositionCallback()
+ def _on_progress_scale_button_released(self, scale, data):
+ self.on_progress_scale_change_value(self.progressScale)
+ self._update_position_callback()
self.player.set_state(self._lastState)
- self.timeout = GLib.timeout_add(1000, self._updatePositionCallback)
+ self.timeout = GLib.timeout_add(1000, self._update_position_callback)
return False
- def _onProgressValueChanged(self, widget):
+ def _on_progress_value_changed(self, widget):
seconds = int(self.progressScale.get_value() / 60)
- self.songPlaybackTimeLabel.set_label(self.secondsToString(seconds))
+ self.songPlaybackTimeLabel.set_label(self.seconds_to_string(seconds))
return False
- def _onProgressScaleEvent(self, scale, data):
+ def _on_progress_scale_event(self, scale, data):
self._lastState = self.player.get_state(1)[1]
self.player.set_state(Gst.State.PAUSED)
if self.timeout:
@@ -422,7 +422,7 @@ class Player(GObject.GObject):
self.timeout = None
return False
- def secondsToString(self, duration):
+ def seconds_to_string(self, duration):
minutes = int(duration / 60) % 60
seconds = duration % 60
@@ -431,29 +431,29 @@ class Player(GObject.GObject):
else:
return "%s:%s" % (minutes, seconds)
- def _onPlayBtnClicked(self, btn):
- if self.getPlaying():
+ def _on_play_btn_clicked(self, btn):
+ if self._get_playing():
self.pause()
else:
self.play()
- def _onNextBtnClicked(self, btn):
- self.playNext()
+ def _on_next_btn_clicked(self, btn):
+ self.play_next()
- def _onPrevBtnClicked(self, btn):
- self.playPrevious()
+ def _on_prev_btn_clicked(self, btn):
+ self.play_previous()
- def _setDuration(self, duration):
+ def _set_duration(self, duration):
self.duration = duration
self.progressScale.set_range(0.0, duration * 60)
- def _updatePositionCallback(self):
+ def _update_position_callback(self):
position = self.player.query_position(Gst.Format.TIME)[1] / 1000000000
if position >= 0:
self.progressScale.set_value(position * 60)
return True
- def _syncRepeatImage(self):
+ def _sync_repeat_image(self):
icon = None
if self.repeat == RepeatType.NONE:
icon = 'media-playlist-consecutive-symbolic'
@@ -468,7 +468,7 @@ class Player(GObject.GObject):
#self._dbusImpl.emit_property_changed('LoopStatus', GLib.Variant.new('s', self.LoopStatus))
#self._dbusImpl.emit_property_changed('Shuffle', GLib.Variant.new('b', self.Shuffle))
- def onProgressScaleChangeValue(self, scroll):
+ def on_progress_scale_change_value(self, scroll):
seconds = scroll.get_value() / 60
if seconds != self.duration:
self.player.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, seconds *
1000000000)
@@ -484,22 +484,22 @@ class Player(GObject.GObject):
#MPRIS
def Next(self):
- self.playNext()
+ self.play_next()
def Previous(self):
- self.playPrevious()
+ self.play_previous()
def Pause(self):
- self.setPlaying(False)
+ self.set_playing(False)
def PlayPause(self):
if self.player.get_state(1)[1] == Gst.State.PLAYING:
- self.setPlaying(False)
+ self.set_playing(False)
else:
- self.setPlaying(True)
+ self.set_playing(True)
def Play(self):
- self.setPlaying(True)
+ self.set_playing(True)
def Stop(self):
self.progressScale.set_value(0)
@@ -521,7 +521,7 @@ class Player(GObject.GObject):
self.player.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, offset *
1000)
#self._dbusImpl.emit_signal('Seeked', GLib.Variant.new('(x)', [offset]))
else:
- self.playNext()
+ self.play_next()
def SetPositionAsync(self, params, invocation):
trackId, position = params
@@ -542,7 +542,7 @@ class Player(GObject.GObject):
uri = params
return uri
- def getPlaybackStatus(self):
+ def get_playback_status(self):
ok, state, pending = self.player.get_state(0)
if ok == Gst.StateChangeReturn.ASYNC:
state = pending
@@ -556,7 +556,7 @@ class Player(GObject.GObject):
else:
return 'Stopped'
- def getLoopStatus(self):
+ def get_loop_status(self):
if self.repeat == RepeatType.NONE:
return 'None'
elif self.repeat == RepeatType.SONG:
@@ -564,32 +564,32 @@ class Player(GObject.GObject):
else:
return 'Playlist'
- def setLoopStatus(self, mode):
+ def set_loop_status(self, mode):
if mode == 'None':
self.repeat = RepeatType.NONE
elif mode == 'Track':
self.repeat = RepeatType.SONG
elif mode == 'Playlist':
self.repeat = RepeatType.ALL
- self._syncRepeatImage()
+ self._sync_repeat_image()
- def getRate(self):
+ def get_rate(self):
return 1.0
- def setRate(self, rate):
+ def set_rate(self, rate):
pass
- def getShuffle(self):
+ def get_shuffle(self):
return self.repeat == RepeatType.SHUFFLE
- def setShuffle(self, enable):
+ def set_shuffle(self, enable):
if (enable and self.repeat != RepeatType.SHUFFLE):
self.repeat = RepeatType.SHUFFLE
elif enable is not None and self.repeat == RepeatType.SHUFFLE:
self.repeat = RepeatType.NONE
- self._syncRepeatImage()
+ self._sync_repeat_image()
- def getMetadata(self):
+ def get_metadata(self):
if self.currentTrack is None:
return
@@ -630,38 +630,38 @@ class Player(GObject.GObject):
return metadata
- def getVolume(self):
+ def get_volume(self):
return self.player.get_volume(GstAudio.StreamVolumeFormat.LINEAR)
- def setVolume(self, rate):
+ def set_volume(self, rate):
self.player.set_volume(GstAudio.StreamVolumeFormat.LINEAR, rate)
#self._dbusImpl.emit_property_changed('Volume', GLib.Variant.new('d', rate))
- def getPosition(self):
+ def get_position(self):
return self.player.query_position(Gst.Format.TIME, None)[1] / 1000
- def getMinimumRate(self):
+ def get_minimum_rate(self):
return 1.0
- def getMaximumRate(self):
+ def get_maximum_rate(self):
return 1.0
- def getCanGoNext(self):
- return self._hasNext()
+ def get_can_go_next(self):
+ return self._has_next()
- def getCanGoPrevious(self):
- return self._hasPrevious()
+ def get_can_go_previous(self):
+ return self._has_previous()
- def getCanPlay(self):
+ def get_can_play(self):
return self.currentTrack is not None
- def getCanPause(self):
+ def get_can_pause(self):
return self.currentTrack is not None
- def getCanSeek(self):
+ def get_can_seek(self):
return True
- def getCanControl(self):
+ def get_can_control(self):
return True
diff --git a/gnomemusic/toolbar.py b/gnomemusic/toolbar.py
index 81081de..123d5dd 100644
--- a/gnomemusic/toolbar.py
+++ b/gnomemusic/toolbar.py
@@ -32,10 +32,10 @@ class Toolbar(GObject.GObject):
self._selectionMenuButton.set_relief(Gtk.ReliefStyle.NONE)
self.header_bar.set_custom_title(self._stackSwitcher)
self._searchButton = self._ui.get_object("search-button")
- self._backButton.connect('clicked', self.setState)
- self._closeButton.connect('clicked', self._closeButtonClicked)
+ self._backButton.connect('clicked', self.set_state)
+ self._closeButton.connect('clicked', self._close_button_clicked)
- def _closeButtonClicked(self, btn):
+ def _close_button_clicked(self, btn):
self._closeButton.get_toplevel().close()
def set_stack(self, stack):
@@ -44,7 +44,7 @@ class Toolbar(GObject.GObject):
def get_stack(self):
return self._stackSwitcher.get_stack()
- def setSelectionMode(self, selectionMode):
+ def set_selection_mode(self, selectionMode):
self._selectionMode = selectionMode
if selectionMode:
self._selectButton.hide()
@@ -58,7 +58,7 @@ class Toolbar(GObject.GObject):
self._cancelButton.hide()
self._update()
- def setState(self, state, btn=None):
+ def set_state(self, state, btn=None):
self._state = state
self._update()
self.emit('state-changed')
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 64a95cc..21e5e09 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -59,14 +59,14 @@ class ViewContainer(Gtk.Stack):
else:
self._grid.add(box)
- self._loadMore = Widgets.LoadMoreButton(self._getRemainingItemCount)
+ self._loadMore = Widgets.LoadMoreButton(self._get_remaining_item_count)
box.pack_end(self._loadMore.widget, False, False, 0)
self._loadMore.widget.connect("clicked", self._populate)
self.view.connect('item-activated', self._on_item_activated)
self._cursor = None
self.header_bar = header_bar
- self.header_bar._selectButton.connect('toggled', self._onHeaderBarToggled)
- self.header_bar._cancelButton.connect('clicked', self._onCancelButtonClicked)
+ self.header_bar._selectButton.connect('toggled', self._on_header_bar_toggled)
+ self.header_bar._cancelButton.connect('clicked', self._on_cancel_button_clicked)
self.title = title
self.add(self._grid)
@@ -74,40 +74,40 @@ class ViewContainer(Gtk.Stack):
self.show_all()
self._items = []
self._loadMore.widget.hide()
- self._connectView()
+ self._connect_view()
self.cache = albumArtCache.get_default()
self._symbolicIcon = self.cache.make_default_icon(self._iconHeight, self._iconWidth)
self._init = False
- grilo.connect('ready', self._onGriloReady)
+ grilo.connect('ready', self._on_grilo_ready)
self.header_bar.header_bar.connect('state-changed', self._on_state_changed)
- self.view.connect('view-selection-changed', self._onViewSelectionChanged)
+ self.view.connect('view-selection-changed', self._on_view_selection_changed)
- def _onHeaderBarToggled(self, button):
+ def _on_header_bar_toggled(self, button):
if button.get_active():
self.view.set_selection_mode(True)
- self.header_bar.setSelectionMode(True)
+ self.header_bar.set_selection_mode(True)
self.selection_toolbar.eventbox.set_visible(True)
self.selection_toolbar._add_to_playlist_button.sensitive = False
else:
self.view.set_selection_mode(False)
- self.header_bar.setSelectionMode(False)
+ self.header_bar.set_selection_mode(False)
self.selection_toolbar.eventbox.set_visible(False)
- def _onCancelButtonClicked(self, button):
+ def _on_cancel_button_clicked(self, button):
self.view.set_selection_mode(False)
- self.header_bar.setSelectionMode(False)
+ self.header_bar.set_selection_mode(False)
- def _onGriloReady(self, data=None):
+ def _on_grilo_ready(self, data=None):
if (self.header_bar.get_stack().get_visible_child() == self and self._init is False):
self._populate()
- self.header_bar.get_stack().connect('notify::visible-child', self._onHeaderBarVisible)
+ self.header_bar.get_stack().connect('notify::visible-child', self._on_header_bar_visible)
- def _onHeaderBarVisible(self, widget, param):
+ def _on_header_bar_visible(self, widget, param):
if self == widget.get_visible_child() and self._init:
self._populate()
- def _onViewSelectionChanged(self):
+ def _on_view_selection_changed(self):
items = self.view.get_selection()
self.selection_toolbar._add_to_playlist_button.sensitive = items.length > 0
@@ -118,13 +118,13 @@ class ViewContainer(Gtk.Stack):
def _on_state_changed(self, widget, data=None):
pass
- def _connectView(self):
+ def _connect_view(self):
vadjustment = self.view.get_vadjustment()
self._adjustmentValueId = vadjustment.connect(
'value-changed',
- self._onScrolledWinChange)
+ self._on_scrolled_win_change)
- def _onScrolledWinChange(self, data=None):
+ def _on_scrolled_win_change(self, data=None):
vScrollbar = self.view.get_vscrollbar()
adjustment = self.view.get_vadjustment()
revealAreaHeight = 32
@@ -144,7 +144,7 @@ class ViewContainer(Gtk.Stack):
end = False
else:
end = not (value < (upper - page_size - revealAreaHeight))
- if self._getRemainingItemCount() <= 0:
+ if self._get_remaining_item_count() <= 0:
end = False
self._loadMore.setBlock(not end)
@@ -173,9 +173,9 @@ class ViewContainer(Gtk.Stack):
self._model.set(iter,
[0, 1, 2, 3, 4, 5, 7, 8, 9, 10],
[str(item.get_id()), "", item.get_title(), artist, self._symbolicIcon, item,
-1, self.errorIconName, False, True])
- GLib.idle_add(self._updateAlbumArt, item, iter)
+ GLib.idle_add(self._update_album_art, item, iter)
- def _getRemainingItemCount(self):
+ def _get_remaining_item_count(self):
count = -1
if self.countQuery is not None:
cursor = tracker.query(self.countQuery, None)
@@ -183,7 +183,7 @@ class ViewContainer(Gtk.Stack):
count = cursor.get_integer(0)
return count - self._offset
- def _updateAlbumArt(self, item, iter):
+ def _update_album_art(self, item, iter):
def _album_art_cache_look_up(icon, data=None):
if icon:
self._model.set_value(iter, 4,
@@ -236,7 +236,7 @@ class Albums(ViewContainer):
artist = self._model.get_value(iter, 3)
item = self._model.get_value(iter, 5)
self._albumWidget.update(artist, title, item, self.header_bar, self.selection_toolbar)
- self.header_bar.setState(0)
+ self.header_bar.set_state(0)
self.header_bar.header_bar.title = title
self.header_bar.header_bar.set_title(title)
self.header_bar.header_bar.sub_title = artist
@@ -267,8 +267,8 @@ class Songs(ViewContainer):
def _on_item_activated(self, widget, id, path):
iter = self._model.get_iter(path)[1]
if self._model.get_value(iter, 8) != self.errorIconName:
- self.player.setPlaylist("Songs", None, self._model, iter, 5)
- self.player.setPlaying(True)
+ self.player.set_playlist("Songs", None, self._model, iter, 5)
+ self.player.set_playing(True)
def update_model(self, player, playlist, currentIter):
if playlist != self._model:
@@ -313,12 +313,12 @@ class Songs(ViewContainer):
listWidget.insert_column(columnNowPlaying, 0)
titleRenderer = Gtk.CellRendererText(xpad=0)
- listWidget.add_renderer(titleRenderer, self._onListWidgetTitleRender, None)
+ listWidget.add_renderer(titleRenderer, self._on_list_widget_title_render, None)
starRenderer = Gtk.CellRendererPixbuf(xpad=32)
- listWidget.add_renderer(starRenderer, self._onListWidgetStarRender, None)
+ listWidget.add_renderer(starRenderer, self._on_list_widget_star_render, None)
durationRenderer = Gd.StyledTextRenderer(xpad=32)
durationRenderer.add_class('dim-label')
- listWidget.add_renderer(durationRenderer, self._onListWidgetDurationRender, None)
+ listWidget.add_renderer(durationRenderer, self._on_list_widget_duration_render, None)
artistRenderer = Gd.StyledTextRenderer(xpad=32)
artistRenderer.add_class('dim-label')
artistRenderer.ellipsize = Pango.EllipsizeMode.END
@@ -328,7 +328,7 @@ class Songs(ViewContainer):
typeRenderer.ellipsize = Pango.EllipsizeMode.END
listWidget.add_renderer(typeRenderer, self._onListWidgetTypeRender, None)
- def _onListWidgetTitleRender(self, col, cell, model, iter):
+ def _on_list_widget_title_render(self, col, cell, model, iter):
item = model.get_value(iter, 5)
self.xalign = 0.0
self.yalign = 0.5
@@ -336,14 +336,14 @@ class Songs(ViewContainer):
self.ellipsize = Pango.EllipsizeMode.END
self.text = item.get_title()
- def _onListWidgetStarRender(self, col, cell, model, iter):
+ def _on_list_widget_star_render(self, col, cell, model, iter):
showstar = model.get_value(iter, 9)
if(showstar):
self.icon_name = self.starIconName
else:
self.pixbuf = None
- def _onListWidgetDurationRender(self, col, cell, model, iter):
+ def _on_list_widget_duration_render(self, col, cell, model, iter):
item = model.get_value(iter, 5)
if item:
duration = item.get_duration()
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index c539edd..f537899 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -112,8 +112,8 @@ class AlbumWidget(Gtk.EventBox):
self.model.set_value(self.iterToClean, 0, item.get_title())
#Hide now playing icon
self.model.set_value(self.iterToClean, 6, False)
- self.player.setPlaylist("Album", self.album, self.model, iter, 5)
- self.player.setPlaying(True)
+ self.player.set_playlist("Album", self.album, self.model, iter, 5)
+ self.player.set_playing(True)
def _add_list_renderers(self):
list_widget = self.view.get_generic_view()
@@ -157,7 +157,7 @@ class AlbumWidget(Gtk.EventBox):
duration = item.get_duration()
if item is None:
return
- widget.text = self.player.secondsToString(duration)
+ widget.text = self.player.seconds_to_string(duration)
def update(self, artist, album, item, header_bar, selection_toolbar):
released_date = item.get_publication_date()
@@ -172,7 +172,7 @@ class AlbumWidget(Gtk.EventBox):
# if the active queue has been set by self album,
# use it as model, otherwise build the liststore
- cached_playlist = self.player.runningPlaylist("Album", album)
+ cached_playlist = self.player.running_playlist("Album", album)
if cached_playlist is not None:
self.model = cached_playlist
self.update_model(self.player, cached_playlist,
@@ -212,19 +212,19 @@ class AlbumWidget(Gtk.EventBox):
def _on_header_cancel_button_clicked(self, button):
self.view.set_selection_mode(False)
- self.header_bar.setSelectionMode(False)
+ self.header_bar.set_selection_mode(False)
self.header_bar.header_bar.title = self.album
def _on_header_select_button_toggled(self, button):
if(button.get_active()):
self.view.set_selection_mode(True)
- self.header_bar.setSelectionMode(True)
+ self.header_bar.set_selection_mode(True)
self.player.eventBox.set_visible(False)
self.selection_toolbar.eventbox.set_visible(True)
self.selection_toolbar._add_to_playlist_button.sensitive = False
else:
self.view.set_selection_mode(False)
- self.header_bar.setSelectionMode(False)
+ self.header_bar.set_selection_mode(False)
self.header_bar.title = self.album
self.selection_toolbar.eventbox.set_visible(False)
if(self.player.PlaybackStatus != 'Stopped'):
@@ -325,13 +325,13 @@ class ArtistAlbums(Gtk.VBox):
self.pack_start(self._scrolledWindow, True, True, 0)
for i in albums.length:
- self.addAlbum(albums[i])
+ self.add_album(albums[i])
self.show_all()
self.player.connect('playlist-item-changed', self.update_model)
self.emit("albums-loaded")
- def addAlbum(self, album):
+ def add_album(self, album):
widget = ArtistAlbumWidget(self.artist, album, self.player, self.model)
self._albumBox.pack_start(widget, False, False, 0)
self.widgets.append(widget)
@@ -359,18 +359,18 @@ class AllArtistsAlbums(ArtistAlbums):
self._load_more = LoadMoreButton(self, self._get_remaining_item_count)
self.pack_end(self._load_more.widget, False, False, 0)
self._load_more.widget.connect("clicked", self._populate)
- self._connectView()
+ self._connect_view()
self._populate()
- def _connectView(self):
+ def _connect_view(self):
self._adjustmentValueId = self._scrolledWindow.vadjustment.connect(
- 'value-changed', self._onScrolledWinChange)
+ 'value-changed', self._on_scrolled_win_change)
self._adjustmentChangedId = self._scrolledWindow.vadjustment.connect(
- 'changed', self._onScrolledWinChange)
- self._scrollbarVisibleId = self._scrolledWindow.get_vscrollbar().connect('notify::visible',
self._onScrolledWinChange)
- self._onScrolledWinChange()
+ 'changed', self._on_scrolled_win_change)
+ self._scrollbarVisibleId = self._scrolledWindow.get_vscrollbar().connect('notify::visible',
self._on_scrolled_win_change)
+ self._on_scrolled_win_change()
- def _onScrolledWinChange(self, data=None):
+ def _on_scrolled_win_change(self, data=None):
vScrollbar = self._scrolledWindow.get_vscrollbar()
adjustment = self._scrolledWindow.vadjustment
revealAreaHeight = 32
@@ -395,12 +395,12 @@ class AllArtistsAlbums(ArtistAlbums):
def _populate(self):
if grilo.tracker is not None:
- grilo.populate_albums(self._offset, self.addItem, 5)
+ grilo.populate_albums(self._offset, self.add_item, 5)
- def addItem(self, source, param, item, remaining):
+ def add_item(self, source, param, item, remaining):
if item is not None:
self._offset = self.offset + 1
- self.addAlbum(item)
+ self.add_album(item)
def _get_remaining_item_count(self):
count = -1
@@ -426,7 +426,7 @@ class ArtistAlbumWidget(Gtk.HBox):
self.cache = AlbumArtCache.get_default()
pixbuf = self.cache.make_default_icon(128, 128)
- GLib.idle_add(self._updateAlbumArt)
+ GLib.idle_add(self._update_album_art)
self.ui.get_object("cover").set_from_pixbuf(pixbuf)
self.ui.get_object("title").set_label(album.get_title())
@@ -483,7 +483,7 @@ class ArtistAlbumWidget(Gtk.HBox):
song_widget.nowPlayingSign.set_alignment(0.0, 0.6)
song_widget.can_be_played = True
song_widget.connect('button-release-event',
- self.trackSelected)
+ self.track_selected)
except IOError as err:
print(err.message)
@@ -500,7 +500,7 @@ class ArtistAlbumWidget(Gtk.HBox):
self.ui.get_object("grid1").show_all()
self.emit("tracks-loaded")
- def _updateAlbumArt(self):
+ def _update_album_art(self):
ALBUM_ART_CACHE.lookup(128, self.artist,
self.album.get_title(), self.get_album_cover)
@@ -513,20 +513,20 @@ class ArtistAlbumWidget(Gtk.HBox):
| Grl.ResolutionFlags.IDLE_RELAY)
grilo.tracker.resolve(self.album,
[Grl.METADATA_KEY_THUMBNAIL],
- options, self.loadCover)
+ options, self.load_cover)
- def loadCover(self, source, param, item):
+ def load_cover(self, source, param, item):
uri = self.album.get_thumbnail()
ALBUM_ART_CACHE.getFromUri(uri, self.artist,
self.album.get_title(), 128, 128,
- self.getCover)
+ self.get_cover)
- def getCover(self, pixbuf):
+ def get_cover(self, pixbuf):
pixbuf = ALBUM_ART_CACHE.makeIconFrame(pixbuf)
self.ui.get_object("cover").set_from_pixbuf(pixbuf)
- def trackSelected(self, widget, iter):
+ def track_selected(self, widget, iter):
self.player.stop()
- self.player.setPlaylist("Artist", self.album,
+ self.player.set_playlist("Artist", self.album,
widget.model, widget.iter, 5)
- self.player.setPlaying(True)
+ self.player.set_playing(True)
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 3354485..184d80f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -17,7 +17,7 @@ class Window(Gtk.ApplicationWindow):
settings = Gio.Settings.new('org.gnome.Music')
self.add_action(settings.create_action('repeat'))
self.set_size_request(887, 640)
- self._setupView()
+ self._setup_view()
self.proxy = Gio.DBusProxy.new_sync(Gio.bus_get_sync(Gio.BusType.SESSION, None),
Gio.DBusProxyFlags.NONE,
None,
@@ -30,16 +30,16 @@ class Window(Gtk.ApplicationWindow):
Gio.DBusCallFlags.NONE,
-1,
None)
- self.proxy.connect('g-signal', self._handleMediaKeys)
+ self.proxy.connect('g-signal', self._handle_media_keys)
- def _windowsFocusCb(self, window, event):
+ def _windows_focus_cb(self, window, event):
self.proxy.call_sync('GrabMediaPlayerKeys',
GLib.Variant('(su)', ('Music', 0)),
Gio.DBusCallFlags.NONE,
-1,
None)
- def _handleMediaKeys(self, proxy, sender, signal, parameters):
+ def _handle_media_keys(self, proxy, sender, signal, parameters):
if signal != 'MediaPlayerKeyPressed':
print('Received an unexpected signal \'%s\' from media player'.format(signal))
return
@@ -54,7 +54,7 @@ class Window(Gtk.ApplicationWindow):
elif key == 'Previous':
self.player.Previous()
- def _setupView(self):
+ def _setup_view(self):
self._box = Gtk.VBox()
self.player = Player()
self.selection_toolbar = SelectionToolbar()
@@ -93,7 +93,7 @@ class Window(Gtk.ApplicationWindow):
self.views[0] = Views.Empty(self.toolbar, self.player)
self._stack.add_titled(self.views[0], "Empty", "Empty")
- self.toolbar.setState(ToolbarState.ALBUMS)
+ self.toolbar.set_state(ToolbarState.ALBUMS)
self.toolbar.header_bar.show()
self.player.eventBox.show_all()
self._box.show()
@@ -108,5 +108,5 @@ class Window(Gtk.ApplicationWindow):
stack.get_visible_child().stack.set_visible_child_name("dummy")
stack.get_visible_child().stack.set_visible_child_name("artists")
- def _toggleView(self, btn, i):
+ def _toggle_view(self, btn, i):
self._stack.set_visible_child(self.views[i])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]