gcompris r3717 - in branches/gcomprixogoo: . src/anim-activity
- From: bcoudoin svn gnome org
- To: svn-commits-list gnome org
- Subject: gcompris r3717 - in branches/gcomprixogoo: . src/anim-activity
- Date: Sun, 1 Feb 2009 17:26:41 +0000 (UTC)
Author: bcoudoin
Date: Sun Feb 1 17:26:41 2009
New Revision: 3717
URL: http://svn.gnome.org/viewvc/gcompris?rev=3717&view=rev
Log:
Implemented raise/lower
Fixed color menu not being on the top
There is still a broken code because the animation is not working at all.
Modified:
branches/gcomprixogoo/ (props changed)
branches/gcomprixogoo/src/anim-activity/AnimItem.py
branches/gcomprixogoo/src/anim-activity/Color.py
branches/gcomprixogoo/src/anim-activity/Timeline.py
branches/gcomprixogoo/src/anim-activity/anim.py
Modified: branches/gcomprixogoo/src/anim-activity/AnimItem.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/AnimItem.py (original)
+++ branches/gcomprixogoo/src/anim-activity/AnimItem.py Sun Feb 1 17:26:41 2009
@@ -34,7 +34,6 @@
self.anim = anim
self.rootitem = goocanvas.Group(parent = anim.rootitem)
self.drawing_area = anim.drawing_area
- self.step = anim.current_step
gcompris.sound.play_ogg("sounds/bleep.wav")
self.step = 1
@@ -218,12 +217,18 @@
print self.visible
def raise_(self):
- print "raise"
- self.item.raise_(None)
+ parent = self.item.get_parent()
+ rootparent = parent.get_parent()
+ child_num = rootparent.find_child (parent);
+ if child_num < rootparent.get_n_children() - 1:
+ rootparent.move_child (child_num, child_num + 1);
def lower(self):
- print "lower"
- self.item.lower(None)
+ parent = self.item.get_parent()
+ rootparent = parent.get_parent()
+ child_num = rootparent.find_child (parent);
+ if child_num > 0:
+ rootparent.move_child (child_num, child_num - 1);
def rotate(self, angle):
Modified: branches/gcomprixogoo/src/anim-activity/Color.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/Color.py (original)
+++ branches/gcomprixogoo/src/anim-activity/Color.py Sun Feb 1 17:26:41 2009
@@ -35,6 +35,7 @@
def __init__(self, rootitem, drawing_area):
self.rootitem = goocanvas.Group(parent = rootitem)
+ self.root_coloritem = goocanvas.Group(parent = rootitem)
self.drawing_area = drawing_area
self.running = False
# Part of UI: colors buttons
@@ -103,10 +104,6 @@
c = 0
- self.root_coloritem = \
- goocanvas.Group(
- parent = self.rootitem,
- )
self.root_coloritem.props.visibility = goocanvas.ITEM_INVISIBLE
@@ -143,6 +140,7 @@
if self.previous_color:
self.root_coloritem.props.visibility = goocanvas.ITEM_INVISIBLE
+ self.root_coloritem.lower(None)
if fill:
self.fill = self.previous_color
else:
@@ -152,6 +150,7 @@
else:
self.root_coloritem.props.visibility = goocanvas.ITEM_VISIBLE
+ self.root_coloritem.raise_(None)
if fill:
self.previous_color = self.fill
@@ -167,8 +166,7 @@
if event.type == gtk.gdk.BUTTON_PRESS:
gcompris.sound.play_ogg("sounds/drip.wav")
- if event.button == 1:
- self.previous_color = 0L
+ self.previous_color = 0L
if self.stroke == 0L:
self.stroke = color
@@ -178,4 +176,5 @@
self.fillcolor_tool.set_properties(fill_color_rgba = color)
self.root_coloritem.props.visibility = goocanvas.ITEM_INVISIBLE
+ self.root_coloritem.lower(None)
Modified: branches/gcomprixogoo/src/anim-activity/Timeline.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/Timeline.py (original)
+++ branches/gcomprixogoo/src/anim-activity/Timeline.py Sun Feb 1 17:26:41 2009
@@ -130,7 +130,7 @@
self.current_time = item.get_data("time")
# Let anim knows there is a new time set
- self.anim.refresh(self.get_time())
+ #self.anim.refresh(self.get_time())
#
def timeline_item_event(self, item, target, event):
Modified: branches/gcomprixogoo/src/anim-activity/anim.py
==============================================================================
--- branches/gcomprixogoo/src/anim-activity/anim.py (original)
+++ branches/gcomprixogoo/src/anim-activity/anim.py Sun Feb 1 17:26:41 2009
@@ -81,9 +81,6 @@
# draw is adapted to little kids : big anchors
self.DEFAULT_ANCHOR_SIZE = 12
- # Step used in grid is wider
- self.grid_step = 10
-
# draw specific UI
self.selector_section = "draw2"
else:
@@ -92,9 +89,6 @@
# Normal anchors
self.DEFAULT_ANCHOR_SIZE = 8
- # Step used in grid is wider
- self.grid_step = 5
-
# anim specific UI
self.selector_section = "anim2"
@@ -128,17 +122,14 @@
["FLIP", "anim/tool-flip.png", "anim/tool-flip_on.png", gcompris.CURSOR_DEFAULT],
["RAISE", "anim/tool-up.png", "anim/tool-up_on.png", gcompris.CURSOR_DEFAULT],
["LOWER", "anim/tool-down.png", "anim/tool-down_on.png", gcompris.CURSOR_DEFAULT],
- ["CCW", "anim/tool-rotation-ccw.png", "anim/tool-rotation-ccw_on.png", gcompris.CURSOR_DEFAULT],
- ["CW", "anim/tool-rotation-cw.png", "anim/tool-rotation-cw_on.png", gcompris.CURSOR_DEFAULT],
+# FIXME NEED A CLEAN IMPLEMENTATION OF THE ROTATION
+# ["CCW", "anim/tool-rotation-ccw.png", "anim/tool-rotation-ccw_on.png", gcompris.CURSOR_DEFAULT],
+# ["CW", "anim/tool-rotation-cw.png", "anim/tool-rotation-cw_on.png", gcompris.CURSOR_DEFAULT],
]
# keep the tool selected
self.current_tool=0
- # step of the grid used for positioning objects
- # TODO : add a parameters to put step=5 in draw and step=1 in anim
- self.current_step = 0
-
# selected object
self.selected = None
@@ -150,12 +141,6 @@
self.drawing_area = [124.0, 20.0, gcompris.BOARD_WIDTH - 15, gcompris.BOARD_HEIGHT - 40]
self.playing_area = [124.0, 20.0, gcompris.BOARD_WIDTH - 15, gcompris.BOARD_HEIGHT - 40]
- # Global used for the select event
- #
- # used to keep the distance between pointer and corner in moving objects
- self.in_select_ofx = -1
- self.in_select_ofy = -1
-
# The frame counter
# TODO : check if used
self.item_frame_counter = []
@@ -168,19 +153,6 @@
# The root items
self.root_toolitem = []
- # Anim2 variables
- # animlist is the full list of all items.
- # each item is keeped with it's frame information
- # - frames where it's modified
- # - all modifications for each frame
- #
- # list of items in the full animation
- self.animlist = []
- # list of z values in last shot
- self.list_z_last_shot = []
- # list of actual z values
- self.list_z_actual = []
-
# used to handle draw creation of object
self.created_object = None
@@ -211,7 +183,7 @@
self.color = Color(self.rootitem, self.drawing_area)
self.color.draw()
- self.draw_drawing_area(self.grid_step)
+ self.draw_drawing_area()
self.draw_playing_area()
gcompris.bar_set(0)
@@ -421,20 +393,14 @@
return False
elif (self.tools[tool][0] == "MOVIE"):
- if len(self.animlist) == 0:
- print 'Mmm... Need to make shots before run anim !!'
- return False
-
if not self.running:
- # unselect object if necessary
- #self.anim_item_unselect()
+ self.deselect()
self.playing_start()
return False
- elif (self.tools[tool][0] != "SELECT") and (self.selected):
- #self.anim_item_unselect()
- pass
+ elif (self.tools[tool][0] != "SELECT"):
+ self.deselect()
#
# Normal case, tool button switch
@@ -453,7 +419,7 @@
# Display the drawing area
- def draw_drawing_area(self,step):
+ def draw_drawing_area(self):
x1 = self.drawing_area[0]
y1 = self.drawing_area[1]
@@ -481,7 +447,6 @@
goocanvas.Group(
parent = self.rootitem,
)
- self.draw_grid(x1,x2,y1,y2,step)
# Create the root_anim group which contains all the drawings.
# At root_anim root, there is a group for each drawings.
@@ -495,7 +460,6 @@
int(self.playing_area[1]-self.drawing_area[1])
)
- # Create a group for the first drawing
# Display the drawing area
def draw_playing_area(self):
@@ -591,46 +555,10 @@
self.refresh_loop)
self.speed_item.set_properties(text = self.anim_speed)
- # Draw the grid
- #
- def draw_grid(self, x1, x2, y1, y2, step):
-
- self.current_step = step
-
- color = 0x1D0DFFFFL
-
- self.grid = \
- goocanvas.Group(
- parent = self.rootitem,
- )
- self.grid.props.visibility = goocanvas.ITEM_INVISIBLE
-
- for i in range(int(x1), int(x2), step):
- item = \
- goocanvas.Polyline(
- parent = self.grid,
- points = goocanvas.Points([(i , y1), (i , y2)]),
- fill_color_rgba=color,
- line_width=1.0,
- )
- # Clicking on lines let you create object
- item.connect("button_press_event", self.item_event)
- item.connect("button_release_event", self.item_event)
- item.connect("motion_notify_event", self.item_event)
-
- for i in range(int(y1), int(y2), step):
- item = \
- goocanvas.Polyline(
- parent = self.grid,
- points= goocanvas.Points([(x1, i), (x2 , i)]),
- fill_color_rgba=color,
- line_width=1.0,
- )
- item.connect("button_press_event", self.item_event)
- item.connect("button_release_event", self.item_event)
- item.connect("motion_notify_event", self.item_event)
-
-
+ def deselect(self):
+ if self.selected:
+ self.selected.deselect()
+ self.selected = None
# Main callback on item comes here first
# And are then dispatched to the proper functions
@@ -646,9 +574,7 @@
animItem = item.get_data("AnimItem")
if not animItem:
- if self.selected:
- self.selected.deselect()
- self.selected = None
+ self.deselect()
else:
if self.tools[self.current_tool][0] == "FILL":
animItem.fill(self.color.fill,
@@ -703,7 +629,7 @@
target)
# We keep all object in a unique list
- self.animlist.append(self.created_object)
+ #self.animlist.append(self.created_object)
#
# MOTION EVENT
@@ -742,12 +668,6 @@
return False
- def refresh(self, time):
- # We keep all object in a unique list
- # Here we order them to refresh them for the given time
- for item in self.animlist:
- item.display_at_time(time)
-
def refresh_loop(self):
self.timeline.next()
return True
@@ -832,5 +752,3 @@
fles.created_object.create_item_event(fles.root_drawingitem,
fles.root_drawingitem)
- # We keep all object in a unique list
- fles.animlist.append(fles.created_object)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]