]> err.no Git - libchamplain/commitdiff
Sync wtih clutter 1.0 api
authorVictor Godoy Poluceno <victorpoluceno@gmail.com>
Thu, 6 Aug 2009 21:10:02 +0000 (18:10 -0300)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Thu, 3 Sep 2009 23:56:45 +0000 (19:56 -0400)
bindings/python/demos/animated-marker.py
bindings/python/demos/launcher-gtk.py
bindings/python/demos/launcher.py
bindings/python/demos/polygons.py

index 238592c8ef7f02c8b25db079fe1d1d5cad820881..b6d1c778a8176888ecadea7e16463d9a430ccf06 100755 (executable)
@@ -7,7 +7,6 @@
 
 import champlain
 import clutter
-import cluttercairo
 import cairo
 import math
 import gobject
@@ -29,7 +28,7 @@ class AnimatedMarker(champlain.Marker) :
             color = MARKER_COLOR
         
         #Cairo definition of the inner marker
-        bg_in = cluttercairo.CairoTexture(MARKER_SIZE, MARKER_SIZE)
+        bg_in = clutter.CairoTexture(MARKER_SIZE, MARKER_SIZE)
         cr_in = bg_in.cairo_create()
         cr_in.set_source_rgb(0, 0, 0)
         cr_in.arc(MARKER_SIZE / 2.0, MARKER_SIZE / 2.0, MARKER_SIZE / 2.0, 0, 2 * math.pi)
@@ -41,7 +40,7 @@ class AnimatedMarker(champlain.Marker) :
         bg_in.set_position(0, 0)
         
         #Cairo definition of the outside circle (that will be animated)
-        bg_out = cluttercairo.CairoTexture(2 * MARKER_SIZE, 2 * MARKER_SIZE)
+        bg_out = clutter.CairoTexture(2 * MARKER_SIZE, 2 * MARKER_SIZE)
         cr_out = bg_out.cairo_create()
         cr_out.set_source_rgb(0, 0, 0)
         cr_out.arc(MARKER_SIZE, MARKER_SIZE, 0.9 * MARKER_SIZE, 0, 2 * math.pi)
@@ -59,9 +58,7 @@ class AnimatedMarker(champlain.Marker) :
         self.timeline.set_duration(1000)
         self.timeline.set_loop(True)
 
-        self.alpha = clutter.Alpha()
-        self.alpha.set_timeline(self.timeline)
-        self.alpha.set_func(clutter.sine_inc_func)
+        self.alpha = clutter.Alpha(self.timeline, clutter.EASE_OUT_SINE)
         
         #The "growing" behaviour
         self.grow_behaviour = clutter.BehaviourScale(0.5, 0.5, 2.0, 2.0)
index 019f5c28d2a065d1db5103cf9eb638edd9e80c7f..091ed4f70058bd7cf624ffa70818c596cb9d7e04 100755 (executable)
@@ -6,7 +6,8 @@ import gobject
 import gtk
 import champlain
 import champlaingtk
-from demomarkers import DemoMarkerLayer
+
+from markers import create_marker_layer
 
 class LauncherGTK:
 
@@ -22,7 +23,7 @@ class LauncherGTK:
                self.view = champlain.View()
                self.view.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC)
        
-               self.layer = DemoMarkerLayer()
+               self.layer = create_marker_layer(self.view)
                self.view.add_layer(self.layer)
 
                embed = cluttergtk.Embed()
@@ -82,9 +83,11 @@ class LauncherGTK:
 
        def toggle_layer(self, widget):
                if widget.get_active():
-                       self.layer.show_all()
+                       self.layer.animate_in_all_markers()
+            #self.layer.show_all()
                else:
-                       self.layer.hide()
+                       self.layer.animate_out_all_markers()
+            #self.layer.hide()
 
        def zoom_changed(self, widget):
                self.view.set_property("zoom-level", self.spinbutton.get_value_as_int())
index 8c82a3a7f8bfdf33318867f424ef153f47dd812d..cb6b8127b11db69fb021131b14e5635ae86b2344 100644 (file)
@@ -27,12 +27,12 @@ def zoom_out(actor, event, view):
 def make_button(text):
     button = clutter.Group()
     button_bg = clutter.Rectangle()
-    button_bg.set_color(clutter.color_parse('white'))
+    button_bg.set_color(clutter.color_from_string('white'))
     button_bg.set_opacity(0xcc)
     button.add(button_bg)
 
-    button_text = clutter.label_new_full('Sans 10', text, \
-        clutter.color_parse('black'))
+    button_text = clutter.Text('Sans 10', text, \
+        clutter.color_from_string('black'))
     button.add(button_text)
 
     width, height = button_text.get_size()
index 56776294708503cc542f5f337d5611d15b447e76..b2f5a76fd3485368ee0c9c9c29190ea4ab63ddf2 100644 (file)
@@ -23,12 +23,12 @@ def zoom_out(actor, event, view):
 def make_button(text):
     button = clutter.Group()
     button_bg = clutter.Rectangle()
-    button_bg.set_color(clutter.color_parse('white'))
+    button_bg.set_color(clutter.color_from_string('white'))
     button_bg.set_opacity(0xcc)
     button.add(button_bg)
 
-    button_text = clutter.label_new_full('Sans 10', text, \
-        clutter.color_parse('black'))
+    button_text = clutter.Text('Sans 10', text, \
+        clutter.color_from_string('black'))
     button.add(button_text)
 
     width, height = button_text.get_size()