Author: duncan
Date: Sun Feb 18 08:43:00 2007
New Revision: 9224

Modified:
   branches/rel-1/freevo/src/tv/program_display.py
   branches/rel-1/freevo/src/tv/tvguide.py
   branches/rel-1/freevo/src/tv/tvmenu.py

Log:
[ 1662579 ] another change in tvguide navigation
Patch from Tanja Kotthaus applied


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     Sun Feb 18 08:43:00 2007
@@ -33,6 +33,7 @@
 import time, traceback
 from time import gmtime, strftime
 
+import rc
 import plugin, config, menu, string
 import osd
 
@@ -56,7 +57,7 @@
         Item.__init__(self, parent, skin_type='video')
         self.prog = prog
         self.context = context
-        
+
         self.name = self.title = prog.title
         if hasattr(prog,'sub_title'): self.sub_title = prog.sub_title
         if hasattr(prog,'desc'): self.desc = prog.desc
@@ -66,7 +67,7 @@
             self.scheduled = prog.scheduled
         else:
             self.scheduled = False
-                
+
         self.allowDuplicates = prog.allowDuplicates
 
         self.onlyNew = prog.onlyNew
@@ -107,6 +108,7 @@
         """ creates the submenu for a programm
 
         Entries of this menu:
+            0.) 'Play, if this programm is currently running'
             1.) 'Schedule for recording' OR 'Remove from schedule'
             2.) 'Search for more of this program'
             3.) 'Add to favorites' OR 'Remove from favorites'
@@ -116,10 +118,13 @@
 
         #list of entries for the menu
         items = []
-     
-       
-        ## 1.) 'Schedule for recording' OR 'Remove from schedule'
-        # check if this program is scheduled
+
+        ## 0.) 'Play', if this programm is currently running
+        # check the time
+        now = time.time() + (7*60)
+        if self.prog.start <= now:
+            items.append(menu.MenuItem(_('Play'), action= self.play_program))
+
 
         ## 1.) 'Schedule for recording' OR 'Remove from schedule'
         # check if this program is scheduled
@@ -153,8 +158,8 @@
                 self.favorite = True
 
         if self.favorite:
-            items.append(menu.MenuItem(_('Edit favorite'), 
-                                       action=self.edit_favorite)) 
+            items.append(menu.MenuItem(_('Edit favorite'),
+                                       action=self.edit_favorite))
         else:
             items.append(menu.MenuItem(_('Add to favorites'),
                                        action=self.add_favorite))
@@ -168,9 +173,14 @@
 
 
     ### Actions:
-    
+    def play_program(self, arg=None, menuw=None):
+        """ Play """
+        menuw.delete_menu()
+        rc.post_event('PLAY')
+
+
     def schedule_program(self, arg=None, menuw=None):
-        """ 
+        """
         add a program to schedule
         """
         (result, msg) = record_client.scheduleRecording(self.prog)
@@ -180,21 +190,21 @@
                     menuw.delete_menu()
                     menuw.delete_menu()
                 menuw.back_one_menu(arg='reload')
-            msgtext= _('"%s" has been scheduled for recording') 
%self.prog.title   
-            AlertBox(text=msgtext).show()     
+            msgtext= _('"%s" has been scheduled for recording') 
%self.prog.title
+            AlertBox(text=msgtext).show()
         else:
             AlertBox(text=_('Scheduling Failed')+(': %s' % msg)).show()
-                
+
 
     def remove_program(self, arg=None, menuw=None):
-        """ 
+        """
         remove a program from schedule
         """
         (result, msg) = record_client.removeScheduledRecording(self.prog)
         if result:
-            if menuw:  
+            if menuw:
                 menuw.back_one_menu(arg='reload')
-            msgtext = _('"%s" has been removed from schedule') % 
self.prog.title    
+            msgtext = _('"%s" has been removed from schedule') % 
self.prog.title
             AlertBox(text=msgtext).show()
         else:
             AlertBox(text=_('Remove Failed')+(': %s' % msg)).show()
@@ -235,22 +245,22 @@
         menuw.pushmenu(search_menu)
         menuw.refresh()
 
-     
+
     def add_favorite(self, arg=None, menuw=None):
-        """ 
+        """
         Add a program to favorites
         """
         if menuw:
