[gnome-music] pep8 fixes
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] pep8 fixes
- Date: Sat, 28 Feb 2015 16:37:11 +0000 (UTC)
commit 936adee6acc85f1b226c848d008b3d42ff4f31eb
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Sat Feb 28 17:04:23 2015 +0100
pep8 fixes
gnomemusic/__init__.py | 6 +++++-
gnomemusic/grilo.py | 4 ++--
gnomemusic/player.py | 2 ++
gnomemusic/playlists.py | 2 +-
gnomemusic/query.py | 11 ++++++-----
gnomemusic/view.py | 12 ++++++------
gnomemusic/widgets.py | 3 ++-
gnomemusic/window.py | 2 +-
8 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/gnomemusic/__init__.py b/gnomemusic/__init__.py
index 6a84a00..a4eb16e 100644
--- a/gnomemusic/__init__.py
+++ b/gnomemusic/__init__.py
@@ -49,6 +49,7 @@ def log(fn):
return retval
return wrapped
+
class TrackerWrapper:
class __TrackerWrapper:
def __init__(self):
@@ -58,11 +59,14 @@ class TrackerWrapper:
from sys import exit
logger.error("Cannot connect to tracker, error '%s'\Exiting" % str(e))
exit(1)
+
def __str__(self):
return repr(self)
instance = None
+
def __init__(self):
if not TrackerWrapper.instance:
TrackerWrapper.instance = TrackerWrapper.__TrackerWrapper()
+
def __getattr__(self, name):
- return getattr(self.instance, name)
\ No newline at end of file
+ return getattr(self.instance, name)
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 83e97a4..8280c53 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -222,10 +222,10 @@ class Grilo(GObject.GObject):
def toggle_favorite(self, song_item):
# TODO: change "bool(song_item.get_lyrics())" --> song_item.get_favourite() once query works properly
# TODO: when .set/get_favourite work, set_favourite outside loop:
item.set_favourite(!item.get_favourite())
- if bool(song_item.get_lyrics()): # is favorite
+ if bool(song_item.get_lyrics()): # is favorite
self.sparqltracker.update(Query.remove_favorite(song_item.get_url()), GLib.PRIORITY_DEFAULT,
None)
song_item.set_lyrics("")
- else: # not favorite
+ else: # not favorite
self.sparqltracker.update(Query.add_favorite(song_item.get_url()), GLib.PRIORITY_DEFAULT, None)
song_item.set_lyrics("i'm truthy")
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 7169681..cf59d8f 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -61,11 +61,13 @@ class PlaybackStatus:
PAUSED = 1
STOPPED = 2
+
class DiscoveryStatus:
PENDING = 0
FAILED = 1
SUCCEEDED = 2
+
class Player(GObject.GObject):
nextTrack = None
timeout = None
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index d9143d8..6522935 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -79,7 +79,7 @@ class StaticPlaylists:
@classmethod
def get_protected_ids(self):
return [str(cls.ID) for name, cls in inspect.getmembers(StaticPlaylists)
- if inspect.isclass(cls) and not (name == "__class__")]
+ if inspect.isclass(cls) and not (name == "__class__")]
class Playlists(GObject.GObject):
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 992f26b..793799f 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -587,8 +587,7 @@ class Query():
nfo:listPosition(?entry)
'''.replace('\n', ' ').strip() % {
'playlist_id': playlist_id,
- 'filter_clause':
- filter_clause or 'tracker:id(?playlist) = ' + playlist_id,
+ 'filter_clause': filter_clause or 'tracker:id(?playlist) = ' + playlist_id,
'music_dir': Query.MUSIC_URI,
'download_dir': Query.DOWNLOAD_URI
}
@@ -1027,9 +1026,11 @@ class Query():
#TODO: or this could take comparison date as an argument so we don't need to make a date string in
query.py...
#TODO: set time interval somewhere? A settings file? (Default is maybe 2 weeks...?)
- days_difference = 7 # currently hardcoding time interval of 7 days
+ days_difference = 7 # currently hardcoding time interval of 7 days
seconds_difference = days_difference * SECONDS_PER_DAY
- compare_date = time.strftime(sparql_midnight_dateTime_format,
time.gmtime(time.time()-seconds_difference))
+ compare_date = time.strftime(
+ sparql_midnight_dateTime_format,
+ time.gmtime(time.time() - seconds_difference))
query = """
SELECT ?url
@@ -1349,4 +1350,4 @@ class Query():
'song_url': song_url
}
- return query
\ No newline at end of file
+ return query
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index df96417..94566e1 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -168,8 +168,7 @@ class ViewContainer(Gtk.Stack):
@log
def _on_grilo_ready(self, data=None):
- if (self.header_bar.get_stack().get_visible_child() == self
- and not self._init):
+ if (self.header_bar.get_stack().get_visible_child() == self and not self._init):
self._populate()
self.header_bar.get_stack().connect('notify::visible-child',
self._on_headerbar_visible)
@@ -226,10 +225,10 @@ class ViewContainer(Gtk.Stack):
def add_new_item():
_iter = self.model.append(None)
self.model.set(_iter,
- [0, 1, 2, 3, 4, 5, 7, 9],
- [str(item.get_id()), '', title,
- artist, self._loadingIcon, item,
- 0, False])
+ [0, 1, 2, 3, 4, 5, 7, 9],
+ [str(item.get_id()), '', title,
+ artist, self._loadingIcon, item,
+ 0, False])
self.cache.lookup(item, self._iconWidth, self._iconHeight, self._on_lookup_ready,
_iter, artist, title)
GLib.idle_add(add_new_item)
@@ -259,6 +258,7 @@ class ViewContainer(Gtk.Stack):
def _on_list_widget_star_render(self, col, cell, model, _iter, data):
pass
+
# Class for the Empty View
class Empty(Gtk.Stack):
@log
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index abd6335..aa72978 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -81,12 +81,13 @@ class StarHandler():
new_value = not self.parent.model.get_value(_iter, self.star_index)
self.parent.model.set_value(_iter, self.star_index, new_value)
song_item = self.parent.model.get_value(_iter, 5)
- grilo.toggle_favorite(song_item) # toggle favorite status in database
+ grilo.toggle_favorite(song_item) # toggle favorite status in database
playlists.update_static_playlist(StaticPlaylists.Favorites)
# Use this flag to ignore the upcoming _on_item_activated call
self.star_renderer_click = True
+
class AlbumWidget(Gtk.EventBox):
tracks = []
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 7ca1570..d1596d8 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -328,7 +328,7 @@ class Window(Gtk.ApplicationWindow):
self.notification.add(grid)
undo_button = Gtk.Button.new_with_mnemonic(_("_Undo"))
- label = _("Playlist %s removed" %(
+ label = _("Playlist %s removed" % (
self.views[3].current_playlist.get_title()))
grid.add(Gtk.Label.new(label))
grid.add(undo_button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]