[gnome-music] make pep8 happy



commit 84e8e2cf0089d05c1c5c9ebf1a7dae880d6afb42
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon May 12 11:48:47 2014 +0200

    make pep8 happy

 gnomemusic/grilo.py   |    6 +++---
 gnomemusic/query.py   |    2 --
 gnomemusic/view.py    |   20 +++++++++++---------
 gnomemusic/widgets.py |    4 ++--
 gnomemusic/window.py  |    1 -
 5 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 79068fc..62a6f85 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -149,8 +149,8 @@ class Grilo(GObject.GObject):
                 self.sources[id] = mediaSource
                 self.emit('new-source-added', mediaSource)
 
-            elif (id not in self.blacklist) and (ops & Grl.SupportedOps.SEARCH)\
-             and (mediaSource.get_supported_media() & Grl.MediaType.AUDIO):
+            elif (id not in self.blacklist) and (ops & Grl.SupportedOps.SEARCH) and \
+                 (mediaSource.get_supported_media() & Grl.MediaType.AUDIO):
                 logger.debug("source %s is searchable" % id)
                 self.sources[id] = mediaSource
                 self.emit('new-source-added', mediaSource)
@@ -182,7 +182,7 @@ class Grilo(GObject.GObject):
             source = self.sources[album.get_source()]
             length = len(album.tracks)
             for i, track in enumerate(album.tracks):
-                callback(source, None, track, length-(i+1), None)
+                callback(source, None, track, length - (i + 1), None)
             callback(source, None, None, 0, None)
 
     @log
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 8c4510b..a3ab7cb 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -304,7 +304,6 @@ class Query():
 
         return query
 
-
     @staticmethod
     def album_songs(album_id):
         query = '''
@@ -425,7 +424,6 @@ class Query():
     '''.replace('\n', ' ').strip() % {'url': url}
         return query
 
-
     #Functions for search
     # TODO: make those queries actualyl return something
     @staticmethod
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 17464ab..2190eaf 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1237,7 +1237,7 @@ class Search(ViewContainer):
                 child_iter = self.songs_model.convert_child_iter_to_iter(_iter)[1]
                 self.player.set_playlist('Search Results', None, self.songs_model, child_iter, 5)
                 self.player.set_playing(True)
-        else: # Headers
+        else:  # Headers
             if self.view.get_generic_view().row_expanded(path):
                 self.view.get_generic_view().collapse_row(path)
             else:
@@ -1260,7 +1260,7 @@ class Search(ViewContainer):
             or _("Unknown Album")
 
         key = '%s-%s' % (artist, album)
-        if not key in self._albums:
+        if key not in self._albums:
             self._albums[key] = Grl.MediaBox()
             self._albums[key].set_title(album)
             self._albums[key].add_author(artist)
@@ -1288,9 +1288,11 @@ class Search(ViewContainer):
             or item.get_author() \
             or _("Unknown Artist")
 
-        group = 0 if category == 'album' else \
-                1 if category == 'artist' else \
-                2 if category == 'song' else 3
+        group = 3
+        try:
+            group = {'album': 0, 'artist': 1, 'song': 2}[category]
+        except:
+            pass
 
         _iter = None
         if category == 'album' or category == 'song':
@@ -1298,16 +1300,16 @@ class Search(ViewContainer):
                 self.head_iters[group], -1,
                 [0, 2, 3, 4, 5, 8, 9, 10, 11],
                 [str(item.get_id()), title, artist,
-                self._symbolicIcon, item, self.nowPlayingIconName,
-                False, False, category])
+                 self._symbolicIcon, item, self.nowPlayingIconName,
+                 False, False, category])
         else:
             if not artist.casefold() in self._artists:
                 _iter = self._model.insert_with_values(
                     self.head_iters[group], -1,
                     [0, 2, 4, 5, 8, 9, 10, 11],
                     [str(item.get_id()), artist,
-                    self._symbolicIcon, item, self.nowPlayingIconName,
-                    False, False, category])
+                     self._symbolicIcon, item, self.nowPlayingIconName,
+                     False, False, category])
                 self._artists[artist.casefold()] = {'iter': _iter, 'albums': []}
 
             self._artists[artist.casefold()]['albums'].append(item)
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index e47889b..0866713 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -591,8 +591,8 @@ class ArtistAlbumWidget(Gtk.HBox):
             return
 
         if not self.selectionMode and \
-           (event.button == Gdk.BUTTON_SECONDARY or \
-            (event.button == 1 and event.state & Gdk.ModifierType.CONTROL_MASK)):
+            (event.button == Gdk.BUTTON_SECONDARY or
+                (event.button == 1 and event.state & Gdk.ModifierType.CONTROL_MASK)):
             if self.selectionModeAllowed:
                 self.header_bar._select_button.set_active(True)
             else:
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 0bcf881..44b8f48 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -263,7 +263,6 @@ class Window(Gtk.ApplicationWindow):
             _iter = model.iter_next(_iter)
         return count
 
-
     @log
     def _on_select_all(self, action, param):
         if self.toolbar._selectionMode is False:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]