From 69ca732fa15696345899271d7059830699c2d2a7 Mon Sep 17 00:00:00 2001 From: Michael Sheldon Date: Fri, 27 Feb 2009 13:10:12 +0000 Subject: [PATCH] Update bindings to reflect new Layer gobject Make animated-marker.py set behaviours and use layers --- .../python/champlain-gtk/pychamplaingtk.defs | 4 -- bindings/python/champlain/pychamplain.defs | 44 ++++++++++--------- bindings/python/demos/animated-marker.py | 26 ++++++----- bindings/python/update-binding.sh | 3 -- 4 files changed, 39 insertions(+), 38 deletions(-) mode change 100644 => 100755 bindings/python/demos/animated-marker.py diff --git a/bindings/python/champlain-gtk/pychamplaingtk.defs b/bindings/python/champlain-gtk/pychamplaingtk.defs index da4500a..7099aae 100644 --- a/bindings/python/champlain-gtk/pychamplaingtk.defs +++ b/bindings/python/champlain-gtk/pychamplaingtk.defs @@ -27,7 +27,3 @@ ) - -;; From champlain-gtk-marshal.h - - diff --git a/bindings/python/champlain/pychamplain.defs b/bindings/python/champlain/pychamplain.defs index e3adc0b..0a84ef4 100644 --- a/bindings/python/champlain/pychamplain.defs +++ b/bindings/python/champlain/pychamplain.defs @@ -1,5 +1,12 @@ ;; -*- scheme -*- ; object definitions ... +(define-object Layer + (in-module "Champlain") + (parent "ClutterGroup") + (c-name "ChamplainLayer") + (gtype-id "CHAMPLAIN_TYPE_LAYER") +) + (define-object Marker (in-module "Champlain") (parent "ClutterGroup") @@ -39,6 +46,18 @@ ) ) +(define-enum StateEnum + (in-module "Champlain") + (c-name "ChamplainStateEnum") + (gtype-id "CHAMPLAIN_TYPE_STATE_ENUM") + (values + '("none" "CHAMPLAIN_STATE_NONE") + '("init" "CHAMPLAIN_STATE_INIT") + '("loading" "CHAMPLAIN_STATE_LOADING") + '("done" "CHAMPLAIN_STATE_DONE") + ) +) + ;; From champlain.h @@ -119,12 +138,15 @@ ;; From champlain-layer.h +(define-function layer_get_type + (c-name "champlain_layer_get_type") + (return-type "GType") +) + (define-function layer_new (c-name "champlain_layer_new") (is-constructor-of "ChamplainLayer") (return-type "ChamplainLayer*") - (parameters - ) ) @@ -188,21 +210,3 @@ ) - -;; From champlain-marshal.h - - - -;; From champlain-enum-types.h - -(define-function map_source_get_type - (c-name "champlain_map_source_get_type") - (return-type "GType") -) - -(define-function scroll_mode_get_type - (c-name "champlain_scroll_mode_get_type") - (return-type "GType") -) - - diff --git a/bindings/python/demos/animated-marker.py b/bindings/python/demos/animated-marker.py old mode 100644 new mode 100755 index d699152..2930bb8 --- a/bindings/python/demos/animated-marker.py +++ b/bindings/python/demos/animated-marker.py @@ -14,8 +14,6 @@ def create_marker(): orange = clutter.Color(0xf3, 0x94, 0x07, 0xbb) white = clutter.Color(0xff, 0xff, 0xff, 0xff) timeline = clutter.Timeline() - #behaviour = clutter.Behaviour() - alpha = clutter.Alpha() marker = champlain.Marker() bg = cluttercairo.CairoTexture(MARKER_SIZE, MARKER_SIZE) @@ -54,14 +52,20 @@ def create_marker(): timeline.set_duration(1000) timeline.set_loop(True) + + alpha = clutter.Alpha() + alpha.set_timeline(timeline) + alpha.set_func(clutter.sine_inc_func) + + behaviour = clutter.BehaviourScale(0.5, 0.5, 2.0, 2.0) #alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE_INC, NULL, g_object_unref); + behaviour.set_alpha(alpha) + behaviour.apply(bg) -#behaviour = clutter_behaviour_scale_new (alpha, 0.5, 0.5, 2.0, 2.0); - # clutter_behaviour_apply (behaviour, bg); - - #behaviour = clutter_behaviour_opacity_new (alpha, 255, 0); - #clutter_behaviour_apply (behaviour, bg); + behaviour = clutter.BehaviourOpacity(255, 0) + behaviour.set_alpha(alpha) + behaviour.apply(bg) timeline.start() @@ -83,12 +87,12 @@ def main(): actor.set_size(800, 600) stage.add(actor) - #layer = champlain.Layer() - #layer.show() - #actor.add_layer(layer) + layer = champlain.Layer() + layer.show() + actor.add_layer(layer) marker = create_marker() - actor.add(marker) + layer.add(marker) # Finish initialising the map view actor.set_property("zoom-level", 5) diff --git a/bindings/python/update-binding.sh b/bindings/python/update-binding.sh index d45e6bd..4ea6b5b 100755 --- a/bindings/python/update-binding.sh +++ b/bindings/python/update-binding.sh @@ -10,8 +10,6 @@ python /usr/share/pygobject/2.0/codegen/h2def.py \ champlain-defines.h \ champlain-layer.h \ champlain-marker.h \ - champlain-marshal.h \ - champlain-enum-types.h \ > ../bindings/python/champlain/pychamplain.defs # Update the list of headers from Makefile.am @@ -20,7 +18,6 @@ python /usr/share/pygobject/2.0/codegen/h2def.py \ -m champlain \ champlain-gtk.h \ champlain-view-embed.h \ - champlain-gtk-marshal.h \ > ../bindings/python/champlain-gtk/pychamplaingtk.defs # Keep original version -- 2.39.5