Update of /cvsroot/freevo/freevo/lib/pyepg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7970/lib/pyepg
Modified Files:
guide.py
Log Message:
-Maintain self.selected_index.
-Modify get_channel() to use and update it.
Index: guide.py
===================================================================
RCS file: /cvsroot/freevo/freevo/lib/pyepg/guide.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** guide.py 11 Dec 2004 17:46:49 -0000 1.17
--- guide.py 13 Dec 2004 01:42:10 -0000 1.18
***************
*** 57,60 ****
--- 57,61 ----
"""
def __init__(self):
+ self.selected_index = 0
self.channel_list = []
self.channel_dict = {}
***************
*** 453,467 ****
! def get_channel(self, start, pos):
"""
Get a channel relative to the given channel 'start'. The function
will start from the beginning of the list if the index is greater
as the channel list length and wrap to the end if lower zero.
"""
! if not start:
! start = self.channel_list[0]
! cpos = self.channel_list.index(start)
! pos = (cpos + pos) % len(self.channel_list)
! return self.channel_list[pos]
--- 454,475 ----
! def get_channel(self, start=None, pos=0):
"""
Get a channel relative to the given channel 'start'. The function
will start from the beginning of the list if the index is greater
as the channel list length and wrap to the end if lower zero.
+ If start is not given it will return the channel based on the
+ selected_index, which is also updated every method call.
"""
! if type(start) in StringTypes:
! start = self.channel_dict.get(start)
!
! if start:
! cpos = self.channel_list.index(start)
! else:
! cpos = self.selected_index
!
! self.selected_index = (cpos + pos) % len(self.channel_list)
! return self.channel_list[self.selected_index]
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog