Author: duncan
Date: Fri Jul 13 10:02:18 2007
New Revision: 9757

Log:
[ 1752973 ] Add Full Description item to TV program menu
Patch from Adam Charrett applied


Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/plugins/buttonbar.py
   branches/rel-1/freevo/src/tv/program_display.py

Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Fri Jul 13 10:02:18 2007
@@ -21,13 +21,14 @@
  * Added sounds to menu selection, enabled with OSD_SOUNDS_ENABLED (F#1732380)
  * Added translation for Greek (F#)
  * Added XINE_BOOKMARK for when xine has support for get_time, default is off 
(B#1745076)
- * Updated headlines to allow the window to be scrolled (F#1752971)
  * Updated childapp to use subprocess instead of popen (F#1729597)
  * Updated freevo to allow X server options to be passed when using -fs 
(F#1749908)
+ * Updated headlines to allow the window to be scrolled (F#1752971)
  * Updated local_conf.py.example with MPLAYER_HAS_FIELD_DOMINANCE (F#1729404)
  * Updated record_client to allow favourites to be added from the command line 
(F#1734781)
  * Updated skins to adjust the window heights when the button bar is active 
(F#1733061)
  * Updated system sensors for a configurable path (B#1731892)
+ * Updated tv program menu to show full description (F#1752973)
  * Updated xine video plug-in to allow bookmarks to work (F#1729024)
  * Updated xine video plug-in to process stdout and stderr message (F#1729603)
  * Updated xmltv's use of element tree for Python-2.5 (F#1731775)

Modified: branches/rel-1/freevo/src/plugins/buttonbar.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/buttonbar.py      (original)
+++ branches/rel-1/freevo/src/plugins/buttonbar.py      Fri Jul 13 10:02:18 2007
@@ -39,6 +39,7 @@
 import rc
 
 from tv.tvguide import TVGuide
+from tv.program_display import ShowProgramDetails
 from item import Item
 from menu import MenuItem, Menu
 from pygame import image,transform, Surface
@@ -47,7 +48,6 @@
 
 # Create the skin_object object
 skin_object = skin.get_singleton()
-skin_object.register('tvguideinfo', ('screen', 'info', 'scrollabletext', 
'plugin'))
 
 # Create the events and assign them to the menus.
 BUTTONBAR_RED    = event.Event('BUTTONBAR_RED')
@@ -89,70 +89,13 @@
     menuw.eventhandler(arg)
 
 
-# Program Info screen
-class ShowProgramDetails:
-    """
-    Screen to show the details of the TV program
-    """
-    def __init__(self, menuw):
-        tvguide = menuw.menustack[-1]
-        prg = tvguide.selected
-        if prg is None:
-            name = _('No Information Available')
-            sub_title = ''
-            time = ''
-            description = ''
-        else:
-            name = prg.title
-            sub_title = prg.sub_title
-            time =  prg.getattr('time')
-            if sub_title:
-                description = u'"' + sub_title + u'"\n' + prg.desc
-            else:
-                description = prg.desc
-        self.program         = prg
-        self.name            = name
-        self.time            = time
-        self.scrollable_text = skin.ScrollableText(description)
-        self.visible = True
-
-        self.menuw = menuw
-        self.menuw.hide(clear=False)
-        rc.app(self)
-        skin_object.draw('tvguideinfo', self)
-
-
-    def getattr(self, name):
-        if name == 'title':
-            return self.name
 
-        if self.program:
-            return self.program.getattr(name)
-
-        return u''
-
-
-    def eventhandler(self, event, menuw=None):
-        """
-        eventhandler
-        """
-        if event in ('MENU_SELECT', 'MENU_BACK_ONE_MENU'):
-            rc.app(None)
-            self.menuw.show()
-            return True
-        elif event == 'MENU_UP':
-            self.scrollable_text.scroll(True)
-            skin_object.draw('tvguideinfo', self)
-            return True
-        elif event == 'MENU_DOWN':
-            self.scrollable_text.scroll(False)
-            skin_object.draw('tvguideinfo', self)
-            return True
-        return False
 
 
 def show_program_info(arg=None, menuw =None):
-    ShowProgramDetails(menuw)
+    tvguide = menuw.menustack[-1]
+    prg = tvguide.selected
+    ShowProgramDetails(menuw, prg)
 
 
  # Plugin interface

Modified: branches/rel-1/freevo/src/tv/program_display.py
==============================================================================
--- branches/rel-1/freevo/src/tv/program_display.py     (original)
+++ branches/rel-1/freevo/src/tv/program_display.py     Fri Jul 13 10:02:18 2007
@@ -48,6 +48,10 @@
 
 DEBUG = config.DEBUG
 
+# Create the skin_object object
+import skin
+skin_object = skin.get_singleton()
+skin_object.register('tvguideinfo', ('screen', 'info', 'scrollabletext', 
'plugin'))
 
 class ProgramItem(Item):
     """
@@ -125,6 +129,7 @@
         if self.prog.start <= now:
             items.append(menu.MenuItem(_('Play'), action= self.play_program))
 
+        items.append(menu.MenuItem(_('Full Description'), 
action=self.view_description))
 
         ## 1.) 'Schedule for recording' OR 'Remove from schedule'
         # check if this program is scheduled
@@ -178,6 +183,11 @@
         menuw.delete_menu()
         rc.post_event('PLAY')
 
+    def view_description(self, arg=None, menuw=None):
+        """
+        View a full scrollable description of the program.
+        """
+        ShowProgramDetails(menuw, self.prog)
 
     def schedule_program(self, arg=None, menuw=None):
         """
@@ -625,3 +635,80 @@
         else:
             # if all fails then we should show an error
             AlertBox(text=_('Remove Failed')+(': %s' % msg)).show()
+# Program Info screen
+class ShowProgramDetails:
+    """
+    Screen to show the details of the TV program
+    """
+    def __init__(self, menuw, prg):
+        if prg is None:
+            name = _('No Information Available')
+            sub_title = ''
+            time = ''
+            description = ''
+        else:
+            name = prg.title
+            sub_title = prg.sub_title
+            time =  prg.getattr('time') 
+            if sub_title:
+                description = u'"' + sub_title + u'"\n' + prg.desc
+            else:
+                description = prg.desc
+            
+            if prg.categories:
+                description += u'\n'
+                
+            for category in prg.categories:
+                description += u'\n' + _('Category : ') + category
+            
+            if prg.advisories:
+                description += u'\n'
+ 
+            for advisory in prg.advisories:
+                description += u'\n' + _('Advisory : ') + advisory
+            
+            if prg.ratings:
+                description += u'\n'
+
+            for system,value in prg.ratings.items():
+                description += u'\n' + _('Rating') + u'(' + system + u') : ' + 
value
+
+        self.program         = prg
+        self.name            = name
+        self.time            = time
+        self.scrollable_text = skin.ScrollableText(description)
+        self.visible = True
+
+        self.menuw = menuw
+        self.menuw.hide(clear=False)
+        rc.app(self)
+        skin_object.draw('tvguideinfo', self)
+
+
+    def getattr(self, name):
+        if name == 'title':
+            return self.name
+        
+        if self.program:
+            return self.program.getattr(name)
+
+        return u''
+
+
+    def eventhandler(self, event, menuw=None):
+        """
+        eventhandler
+        """
+        if event in ('MENU_SELECT', 'MENU_BACK_ONE_MENU'):
+            rc.app(None)
+            self.menuw.show()
+            return True
+        elif event == 'MENU_UP':
+            self.scrollable_text.scroll(True)
+            skin_object.draw('tvguideinfo', self)
+            return True
+        elif event == 'MENU_DOWN':
+            self.scrollable_text.scroll(False)
+            skin_object.draw('tvguideinfo', self)
+            return True
+        return False

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to