Commits

Damián Nohales committed 4c24a82

Moved some methods for readability.

Comments (0)

Files changed (1)

         """
         song = self.result.get_song(column[0])
         self.playlist.append_song(song)
+            
+    def get_playing_iter(self):
+        return self.playlist.get_song_iter(self.get_playing_song())
+    
+    def get_playing_song(self):
+        return self.playlist.get_playing_song()
+        
+    def set_playing_song(self, song):
+        """
+        Updates some labels and icons when a song is playing
+        """
+        self.playlist.set_playing_song(song)
+        
+        if song != None:
+            self.staticon.change_status_playing()
+            
+            play_stop_image = gtk.Image()
+            play_stop_image.set_from_stock(gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_MENU)
+            self.staticon.change_playbutton(play_stop_image)
 
+            self.songinfo.set_markup(
+                _("<b>Playing:</b> {artist} - {title}").format(artist = glib.markup_escape_text(song.get_artist()),
+                                         title = glib.markup_escape_text(song.get_title()))
+            )
+            if int(config()['show_notification']) == 1:
+                n = pynotify.Notification(_("Now playing"),
+                    "%s - %s" % (glib.markup_escape_text(song.get_artist()),
+                                 glib.markup_escape_text(song.get_title())),
+                    "audio-x-generic")
+                n.set_timeout(50)
+                n.show()
+        else:
+            self.staticon.change_status_stopped()
+            play_stop_image = gtk.Image()
+            play_stop_image.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU)
+            self.staticon.change_playbutton(play_stop_image)
+            self.songinfo.set_markup("")
+    
+    def play_selected(self, widget, data = None, row = None):
+        """
+        Starts the play thread
+        """
+        if self.get_playing_song() == None:
+            if len(self.playlist):
+                self.set_playing_song(self.playlist.get_song(0))
+        else:
+            self.set_playing_song(None)
+    
     def play_next(self, widget, data = None):
         """
         Plays the next item from the playlist
             search_thread = SearchThread(self, widget.get_text(), "Songs")
             search_thread.start()
 
-    def play_selected(self, widget, data = None, row = None):
-        """
-        Starts the play thread
-        """
-        if self.get_playing_song() == None:
-            if len(self.playlist):
-                self.set_playing_song(self.playlist.get_song(0))
-        else:
-            self.set_playing_song(None)
-            
-    def get_playing_iter(self):
-        return self.playlist.get_song_iter(self.get_playing_song())
-    
-    def get_playing_song(self):
-        return self.playlist.get_playing_song()
-        
-    def set_playing_song(self, song):
-        """
-        Updates some labels and icons when a song is playing
-        """
-        self.playlist.set_playing_song(song)
-        
-        if song != None:
-            self.staticon.change_status_playing()
-            
-            play_stop_image = gtk.Image()
-            play_stop_image.set_from_stock(gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_MENU)
-            self.staticon.change_playbutton(play_stop_image)
-
-            self.songinfo.set_markup(
-                _("<b>Playing:</b> {artist} - {title}").format(artist = glib.markup_escape_text(song.get_artist()),
-                                         title = glib.markup_escape_text(song.get_title()))
-            )
-            if int(config()['show_notification']) == 1:
-                n = pynotify.Notification(_("Now playing"),
-                    "%s - %s" % (glib.markup_escape_text(song.get_artist()),
-                                 glib.markup_escape_text(song.get_title())),
-                    "audio-x-generic")
-                n.set_timeout(50)
-                n.show()
-        else:
-            self.staticon.change_status_stopped()
-            play_stop_image = gtk.Image()
-            play_stop_image.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_MENU)
-            self.staticon.change_playbutton(play_stop_image)
-            self.songinfo.set_markup("")
-
     def get_overwritten_filename(self, filename):
         """
         Gets the file name depending on whether user want to overwrite the file,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.