> When browsing : "Listen to Music" then "Browse by Artists/Albums" if I
> do not have music I've got this error message in the console : 
This is because the list of artists/albums is empty. Of course you
should not get this error but a "This directory is empty" message
instead!
So I changed this in the following patch.

Dischi, can you put these changes in svn?
The diff contains more changes I did. See also mail below.
Thanks.

Regards,
Joost



Hi,

I have added the program status (scheduled, recording, conflict) to the
new tvguide (testguide.py). For this I changed the following:
- grid_area.py: Using new values for scheduled etc.
- grid_menu.py: Add new function which returns the state (selected,
default) of the item. get_item_state()
- testguide.py: added get_item_state() which will also return states
like scheduled and recording.
- program.py: now gets recording information and favorite information
during init(). In this way the scheduled and favorite information is
always available.

I also solved 2 small problems:
- testguide.py: changed self.grid to self.choices. self.grid doesn't
exist anymore 
- program.py: added '()' to 'return self.get_start()....'

Next task: Add channel logos. :)

Regards,

Joost
Index: ui/src/gui/areas/grid_area.py
===================================================================
--- ui/src/gui/areas/grid_area.py	(revision 10083)
+++ ui/src/gui/areas/grid_area.py	(working copy)
@@ -247,6 +247,16 @@
         menu     = self.menu
         settings = self.settings
 
+        if not len(menu.choices):
+            if not self.objects:
+                self.clear()
+                t = _('This directory is empty')
+                self.objects.append(self.drawstring(t, settings.font,
+                                                     settings,
+                                                     settings.x + settings.spacing,
+                                                     settings.y + settings.spacing))
+            return
+
         if menu.update_view:
             menu.update_view = False
             # layout change, clean everything
@@ -317,10 +327,13 @@
                         else:
                             data = item
                             width = self.col_width
+                        #Item layout
                         val = self.default_val
-                        #is the item selected?
-                        if data == menu.selected:
+                        layout = self.menu.get_item_state(draw_row, draw_col)
+                        if layout == 'selected':
                             val = self.selected_val
+                        elif self.settings.types.has_key(layout):
+                            val = self.settings.types[layout]
                         str = data.name
                         if x0 == col_x:
                             # draw left arrow
Index: ui/src/tv/plugins/testguide.py
===================================================================
--- ui/src/tv/plugins/testguide.py	(revision 10083)
+++ ui/src/tv/plugins/testguide.py	(working copy)
@@ -103,11 +103,27 @@
         Return the data for that col, row.
         """
         try:
-            item = self.grid[self.base_row+row][col]
+            item = self.choices[self.base_row+row][col]
         except:
             return None
         return item
 
+    def get_item_state(self, row, col):
+        """
+        Return the state for this item
+        """
+        item = self.get_item(row, col)[1]
+        if self.selected == item:
+            return 'selected'
+        elif item.scheduled:
+            if item.scheduled.status in ('conflict', 'scheduled'):
+                return 'scheduled'
+            elif item.scheduled.status == 'recording':
+                return 'recording'
+            else:
+                return 'default'
+        else:
+            return 'default'
         
     @kaa.notifier.yield_execution()
     def update(self):
@@ -192,10 +208,10 @@
         """
         Select program for the new row
         """
-        for program in self.grid[self.selected_row]:
+        for program in self.choices[self.selected_row]:
             size, data = program
             if data.start <= self.selected_start_time and data.stop > self.selected_start_time:
-                self.select(row=self.selected_row, col=self.grid[self.selected_row].index(program))
+                self.select(row=self.selected_row, col=self.choices[self.selected_row].index(program))
 
     def eventhandler(self, event):
         handled = False
Index: ui/src/tv/program.py
===================================================================
--- ui/src/tv/program.py	(revision 10083)
+++ ui/src/tv/program.py	(working copy)
@@ -105,6 +105,17 @@
             self.genre = ''
             # TODO: add ratings support
             self.rating = ''
+            
+        # check if this is a recording
+        self.scheduled = tvserver.recordings.get(self.channel,
+                                                 self.start,
+                                                 self.stop)
+        # check if this is a favorite
+        self.favorite = tvserver.favorites.get(self.title,
+                                               self.channel,
+                                               self.start,
+                                               self.stop)
+       
 
     def __unicode__(self):
         """
@@ -159,7 +170,7 @@
         """
         Return start time and stop time as formated unicode string.
         """
-        return self.get_start + u' - ' + self.get_stop()
+        return self.get_start() + u' - ' + self.get_stop()
 
 
     def get_date(self):
