Author: dmeyer
Date: Tue Jan 22 14:52:31 2008
New Revision: 10304
Log:
adjust to yield_execution changes
Modified:
trunk/ui/setup.py
trunk/ui/src/audio/player.py
trunk/ui/src/games/player.py
trunk/ui/src/gui/areas/tvlisting_area.py
trunk/ui/src/image/plugins/calendar.py
trunk/ui/src/tv/favorite.py
trunk/ui/src/tv/plugins/directory.py
trunk/ui/src/tv/plugins/genre.py
trunk/ui/src/tv/plugins/guide.py
trunk/ui/src/tv/plugins/testguide.py
trunk/ui/src/tv/program.py
trunk/ui/src/video/player.py
Modified: trunk/ui/setup.py
==============================================================================
--- trunk/ui/setup.py (original)
+++ trunk/ui/setup.py Tue Jan 22 14:52:31 2008
@@ -34,6 +34,11 @@
import os
import stat
+# We require python 2.5 or later, so complain if that isn't satisfied.
+if sys.version.split()[0] < '2.5':
+ print "Python 2.5 or later required."
+ sys.exit(1)
+
# try to be clever and add the install prefix to the path
# to be sure kaa.base and freevo.core can be found
for pos, arg in enumerate(sys.argv[1:]):
Modified: trunk/ui/src/audio/player.py
==============================================================================
--- trunk/ui/src/audio/player.py (original)
+++ trunk/ui/src/audio/player.py Tue Jan 22 14:52:31 2008
@@ -83,13 +83,12 @@
# Try to get AUDIO resource. The ressouce will be freed by the system
# when the application switches to STATUS_STOPPED or STATUS_IDLE.
blocked = self.get_resources('AUDIO', force=True)
+ if not blocked.is_finished():
+ blocked.connect(retry)
+ return True
if blocked == False:
log.error("Can't get Audio resource.")
return False
- if isinstance(blocked, kaa.InProgress):
- blocked.connect(retry)
- return True
-
# Store item and playlist. We need to keep the playlist object
# here to make sure it is not deleted when player is running in
# the background.
@@ -220,13 +219,11 @@
yield False
if self.player.get_state() == kaa.popcorn.STATE_PLAYING:
yield False
- blocked = self.get_resources('AUDIO')
+ blocked = yield self.get_resources('AUDIO')
if blocked == False:
# FIXME: what to do in this case?
log.error('unable to get AUDIO ressource')
yield False
- if isinstance(blocked, kaa.InProgress):
- yield blocked
self.player.resume()
yield kaa.YieldCallback(self.player.signals['play'])
Modified: trunk/ui/src/games/player.py
==============================================================================
--- trunk/ui/src/games/player.py (original)
+++ trunk/ui/src/games/player.py Tue Jan 22 14:52:31 2008
@@ -85,12 +85,12 @@
# by the system when the application switches to STATUS_STOPPED or
# STATUS_IDLE.
blocked = self.get_resources('AUDIO', 'VIDEO', 'JOYSTICK', force=True)
+ if not blocked.is_finished():
+ blocked.connect(retry)
+ return True
if blocked == False:
log.error("Can't get resource AUDIO, VIDEO, JOYSTICK")
return False
- if isinstance(blocked, kaa.InProgress):
- blocked.connect(retry)
- return True
# store item
self.item = item
Modified: trunk/ui/src/gui/areas/tvlisting_area.py
==============================================================================
--- trunk/ui/src/gui/areas/tvlisting_area.py (original)
+++ trunk/ui/src/gui/areas/tvlisting_area.py Tue Jan 22 14:52:31 2008
@@ -272,10 +272,10 @@
col_time = 30
self.channels = kaa.epg.get_channels(sort=True)
- if isinstance(self.channels, kaa.InProgress):
- while not self.channels.is_finished():
- kaa.main.step()
- self.channels = self.channels()
+ while not self.channels.is_finished():
+ # FIXME: InProgress waiting, make it work without step()
+ kaa.main.step()
+ self.channels = self.channels.get_result()
if self.last_settings == self.settings:
# same layout, only clean 'objects'
Modified: trunk/ui/src/image/plugins/calendar.py
==============================================================================
--- trunk/ui/src/image/plugins/calendar.py (original)
+++ trunk/ui/src/image/plugins/calendar.py Tue Jan 22 14:52:31 2008
@@ -80,10 +80,7 @@
yield result.wait()
if len(result) == 1:
all.append((start[self.query[1]], result[0]))
- items = self.get_items(all)
- if isinstance(items, kaa.InProgress):
- yield items
- items = items.get_result()
+ items = yield self.get_items(all)
menu = Menu(self.name, items, type='image')
menu.autoselect = True
self.get_menustack().pushmenu(menu)
Modified: trunk/ui/src/tv/favorite.py
==============================================================================
--- trunk/ui/src/tv/favorite.py (original)
+++ trunk/ui/src/tv/favorite.py Tue Jan 22 14:52:31 2008
@@ -170,11 +170,8 @@
@kaa.yield_execution()
def add(self):
- result = tvserver.favorites.add(self.title, self.channels, self.days,
+ result = yield tvserver.favorites.add(self.title, self.channels,
self.days,
[self._time_to_str()], 50, False)
- if isinstance(result, kaa.InProgress):
- yield result
- result = result()
if result != tvserver.favorites.SUCCESS:
text = _('Adding favorite Failed')+(': %s' % result)
else:
@@ -185,10 +182,7 @@
@kaa.yield_execution()
def remove(self):
- result = tvserver.favorites.remove(self.id)
- if isinstance(result, kaa.InProgress):
- yield result
- result = result()
+ result = yield tvserver.favorites.remove(self.id)
if result != tvserver.favorites.SUCCESS:
text = _('Remove favorite Failed')+(': %s' % result)
else:
@@ -198,10 +192,7 @@
@kaa.yield_execution()
def modify(self, info):
- result = tvserver.favorites.modify(self.id, info)
- if isinstance(result, kaa.InProgress):
- yield result
- result = result()
+ result = yield tvserver.favorites.modify(self.id, info)
if result != tvserver.favorites.SUCCESS:
text = _('Modified favorite Failed')+(': %s' % result)
MessageWindow(text).show()
Modified: trunk/ui/src/tv/plugins/directory.py
==============================================================================
--- trunk/ui/src/tv/plugins/directory.py (original)
+++ trunk/ui/src/tv/plugins/directory.py Tue Jan 22 14:52:31 2008
@@ -48,9 +48,6 @@
@kaa.yield_execution()
def browse(self, parent):
- record_dir = kaa.beacon.get(config.tv.plugin.directory.path)
- if isinstance(record_dir, kaa.InProgress):
- yield record_dir
- record_dir = record_dir.get_result()
+ record_dir = yield kaa.beacon.get(config.tv.plugin.directory.path)
d = DirItem(record_dir, parent, type='tv')
d.browse()
Modified: trunk/ui/src/tv/plugins/genre.py
==============================================================================
--- trunk/ui/src/tv/plugins/genre.py (original)
+++ trunk/ui/src/tv/plugins/genre.py Tue Jan 22 14:52:31 2008
@@ -82,16 +82,13 @@
# query epg in background
if self.cat:
if self.name==ALL_GENRE:
- query_data = kaa.epg.search(category=self.cat, time=future)
+ query_data = yield kaa.epg.search(category=self.cat,
time=future)
else:
- query_data = kaa.epg.search(genre=self.name,
- category=self.cat,
- time=future)
+ query_data = yield kaa.epg.search(genre=self.name,
+ category=self.cat,
+ time=future)
else:
- query_data = kaa.epg.search(genre=self.name, time=future)
- yield query_data
- # fetch epg data from InProgress object
- query_data = query_data()
+ query_data = yield kaa.epg.search(genre=self.name, time=future)
for prg in query_data:
items.append(ProgramItem(prg, self))
# create menu for programs
@@ -125,15 +122,12 @@
if self.name==ALL_CAT:
# query epg in background for all genres
- query_data = kaa.epg.search(attrs=['genre'], distinct=True)
+ query_data = yield kaa.epg.search(attrs=['genre'], distinct=True)
else:
# query epg in background for a specific category
- query_data = kaa.epg.search(attrs=['genre'], category=self.name,
- distinct=True)
+ query_data = yield kaa.epg.search(attrs=['genre'],
category=self.name,
+ distinct=True)
- yield query_data
- # fetch epg data from InProgress object
- query_data = query_data()
query_data.sort()
if not self.name == ALL_CAT:
items.append(GenreItem(self.parent, ALL_GENRE, self.name))
@@ -169,10 +163,7 @@
items = []
# look if there is category data in the epg data
- query_data = kaa.epg.search(attrs=['category'], distinct=True)
- yield query_data
- # fetch epg data from InProgress object
- query_data = query_data()
+ query_data = yield kaa.epg.search(attrs=['category'], distinct=True)
query_data.sort()
if len(query_data) > 1:
items.append(CategoryItem(parent, ALL_CAT))
@@ -182,10 +173,7 @@
items.append(CategoryItem(parent, cat))
else:
# maybe there is only genre data in the epg
- query_data = kaa.epg.search(attrs=['genre'], distinct=True)
- yield query_data
- # fetch epg data from InProgress object
- query_data = query_data()
+ query_data = yield kaa.epg.search(attrs=['genre'], distinct=True)
query_data.sort()
for genre, in query_data:
if genre not in EXCLUDE_GENRES:
Modified: trunk/ui/src/tv/plugins/guide.py
==============================================================================
--- trunk/ui/src/tv/plugins/guide.py (original)
+++ trunk/ui/src/tv/plugins/guide.py Tue Jan 22 14:52:31 2008
@@ -73,11 +73,10 @@
# current channel is the first one
self.channels = kaa.epg.get_channels(sort=True)
- # FIXME: make it work without step()
- if isinstance(self.channels, kaa.InProgress):
- while not self.channels.is_finished():
- kaa.main.step()
- self.channels = self.channels()
+ while not self.channels.is_finished():
+ # FIXME: InProgress waiting, make it work without step()
+ kaa.main.step()
+ self.channels = self.channels.get_result()
self.channel = self.get_channel()
# current program is the current running
@@ -113,9 +112,7 @@
timestamp = self.current_time
log.info('channel: %s time %s', self.channel, timestamp)
- wait = kaa.epg.search(channel=self.channel, time=timestamp)
- yield wait
- prg = wait()
+ prg = yield kaa.epg.search(channel=self.channel, time=timestamp)
if prg:
# one program found, return it
@@ -123,18 +120,14 @@
else:
# Now we are in trouble, there is no program item. We need to
create a fake
# one between the last stop and the next start time. This is very
slow!!!
- wait = kaa.epg.search(channel=self.channel, time=(0, timestamp))
- yield wait
- p = wait()
+ p = yield kaa.epg.search(channel=self.channel, time=(0, timestamp))
p.sort(lambda x,y: cmp(x.start, y.start))
if p:
start = p[-1].stop
else:
start = 0
- wait = kaa.epg.search(channel=self.channel, time=(timestamp,
sys.maxint))
- yield wait
- p = wait()
+ p = yield kaa.epg.search(channel=self.channel, time=(timestamp,
sys.maxint))
p.sort(lambda x,y: cmp(x.start, y.start))
if p:
stop = p[0].start
Modified: trunk/ui/src/tv/plugins/testguide.py
==============================================================================
--- trunk/ui/src/tv/plugins/testguide.py (original)
+++ trunk/ui/src/tv/plugins/testguide.py Tue Jan 22 14:52:31 2008
@@ -82,11 +82,10 @@
# current channel is the first one
self.channels = kaa.epg.get_channels(sort=True)
- # FIXME: make it work without step()
- if isinstance(self.channels, kaa.InProgress):
- while not self.channels.is_finished():
- kaa.main.step()
- self.channels = self.channels()
+ while not self.channels.is_finished():
+ # FIXME: InProgress waiting, make it work without step()
+ kaa.main.step()
+ self.channels = self.channels.get_result()
self.query_start_time = self.viewed_time
self.query_stop_time = 0
@@ -152,10 +151,8 @@
for channel in self.channels:
programs = []
# query the epg database in background
- wait = kaa.epg.search(channel=channel,
time=(self.query_start_time, self.query_stop_time))
- yield wait
- # get data from InProgress object
- query_data = wait()
+ query_data = yield kaa.epg.search(
+ channel=channel, time=(self.query_start_time,
self.query_stop_time))
#Sort the programs
query_data.sort(lambda x,y: cmp(x.start, y.start))
for data in query_data:
Modified: trunk/ui/src/tv/program.py
==============================================================================
--- trunk/ui/src/tv/program.py (original)
+++ trunk/ui/src/tv/program.py Tue Jan 22 14:52:31 2008
@@ -292,10 +292,7 @@
"""
schedule this item for recording
"""
- result = tvserver.recordings.schedule(self)
- if isinstance(result, kaa.InProgress):
- yield result
- result = result()
+ result = yield tvserver.recordings.schedule(self)
if result == tvserver.recordings.SUCCESS:
msg = _('"%s" has been scheduled for recording') % self.title
#reload scheduled
@@ -313,10 +310,7 @@
"""
remove this item from schedule
"""
- result = tvserver.recordings.remove(self.scheduled.id)
- if isinstance(result, kaa.InProgress):
- yield result
- result = result()
+ result = yield tvserver.recordings.remove(self.scheduled.id)
if result == tvserver.recordings.SUCCESS:
msg = _('"%s" has been removed') % self.title
#reload scheduled
@@ -342,10 +336,7 @@
future = (int(time.time()), sys.maxint)
# query the epg database in background
channel = kaa.epg.get_channel(self.channel)
- query_data = kaa.epg.search(channel=channel, time=future)
- yield query_data
- # get data from InProgress object
- query_data = query_data()
+ query_data = yield kaa.epg.search(channel=channel, time=future)
for prog in query_data:
items.append(ProgramItem(prog, self))
cmenu = Menu(self.channel, items, type = 'tv program menu')
@@ -376,10 +367,7 @@
# create an empty list for ProgramItems
items = []
# query the epg database in background
- query_data = kaa.epg.search(title=self.title, time=future)
- yield query_data
- # get data from InProgress object
- query_data = query_data()
+ query_data = yield kaa.epg.search(title=self.title, time=future)
# and sort is concerning its start times
query_data.sort(lambda a,b:cmp(a.start,b.start))
for prog in query_data:
Modified: trunk/ui/src/video/player.py
==============================================================================
--- trunk/ui/src/video/player.py (original)
+++ trunk/ui/src/video/player.py Tue Jan 22 14:52:31 2008
@@ -86,12 +86,12 @@
# by the system when the application switches to STATUS_STOPPED or
# STATUS_IDLE.
blocked = self.get_resources('AUDIO', 'VIDEO', force=True)
+ if not blocked.is_finished():
+ blocked.connect(retry)
+ return True
if blocked == False:
log.error("Can't get resource AUDIO, VIDEO")
return False
- if isinstance(blocked, kaa.InProgress):
- blocked.connect(retry)
- return True
# store item and playlist
self.item = item
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog