[pyclutter] examples: Further cleanups for scroll-actor.py



commit 57a8df45d3c6a45d7a60c96c4125d3225e91da31
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 30 14:00:31 2015 +0100

    examples: Further cleanups for scroll-actor.py

 examples/scroll-actor.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/examples/scroll-actor.py b/examples/scroll-actor.py
index eba77ab..513f10c 100644
--- a/examples/scroll-actor.py
+++ b/examples/scroll-actor.py
@@ -42,10 +42,7 @@ class Menu(Clutter.Actor):
 
         return new_item
 
-def create_menu_actor(scroll):
-    menu = Menu()
-    scroll.add_child(menu)
-
+def create_menu_actor():
     menu_items = [
         'Option 1',
         'Option 2',
@@ -61,11 +58,14 @@ def create_menu_actor(scroll):
         'Option 12'
     ]
 
+    menu = Menu()
     for label in menu_items:
         menu.add_child(MenuItem(label))
 
     menu.select_item(0)
 
+    return menu
+
 def create_scroll_actor(stage):
     scroll = Clutter.ScrollActor(name='scroll')
     scroll.set_position(0, 18)
@@ -73,8 +73,7 @@ def create_scroll_actor(stage):
     scroll.add_constraint(Clutter.BindConstraint(source=stage, coordinate=Clutter.BindCoordinate.HEIGHT, 
offset=-36))
     scroll.set_scroll_mode(Clutter.ScrollMode.VERTICALLY)
     scroll.set_easing_duration(250)
-
-    create_menu_actor(scroll)
+    scroll.add_child(create_menu_actor())
 
     stage.add_child(scroll)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]