@@ -201,16 +212,6 @@
         create a list of actions for the submenu
         """
 
-        # check if this is a recording
-        self.scheduled = tvserver.recordings.get(self.channel,
-                                                 self.start,
-                                                 self.stop)
-        # check if this is a favorite
-        self.favorite = tvserver.favorites.get(self.title,
-                                               self.channel,
-                                               self.start,
-                                               self.stop)
-
         # empty item list
         items = []
 
@@ -297,6 +298,10 @@
             result = result()
         if result == tvserver.recordings.SUCCESS:
             msg = _('"%s" has been scheduled for recording') % self.title
+            #reload scheduled
+            self.scheduled = tvserver.recordings.get(self.channel,
+                                                     self.start,
+                                                     self.stop)
         else:
             msg = _('Scheduling failed: %s') % result
         MessageWindow(msg).show()
@@ -314,6 +319,10 @@
             result = result()
         if result == tvserver.recordings.SUCCESS:
             msg = _('"%s" has been removed') % self.title
+            #reload scheduled
+            self.scheduled = tvserver.recordings.get(self.channel,
+                                                     self.start,
+                                                     self.stop)
         else:
             msg = _('Removing failed: %s') % result
         MessageWindow(msg).show()
@@ -385,6 +394,11 @@
         Create a new FavoriteItem and open its submenu
         """
         favorite.FavoriteItem(self, self).submenu()
+        # Reload favorite
+        self.favorite = tvserver.favorites.get(self.title,
+                                               self.channel,
+                                               self.start,
+                                               self.stop)
 
 
     def edit_favorite(self):
@@ -393,6 +407,11 @@
         and open its submenu to edit this item
         """
         favorite.FavoriteItem(self, self.favorite).submenu()
+        # Reload favorite
+        self.favorite = tvserver.favorites.get(self.title,
+                                               self.channel,
+                                               self.start,
+                                               self.stop)
 
 
     def remove_favorite(self):
@@ -401,4 +420,9 @@
         and delete this favorite.
         """
         favorite.FavoriteItem(self, self.favorite).remove()
+        # Reload favorite
+        self.favorite = tvserver.favorites.get(self.title,
+                                               self.channel,
+                                               self.start,
+                                               self.stop)
 
Index: ui/src/menu/gridmenu.py
===================================================================
--- ui/src/menu/gridmenu.py	(revision 10083)
+++ ui/src/menu/gridmenu.py	(working copy)
@@ -178,6 +178,21 @@
         except (IndexError, KeyError):
             return None
 
+    def get_item_state(self, row, col):
+        """
+        Return the state for this item.
+        """
+        if self.advanced_mode:
+            if self.selected == self.get_item(row, col)[1]:
+                return 'selected'
+            else:
+                return 'default'
+        else:
+            if self.selected == self.get_item(row, col):
+                return 'selected'
+            else:
+                return 'default'
+            
 
     def get_column_name(self, col):
         """
Index: ui/share/skins/main/blurr.fxd
===================================================================
--- ui/share/skins/main/blurr.fxd	(revision 10083)
+++ ui/share/skins/main/blurr.fxd	(working copy)
@@ -597,7 +597,7 @@
             <screen layout="screen" x="0" y="0" width="800" height="600"/>
             <title visible="no"/>
             <info layout="tv info" x="10" y="90" width="780" height="140"/>
-            <grid layout="grid" x="10" y="240" width="780" height="350">
+            <grid layout="tv grid" x="10" y="240" width="780" height="350">
                 <image x="765" y="240" width="32" height="32" label="uparrow"
 	            filename="up.png"/>
                 <image x="765" y="max-32" width="32" height="32" label="downarrow" 
@@ -607,6 +607,36 @@
             </grid>
         </menuset>
 
+        <!-- default tv grid area -->
+		<layout label="tv grid">
+		    <content type="text" spacing="0">
+			<item type="row" font="item" width="80">
+			    <rectangle bgcolor="0x88000066" size="1" color="0x000000" x="-5" y="-5"
+				width="max+10" height="max+10"/>
+			</item>
+			<item type="column" font="item" width="175">
+			    <rectangle bgcolor="0x88000066" size="1" color="0x000000" x="-5" y="-5"
+				width="max+10" height="max+10"/>
+			</item>
+			<item type="default" font="item">
+			    <rectangle bgcolor="0xff000000" size="1" color="0x000000" x="-5"
+				y="-5" width="max+10" height="max+10"/>
+			</item>
+			<item type="selected" font="selected">
+			    <rectangle bgcolor="selection" size="1" color="0x000000" x="-5"
+				y="-5" width="max+10" height="max+10"/>
+			</item>
+			<item type="scheduled" font="selected">
+			    <rectangle bgcolor="0x14ba05" size="1" color="0x000000" x="-5"
+				y="-5" width="max+10" height="max+10"/>
+			</item>
+			<item type="recording" font="selected">
+			    <rectangle bgcolor="0xba1405" size="1" color="0x000000" x="-5"
+				y="-5" width="max+10" height="max+10"/>
+			</item>
+		    </content>
+		</layout>
+
         <!-- GUIDE  -->
 
         <menuset label="tv menu">
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to