[Pychord-commits] r91 - in trunk: . pychord2

danilo at garage.maemo.org danilo at garage.maemo.org
Sat Apr 5 00:02:19 EEST 2008


Author: danilo
Date: 2008-04-05 00:02:06 +0300 (Sat, 05 Apr 2008)
New Revision: 91

Modified:
   trunk/pychord.py
   trunk/pychord2/window_playlist.py
Log:
- Adding an empty message when the playlist is cleaned

Modified: trunk/pychord.py
===================================================================
--- trunk/pychord.py	2008-04-04 20:29:53 UTC (rev 90)
+++ trunk/pychord.py	2008-04-04 21:02:06 UTC (rev 91)
@@ -110,15 +110,17 @@
         f.write('db='+ self.opt['db'] +'\n')
         f.write('datadir='+ self.opt['datadir'] + '\n')
         
-        if self.opt['playlist'] == ',':
-           self.opt['playlist'] = '' 
-        
         f.write("playlist="+ self.opt['playlist'])   
         f.close()
         
+        print "DEPOIS:", self.opt['playlist']
         
+        
     def addToPlaylist(self, id):
-        opt = self.opt['playlist'].split(',')
+        if self.opt['playlist'].strip() == '':
+            opt = []
+        else:
+            opt = self.opt['playlist'].split(',')
         if opt.count(id) == 0:
             opt.append(id)
             self.opt['playlist'] = ','.join(opt)
@@ -126,6 +128,7 @@
 
             
     def removeFromPlaylist(self, id):
+        print "Antes:", self.opt['playlist']
         opt = self.opt['playlist'].split(',')
         if self.isInPlaylist(id):
             opt.remove(id)

Modified: trunk/pychord2/window_playlist.py
===================================================================
--- trunk/pychord2/window_playlist.py	2008-04-04 20:29:53 UTC (rev 90)
+++ trunk/pychord2/window_playlist.py	2008-04-04 21:02:06 UTC (rev 91)
@@ -42,9 +42,9 @@
         lblSearch = label(self, [10,10],"Playlist", ptsize = 40)
         self.addElement(lblSearch)
         
-        lst = list(self, [10,60], width=700, height=350, ptsize=40) # creating the widget
-        lst.setBackground((10,10,10))
-        self.addElement(lst)
+        self.lst = list(self, [10,60], width=700, height=350, ptsize=40) # creating the widget
+        self.lst.setBackground((10,10,10))
+        self.addElement(self.lst)
         
         btC = Tbutton(self,[500,420],"Clear Playlist",height=50, width=210 )
         btC.registerClickSlot(self.clearPlaylist)
@@ -53,7 +53,7 @@
         i = 0
         for l in res:
             j = l[2] + ', by ' + l[1] + ''
-            lbl = lst.addLine(j, 20)
+            lbl = self.lst.addLine(j, 20)
             lbl.registerClickSlot(self.openSong, l[0])
             i += 1
         
@@ -77,6 +77,12 @@
             uplabel.draw(self.screen)
             pygame.display.flip()
             time.sleep(2)
+            
+            for i in self.lst.objects:
+                self.lst.delElement(i)
+                
+            noresult = label(self, [20, 200],'No result found',ptsize=35)
+            self.addElement(noresult)
         
         
         self.repaint()
\ No newline at end of file



More information about the Pychord-commits mailing list