Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorent <florent.pigout@gmail.com>2011-04-28 20:21:37 (GMT)
committer florent <florent.pigout@gmail.com>2011-04-28 20:21:37 (GMT)
commitf4460e57fb45474f9c6737fe46d077e11041f75d (patch)
treeaf761a321c5a4851d36b13f2df231fcca683afae
parentdd596468ee0bb61b016ff87e86d75a236731f9f2 (diff)
add on click cb when clicking image in scene
-rw-r--r--atoidejouer/ui/screens.py34
1 files changed, 26 insertions, 8 deletions
diff --git a/atoidejouer/ui/screens.py b/atoidejouer/ui/screens.py
index a4df397..fd1be69 100644
--- a/atoidejouer/ui/screens.py
+++ b/atoidejouer/ui/screens.py
@@ -36,12 +36,7 @@ COLOR_GREY_WHITE = ui.get_color(0.85, 0.85, 0.85)
COLOR_WHITE = ui.get_color(1.0, 1.0, 1.0)
-def _on_image_clicked(screen, widget, sequence_name):
- # .. do update
- screen.timeline.set_active_sequence(sequence_name)
-
-
-def _on_drag_finish(image, scene, keys, size):
+def _on_drag_finish(image, event, scene, size):
# _align = self._get_keys('graphics').set_align(sequence_name,
# frame, _current)
# DEBUG
@@ -60,6 +55,21 @@ def _on_drag_finish(image, scene, keys, size):
# TODO - compute new align
+def _on_click(image, event, scene, sequence_name):
+ # get current screen
+ _screen = scene.toolbar.activity.get_current_screen()
+ # update timeline
+ if hasattr(_screen, 'timeline'):
+ _screen.timeline.set_active_sequence(sequence_name)
+ else:
+ pass
+ # update panel
+ if hasattr(_s, 'panel'):
+ _screen.panel.refresh()
+ else:
+ pass
+
+
class ScreenStory(graphics.Scene):
def __init__(self, toolbar, height_offset=0, width_offset=0,
@@ -274,9 +284,11 @@ class ScreenStory(graphics.Scene):
# ..
_image.visible = True
else:
+ # draggable for edit only
+ _draggable = self._set_canvas is False
# ..
_image = self.__update_drawing_area(_current, _size, _align,
- sequence_name=sequence_name, draggable=True)
+ sequence_name=sequence_name, draggable=_draggable)
# ..
self.__graphics[_code] = _image
# ..
@@ -301,7 +313,7 @@ class ScreenStory(graphics.Scene):
_z_order = 1000
else:
_z_order = self._get_keys('graphics').get_layout(sequence_name)
- # image - TODO - draggable = True
+ # image
_image = graphics.Image(_path, x=_x, y=_y, scale_x=_scale,
scale_y=_scale, z_order=_z_order, draggable=draggable)
# connect drag
@@ -309,6 +321,12 @@ class ScreenStory(graphics.Scene):
pass
else:
_image.connect('on-drag-finish', _on_drag_finish, self, (_w, _h))
+ # connect on click
+ if sequence_name is None:
+ pass
+ else:
+ _image.connect('on-click', _on_click, self, sequence_name)
+ _image.connect('on-drag-start', _on_click, self, sequence_name)
# do add
self.add_child(_image)
# ..