-            # we do not want to return to this menu, 
-            # if we delete it here, then later back_one_menu 
+            # we do not want to return to this menu,
+            # if we delete it here, then later back_one_menu
             # brings us back to the tvguide
             menuw.delete_menu()
         # create a favorite
-        fav = Favorite(self.prog.title, self.prog, 
+        fav = Favorite(self.prog.title, self.prog,
                        True, True, True, -1, True, False)
         # and a favorite item which represents the submen
         fav_item = FavoriteItem(self, fav, fav_action='add')
-        # and open that submenu                        
+        # and open that submenu
         fav_item.display_favorite(menuw=menuw)
 
 
@@ -259,27 +269,27 @@
         Edit the settings of a favorite
         """
         if menuw:
-            # we do not want to return to this menu, 
-            # if we delete it here, then later back_one_menu 
+            # we do not want to return to this menu,
+            # if we delete it here, then later back_one_menu
             # brings us back to the tvguide
             menuw.delete_menu()
         # fist we have to construct the favorite name
         # (get rid of strange characters like german umlauts)
         name = tv_util.progname2favname(self.name)
         # get the favorite from the record_client
-        (got_fav, fav) = record_client.getFavorite(name)   
+        (got_fav, fav) = record_client.getFavorite(name)
         if got_fav:
             # create a favorite item for the submenu
             fav_item = FavoriteItem(self, fav, fav_action='edit')
-            # and open the submenu                        
+            # and open the submenu
             fav_item.display_favorite(menuw=menuw)
         else:
-            AlertBox(text=_('getFavorites failed: %s') % self.name).show()   
-     
+            AlertBox(text=_('getFavorites failed: %s') % self.name).show()
+
 
 
 class FavoriteItem(Item):
-    """ 
+    """
     Item class for favorite items
     """
     def __init__(self, parent, fav, fav_action='edit'):
@@ -323,16 +333,16 @@
 
     def actions(self):
         return [( self.display_favorite , _('Display favorite') )]
-        
-    
+
+
     def display_favorite(self, arg=None, menuw=None):
         """ Display menu for a favorite
-        
+
         With this menu the user can made a program a favorite.
         All attributes of a favorite can be edited here and in the end
         the user must select 'save changes' to finally create the favorite.
-        """ 
-        
+        """
+
         ### create menu items for editing the favorites attributes
         items = []
 
@@ -362,12 +372,12 @@
 
 
         ### save favorite
-        items.append(menu.MenuItem(_('Save changes'), 
+        items.append(menu.MenuItem(_('Save changes'),
                                     action=self.save_changes))
-        
+
         ### remove this program from favorites
         if not self.fav_action == 'add':
-            items.append(menu.MenuItem(_('Remove favorite'), 
+            items.append(menu.MenuItem(_('Remove favorite'),
                                        action=self.rem_favorite))
 
         ### put the whole menu together
@@ -453,8 +463,8 @@
         menuw.pushmenu(favorite_menu)
         menuw.refresh()
 
-    
-    
+
+
     def mod_day(self, arg=None, menuw=None):
         """ Modify day
 
@@ -573,12 +583,12 @@
             if not config.ONLY_NEW_DETECTION or not hasattr(self.fav,
                                                            'onlyNew'):
                 self.fav.onlyNew = 0
-           
-            (result, msg) = record_client.addEditedFavorite(self.fav.name, 
-                                                           self.fav.title, 
-                                                           self.fav.channel, 
-                                                           self.fav.dow, 
-                                                           self.fav.mod, 
+
+            (result, msg) = record_client.addEditedFavorite(self.fav.name,
+                                                           self.fav.title,
+                                                           self.fav.channel,
+                                                           self.fav.dow,
+                                                           self.fav.mod,
                                                            self.fav.priority,
                                                            
self.fav.allowDuplicates,
                                                            self.fav.onlyNew)
@@ -592,14 +602,14 @@
                 self.fav_action = 'edit'
                 if menuw:
                     # and reload the menu that we return to
-                    menuw.back_one_menu(arg='reload')    
+                    menuw.back_one_menu(arg='reload')
         else:
             # show an error messages when all failed
             AlertBox(text=_('Save Failed')+(': %s' % msg)).show()
 
 
     def rem_favorite(self, arg=None, menuw=None):
-        """ 
+        """
         Remove favorite
         """
         name = self.origname
@@ -609,8 +619,8 @@
             if menuw:
                 # reload the menu that we return to
                 menuw.back_one_menu(arg='reload')
-            # and show a short message of success    
-            msgtext = text=_('"%s" has been removed from favorites') % name    
+            # and show a short message of success
+            msgtext = text=_('"%s" has been removed from favorites') % name
             AlertBox(text=msgtext).show()
         else:
             # if all fails then we should show an error

Modified: branches/rel-1/freevo/src/tv/tvguide.py
==============================================================================
--- branches/rel-1/freevo/src/tv/tvguide.py     (original)
+++ branches/rel-1/freevo/src/tv/tvguide.py     Sun Feb 18 08:43:00 2007
@@ -139,7 +139,7 @@
         MENU_PAGEUP: Moves to the first of the currently displayed channels
         MENU_PAGEDOWN: Move to the last of the currently displayed channels
         MENU_SUBMENU: Open a submenu for the selected program
-        MENU_SELECT: Execute the first entry in the submenu
+        MENU_SELECT: Open a submenu for the selected program
         TV_START_RECORDING: Start to record this or put it on schedule
         PLAY: Start to watch the selected channel (if it is possible)
         PLAY_END: Show the guide again
@@ -147,7 +147,7 @@
         """
 
 
-        _debug_('TVGUIDE EVENT is %s' % event, 2)
+        _debug_('TVGUIDE EVENT is %s' % event, 0)
 
         ## MENU_CHANGE_STYLE
         if event == MENU_CHANGE_STYLE:
@@ -216,7 +216,7 @@
 
         ## MENU_SELECT: Open a submenu for the selected program
         elif event == MENU_SELECT:
-            self.event_record()
+            self.event_submenu()
 
         ## TV_START_RECORDING: Start to record this or put it on schedule
         elif event == TV_START_RECORDING:
@@ -457,8 +457,8 @@
         pi = ProgramItem(self, prog=self.selected)
         # and show its submenu
         pi.display_program(menuw=self.menuw)
-        
-        
+
+
     def event_change_program(self, value, full_scan=False):
 
         start_time    = self.start_time

Modified: branches/rel-1/freevo/src/tv/tvmenu.py
==============================================================================
--- branches/rel-1/freevo/src/tv/tvmenu.py      (original)
+++ branches/rel-1/freevo/src/tv/tvmenu.py      Sun Feb 18 08:43:00 2007
@@ -1,15 +1,15 @@
 # -*- coding: iso-8859-1 -*-
 # -----------------------------------------------------------------------
-# tv.py - This is the Freevo TV module. 
+# tv.py - This is the Freevo TV module.
 # -----------------------------------------------------------------------
 # $Id$
 #
 # Notes:
-# Todo:        
+# Todo:
 #
 # -----------------------------------------------------------------------
 # Freevo - A Home Theater PC framework
-# Copyright (C) 2002 Krister Lagerstrom, et al. 
+# Copyright (C) 2002 Krister Lagerstrom, et al.
 # Please see the file freevo/Docs/CREDITS for a complete list of authors.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -37,10 +37,6 @@
 # The menu widget class
 import menu
 
-# The RemoteControl class, sets up a UDP daemon that the remote control client
-# sends commands to
-import rc
-
 import plugin
 
 import util.tv_util as tv_util
@@ -78,7 +74,7 @@
 def get_friendly_channel(channel_id):
     channel_name = tv_util.get_chan_displayname(channel_id)
 
-    if not channel_name: 
+    if not channel_name:
         AlertBox(text=_('Could not find TV channel %s') % channel_id).show()
 
     return channel_name
@@ -94,7 +90,7 @@
 # The TV menu
 #
 class TVMenu(Item):
-    
+
     def __init__(self):
         Item.__init__(self)
         self.type = 'tv'

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to