diff browser_side/radiocol.py @ 243:63e9b680d3e7

browser_side, blog: better PEP8 compliance
author souliane <souliane@mailoo.org>
date Tue, 15 Oct 2013 17:19:03 +0200
parents 9763dec220ed
children a763b2ac5d41
line wrap: on
line diff
--- a/browser_side/radiocol.py	Fri Oct 18 11:14:55 2013 +0200
+++ b/browser_side/radiocol.py	Tue Oct 15 17:19:03 2013 +0200
@@ -19,7 +19,7 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-import pyjd # this is dummy in pyjs
+import pyjd  # this is dummy in pyjs
 from pyjamas.ui.VerticalPanel import VerticalPanel
 from pyjamas.ui.HorizontalPanel import HorizontalPanel
 from pyjamas.ui.SimplePanel import SimplePanel
@@ -45,24 +45,24 @@
 
     def __init__(self):
         FlexTable.__init__(self)
-        title_lbl =  Label("title:")
+        title_lbl = Label("title:")
         title_lbl.setStyleName('radiocol_metadata_lbl')
         artist_lbl = Label("artist:")
         artist_lbl.setStyleName('radiocol_metadata_lbl')
         album_lbl = Label("album:")
         album_lbl.setStyleName('radiocol_metadata_lbl')
-        self.title =  Label("")
+        self.title = Label("")
         self.title.setStyleName('radiocol_metadata')
         self.artist = Label("")
         self.artist.setStyleName('radiocol_metadata')
         self.album = Label("")
         self.album.setStyleName('radiocol_metadata')
-        self.setWidget(0,0,title_lbl)
-        self.setWidget(1,0,artist_lbl)
-        self.setWidget(2,0,album_lbl)
-        self.setWidget(0,1,self.title)
-        self.setWidget(1,1,self.artist)
-        self.setWidget(2,1,self.album)
+        self.setWidget(0, 0, title_lbl)
+        self.setWidget(1, 0, artist_lbl)
+        self.setWidget(2, 0, album_lbl)
+        self.setWidget(0, 1, self.title)
+        self.setWidget(1, 1, self.artist)
+        self.setWidget(2, 1, self.album)
         self.setStyleName("radiocol_metadata_pnl")
 
     def setTitle(self, title):
@@ -74,6 +74,7 @@
     def setAlbum(self, album):
         self.album.setText(album)
 
+
 class ControlPanel(FormPanel):
     """Panel used to show controls to add a song, or vote for the current one"""
 
@@ -98,20 +99,20 @@
         hPanel.add(self.status)
 
         vPanel.add(hPanel)
-        
+
         #We need to know the referee
         referee_field = Hidden('referee', referee)
         vPanel.add(referee_field)
 
         self.add(vPanel)
         self.addFormHandler(self)
-    
+
     def _timeCb(self, timer):
         self.status.setText('')
 
     def onBtnClick(self):
         self.submit()
-    
+
     def onSubmit(self, event):
         pass
 
@@ -123,7 +124,6 @@
         self.file_upload.setVisible(True)
         self.upload_btn.setEnabled(True)
 
-
     def onSubmitComplete(self, event):
         result = event.getResults()
         if result == "OK":
@@ -136,17 +136,18 @@
         else:
             Window.alert('Submit error: %s' % result)
 
+
 class Player(HTML):
 
     def __init__(self, player_id, metadata_panel):
         HTML.__init__(self)
         self._id = player_id
         self.metadata = metadata_panel
-        self.title=""
-        self.artist=""
-        self.album=""
+        self.title = ""
+        self.artist = ""
+        self.album = ""
         self.filename = None
-        self.played = False #True when song is playing/played, become False on preload
+        self.played = False  # True when song is playing/played, become False on preload
 
     def preload(self, filename, title, artist, album):
         """preload the song but doesn't play it"""
@@ -157,7 +158,7 @@
         self.played = False
         self.setHTML('<audio id="%s" style="display: none" preload="auto" src="radiocol/%s" />' % (self._id, html_sanitize(filename)))
         print "preloading %s in %s" % (title, self._id)
-       
+
     def play(self):
         """actually play the song"""
         self.played = True
@@ -169,7 +170,6 @@
         var player = top.document.getElementById(this._id);
         player.play();
         """)
-        
 
 
 class RadioColPanel(HorizontalPanel, ClickHandler):
@@ -181,7 +181,7 @@
         self.referee = referee
         self.setStyleName("radiocolPanel")
         self.setHeight('30%')
-        
+
         # Now we set up the layout
         self.left_panel = VerticalPanel()
         self.left_panel.setStyleName("radiocol_left_panel")
@@ -214,7 +214,7 @@
         #FIXME: should check that the song we remove is the one we play
         next_song = self.next_songs.pop(0)
         self.left_panel.remove(next_song)
-    
+
     def radiocolPreload(self, filename, title, artist, album):
         preloaded = False
         for player in self.players:
@@ -229,7 +229,7 @@
             print("WARNING: Can't preload song, we are getting too many songs to preload, we shouldn't have more than 2 at once")
         else:
             self.pushNextSong(title)
-    
+
     def radiocolPlay(self, filename):
         for player in self.players:
             if player.filename == filename:
@@ -247,4 +247,3 @@
 
     def radiocolSongRejected(self, reason):
         Window.alert("Song rejected: %s" % reason)
-