Update of /cvsroot/freevo/freevo/src/gui/areas
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22324
Modified Files:
info_area.py area.py handler.py
Log Message:
each area has it's own layer (CanvasContainer) now
Index: handler.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/handler.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** handler.py 27 Aug 2004 14:16:58 -0000 1.11
--- handler.py 7 Sep 2004 18:47:10 -0000 1.12
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.12 2004/09/07 18:47:10 dischi
+ # each area has it's own layer (CanvasContainer) now
+ #
# Revision 1.11 2004/08/27 14:16:58 dischi
# switch to new animation names
***************
*** 21,57 ****
# know that the theme is changed.
#
- # Revision 1.8 2004/08/23 20:37:02 dischi
- # cleanup fading code
- #
- # Revision 1.7 2004/08/23 15:52:58 dischi
- # fix area hide/show/fade code
- #
- # Revision 1.6 2004/08/23 15:16:02 dischi
- # removed some bad hack
- #
- # Revision 1.5 2004/08/23 15:12:24 dischi
- # wait for fade animation to finish
- #
- # Revision 1.4 2004/08/23 14:28:22 dischi
- # fix animation support when changing displays
- #
- # Revision 1.3 2004/08/23 12:35:42 dischi
- # make it possible to hide the Areahandler
- #
- # Revision 1.2 2004/08/22 20:06:18 dischi
- # Switch to mevas as backend for all drawing operations. The mevas
- # package can be found in lib/mevas. This is the first version using
- # mevas, there are some problems left, some popup boxes and the tv
- # listing isn't working yet.
- #
- # Revision 1.1 2004/08/14 15:07:34 dischi
- # New area handling to prepare the code for mevas
- # o each area deletes it's content and only updates what's needed
- # o work around for info and tvlisting still working like before
- # o AreaHandler is no singleton anymore, each type (menu, tv, player)
- # has it's own instance
- # o clean up old, not needed functions/attributes
- #
- #
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
--- 24,27 ----
***************
*** 78,81 ****
--- 48,52 ----
import os
import traceback
+ import time
import mevas
***************
*** 84,145 ****
import gui.animation as animation
- class AreaScreen:
- def __init__(self, display, imagelib):
- self.layer = []
- # add 3 layer for drawing (based on how ofter they change):
- for i in range(3):
- c = mevas.CanvasContainer()
- c.sticky = True
- self.layer.append(c)
- display.add_child(c)
- self.imagelib = imagelib
- self.display = display
- self.width = display.width
- self.height = display.height
-
-
- def show(self):
- """
- show the layer on the display
- """
- for l in self.layer:
- l.set_alpha(255)
- l.show()
-
-
- def hide(self):
- """
- hide all layers
- """
- for l in self.layer:
- l.hide()
-
-
- def destroy(self):
- """
- destroy all layer
- """
- for l in self.layer:
- l.unparent()
-
-
- def fade_out(self, frames):
- """
- fade out layer and hide them
- """
- a = animation.FadeAnimation(self.layer, frames, 255, 0)
- a.application = True
- a.start()
-
-
- def fade_in(self, frames):
- """
- show layers again and fade them in
- """
- a = animation.FadeAnimation(self.layer, frames, 0, 255)
- a.application = True
- a.start()
-
-
class AreaHandler:
"""
--- 55,58 ----
***************
*** 158,164 ****
self.canvas = screen
- self.screen = AreaScreen(screen, imagelib)
- self.screen.hide()
# load default areas
from listing_area import Listing_Area
--- 71,81 ----
self.canvas = screen
+ self.layer = []
+
+ self.imagelib = imagelib
+ self.width = self.canvas.width
+ self.height = self.canvas.height
+
# load default areas
from listing_area import Listing_Area
***************
*** 175,180 ****
for a in self.areas:
! a.set_screen(self.screen)
!
self.storage_file = os.path.join(config.FREEVO_CACHEDIR, 'skin-%s' %
os.getuid())
self.storage = util.read_pickle(self.storage_file)
--- 92,102 ----
for a in self.areas:
! a.set_screen(self)
! c = a.layer
! c.sticky = True
! c.hide()
! self.layer.append(c)
! self.canvas.add_child(c)
!
self.storage_file = os.path.join(config.FREEVO_CACHEDIR, 'skin-%s' %
os.getuid())
self.storage = util.read_pickle(self.storage_file)
***************
*** 193,197 ****
self.areas[0].clear_all()
del self.areas[0]
! self.screen.destroy()
self.container = None
--- 115,120 ----
self.areas[0].clear_all()
del self.areas[0]
! for l in self.layer:
! l.unparent()
self.container = None
***************
*** 334,340 ****
if self.visible:
if fade:
! self.screen.fade_out(fade)
else:
! self.screen.hide()
self.visible = False
--- 257,266 ----
if self.visible:
if fade:
! a = animation.FadeAnimation(self.layer, fade, 255, 0)
! a.application = True
! a.start()
else:
! for l in self.layer:
! l.hide()
self.visible = False
***************
*** 346,355 ****
if not self.visible:
if fade:
! self.screen.fade_in(fade)
else:
! self.screen.show()
self.canvas.update()
self.visible = True
def draw(self, object):
"""
--- 272,286 ----
if not self.visible:
if fade:
! a = animation.FadeAnimation(self.layer, fade, 0, 255)
! a.application = True
! a.start()
else:
! for l in self.layer:
! l.set_alpha(255)
! l.show()
self.canvas.update()
self.visible = True
+
def draw(self, object):
"""
***************
*** 418,426 ****
--- 349,361 ----
infoitem = object
+ t1 = time.time()
try:
for a in self.areas:
a.draw(theme, object, viewitem, infoitem, area_definitions)
+ t2 = time.time()
if self.visible:
self.canvas.update()
+ t3 = time.time()
+ _debug_('time debug: %s %s' % (t2-t1, t3-t2), 2)
except UnicodeError, e:
***************
*** 434,440 ****
print
print self.type, object
! # if hasattr(object, 'choices'):
! # for i in object.choices:
! # print i
print
raise UnicodeError, e
--- 369,375 ----
print
print self.type, object
! if hasattr(object, 'choices'):
! for i in object.choices:
! print i
print
raise UnicodeError, e
Index: info_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/info_area.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** info_area.py 23 Aug 2004 15:11:50 -0000 1.5
--- info_area.py 7 Sep 2004 18:47:10 -0000 1.6
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.6 2004/09/07 18:47:10 dischi
+ # each area has it's own layer (CanvasContainer) now
+ #
# Revision 1.5 2004/08/23 15:11:50 dischi
# avoid redraw when not needed
***************
*** 110,114 ****
self.canvas.unparent()
self.canvas = t
! self.screen.layer[2].add_child(t)
self.last_item = self.infoitem
self.last_content = self.content
--- 113,117 ----
self.canvas.unparent()
self.canvas = t
! self.layer.add_child(t)
self.last_item = self.infoitem
self.last_content = self.content
Index: area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/area.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** area.py 27 Aug 2004 14:17:15 -0000 1.13
--- area.py 7 Sep 2004 18:47:10 -0000 1.14
***************
*** 28,31 ****
--- 28,34 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.14 2004/09/07 18:47:10 dischi
+ # each area has it's own layer (CanvasContainer) now
+ #
# Revision 1.13 2004/08/27 14:17:15 dischi
# remove old plugin code
***************
*** 111,114 ****
--- 114,119 ----
import os
+ import mevas
+
import config
import util
***************
*** 143,147 ****
--- 148,160 ----
+ class CanvasContainer(mevas.CanvasContainer):
+ def __init__(self, name):
+ self.name = name
+ mevas.CanvasContainer.__init__(self)
+
+ def __str__(self):
+ return 'AreaContainer %s' % self.name
+
class Area:
"""
***************
*** 159,165 ****
self.imagelib = None
self.objects = SkinObjects()
!
self.__background__ = []
-
self.imagecache = util.objectcache.ObjectCache(imagecachesize,
desc='%s_image' % self.name)
--- 172,179 ----
self.imagelib = None
self.objects = SkinObjects()
! self.layer = CanvasContainer(name)
! if name == 'screen':
! self.layer.set_zindex(-10)
self.__background__ = []
self.imagecache = util.objectcache.ObjectCache(imagecachesize,
desc='%s_image' % self.name)
***************
*** 423,435 ****
self.__background__.append(box)
box.info = rec
!
!
for image in background_image:
imagefile, x, y, width, height = image
i = self.drawimage(imagefile, (x, y, width, height), background=True)
- i.set_zindex(-10)
if i:
self.__background__.append(i)
i.info = image
--- 437,449 ----
self.__background__.append(box)
box.info = rec
! box.set_zindex(-1)
!
for image in background_image:
imagefile, x, y, width, height = image
i = self.drawimage(imagefile, (x, y, width, height), background=True)
if i:
self.__background__.append(i)
i.info = image
+ i.set_zindex(-1)
***************
*** 452,456 ****
r = Rectangle((x, y), (width, height), rect[0], rect[1], rect[2],
rect[3])
! self.screen.layer[1].add_child(r)
return r
--- 466,470 ----
r = Rectangle((x, y), (width, height), rect[0], rect[1], rect[2],
rect[3])
! self.layer.add_child(r)
return r
***************
*** 491,495 ****
t = Text(text, (x, y), (width, height), font, align_h, align_v, mode,
ellipses, dim)
! self.screen.layer[2].add_child(t)
return t
--- 505,509 ----
t = Text(text, (x, y), (width, height), font, align_h, align_v, mode,
ellipses, dim)
! self.layer.add_child(t)
return t
***************
*** 558,565 ****
else:
i = Image(image, (x, y), (w, h))
! self.screen.layer[0].add_child(i)
else:
i = Image(image, (x, y), (w, h))
! self.screen.layer[2].add_child(i)
return i
--- 572,579 ----
else:
i = Image(image, (x, y), (w, h))
! self.layer.add_child(i)
else:
i = Image(image, (x, y), (w, h))
! self.layer.add_child(i)
return i
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog