2006-07-22 11:54:27 +02:00
|
|
|
from sugar.scene.Actor import Actor
|
|
|
|
|
|
|
|
class Group(Actor):
|
|
|
|
def __init__(self):
|
2006-07-24 11:53:02 +02:00
|
|
|
Actor.__init__(self)
|
|
|
|
|
2006-07-22 11:54:27 +02:00
|
|
|
self._actors = []
|
2006-07-22 13:48:47 +02:00
|
|
|
self._layout = None
|
2006-07-24 11:01:25 +02:00
|
|
|
|
|
|
|
def set_position(self, x, y):
|
|
|
|
Actor.set_position(self, x, y)
|
|
|
|
self._transf.set_translation(x, y)
|
2006-07-22 11:54:27 +02:00
|
|
|
|
|
|
|
def add(self, actor):
|
2006-07-24 11:53:02 +02:00
|
|
|
actor._parent = self
|
2006-07-22 11:54:27 +02:00
|
|
|
self._actors.append(actor)
|
2006-07-22 13:48:47 +02:00
|
|
|
self.do_layout()
|
2006-07-22 11:54:27 +02:00
|
|
|
|
|
|
|
def remove(self, actor):
|
|
|
|
self._actors.remove(actor)
|
2006-07-22 13:48:47 +02:00
|
|
|
self.do_layout()
|
2006-07-22 12:28:59 +02:00
|
|
|
|
|
|
|
def get_actors(self):
|
|
|
|
return self._actors
|
|
|
|
|
2006-07-22 13:48:47 +02:00
|
|
|
def set_layout(self, layout):
|
|
|
|
self._layout = layout
|
|
|
|
self.do_layout()
|
|
|
|
|
|
|
|
def get_layout(self):
|
|
|
|
return self._layout
|
|
|
|
|
|
|
|
def do_layout(self):
|
|
|
|
if self._layout:
|
|
|
|
self._layout.layout_group(self)
|
2006-07-22 11:54:27 +02:00
|
|
|
|
2006-07-24 11:53:02 +02:00
|
|
|
def render(self, drawable):
|
2006-07-22 11:54:27 +02:00
|
|
|
for actor in self._actors:
|
2006-07-24 11:53:02 +02:00
|
|
|
actor.render(drawable)
|