def main(): stage_color = clutter.Color(0, 0, 0, 255) rect_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(rect_color) rect.set_size(70, 70) rect.set_position(50, 100) stage.add(rect) rect.show() # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() timeline = clutter.Timeline(5000) # milliseconds timeline.add_marker_at_time("clutter-tutorial", 2000) # milliseconds timeline.connect('new-frame', on_timeline_new_frame, rect) timeline.connect('marker-reached', on_timeline_marker_reached) timeline.set_loop(True) timeline.start(); # Start the main loop, so we can respond to events clutter.main() return 0
def main(args): stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(clutter.color_from_string('DarkSlateGray')) stage.connect('actor-added', on_stage_add) stage.connect('button-press-event', on_button_press_event) print "stage color: %s" % (stage.get_color()) color = clutter.Color(0x35, 0x99, 0x2a, 0x66) border_color = color.lighten() rect = None for i in range(1, 10): rect = clutter.Rectangle() rect.set_position((800 - (80 * i)) / 2, (600 - (60 * i)) / 2) rect.set_size(80 * i, 60 * i) # colors are either clutter.Color or 4-tuples if i % 2 == 0: rect.set_color(color) else: rect.set_color((0x35, 0x99, 0x2a, 0x33)) rect.set_border_width(10) rect.set_border_color(border_color) stage.add(rect) rect.show() stage.show() clutter.main() return 0
def main (args): stage = clutter.Stage() stage.set_size(800,600) stage.set_color(clutter.color_from_string('DarkSlateGray')) stage.connect('actor-added', on_stage_add) stage.connect('button-press-event', on_button_press_event) print "stage color: %s" % (stage.get_color()) color = clutter.Color(0x35, 0x99, 0x2a, 0x66) border_color = color.lighten() rect = None for i in range(1, 10): rect = clutter.Rectangle() rect.set_position((800 - (80 * i)) / 2, (600 - (60 * i)) / 2) rect.set_size(80 * i, 60 * i) # colors are either clutter.Color or 4-tuples if i % 2 == 0: rect.set_color(color) else: rect.set_color((0x35, 0x99, 0x2a, 0x33)) rect.set_border_width(10) rect.set_border_color(border_color) stage.add(rect) rect.show() stage.show() clutter.main() return 0
def __init__(self): self.feed = feedparser.parse( 'http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml') self.img, self.data = urllib.urlretrieve(self.feed.feed.image.href) self.stage = clutter.Stage() self.ident = clutter.texture_new_from_file(self.img) self.head = clutter.Text() self.body = clutter.Text() self.entry = 0 #initialize elements of the display group self.head.set_position(130, 5) self.head.set_color(blue) self.body = clutter.Text() self.body.set_max_length(70) self.body.set_position(130, 22) self.body.set_size(250, 100) self.body.set_line_wrap(True) #get first feeed entry for text elements self.setfeed() #create group to hold elements self.group = clutter.Group() self.group.add(self.ident, self.head, self.body) self.group.show_all() #set up stage self.stage.set_size(400, 60) self.stage.set_color(white) self.stage.show_all() self.stage.add(self.group) self.stage.connect('key-press-event', self.parseKeyPress) clutter.main()
def main(): """""" stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add our custom actor to the stage actor = Triangle(actor_color) actor.set_size(100, 100) actor.set_position(20, 20) stage.add(actor) actor.show() # Show the stage stage.show() stage.connect('destroy', clutter.main_quit) #actor.set_color('Red') # Start the main loop, so we can respond to events clutter.main() return 0
def main(): stage_color = clutter.Color(0, 0, 0, 255) rect_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(rect_color) rect.set_size(70, 70) rect.set_position(50, 100) stage.add(rect) rect.show() # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() timeline = clutter.Timeline(5000) # milliseconds timeline.add_marker_at_time("clutter-tutorial", 2000) # milliseconds timeline.connect('new-frame', on_timeline_new_frame, rect) timeline.connect('marker-reached', on_timeline_marker_reached) timeline.set_loop(True) timeline.start() # Start the main loop, so we can respond to events clutter.main() return 0
def main(self): """Node finder main loads map and inits the GUI.""" self.data = osm.OSMModel('../data/hannover2.osm') self.data.initialize(self.data) global markers gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) self.actor = champlain.View() layer = champlain.Layer() self.marker = AnimatedMarker() layer.add(self.marker) stage.set_user_resizable(True) stage.connect("allocation-changed", self.resize_actor) stage.connect("button-press-event", self.button_pressed) stage.set_size(*SCREEN_SIZE) self.actor.set_size(*SCREEN_SIZE) stage.add(self.actor) layer.show() self.actor.add_layer(layer) # Finish initialising the map view self.actor.set_property("zoom-level", 16) self.actor.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) self.actor.center_on(*POSITION) stage.show() clutter.main()
def __init__(self): self.feed= feedparser.parse('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml') self.img, self.data =urllib.urlretrieve(self.feed.feed.image.href) self.stage=clutter.Stage() self.ident =clutter.texture_new_from_file(self.img) self.head=clutter.Text() self.body=clutter.Text() self.entry=0 #initialize elements of the display group self.head.set_position(130, 5) self.head.set_color(blue) self.body=clutter.Text() self.body.set_max_length(70) self.body.set_position(130, 22) self.body.set_size(250, 100) self.body.set_line_wrap(True) #get first feeed entry for text elements self.setfeed() #create group to hold elements self.group= clutter.Group() self.group.add(self.ident, self.head, self.body) self.group.show_all() #set up stage self.stage.set_size(400,60) self.stage.set_color(white) self.stage.show_all() self.stage.add(self.group) self.stage.connect('key-press-event', self.parseKeyPress) clutter.main()
def main() : gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) actor = champlain.View() layer = champlain.Layer() marker = AnimatedMarker() #Starting the animation, that's what we want after all ! marker.start_animation() #Set marker position on the map marker.set_position(*POSITION) stage.set_size(*SCREEN_SIZE) actor.set_size(*SCREEN_SIZE) stage.add(actor) layer.show() actor.add_layer(layer) layer.add(marker) # Finish initialising the map view actor.set_property("zoom-level", 5) actor.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) actor.center_on(*POSITION) stage.show() clutter.main()
def main(): stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(actor_color) rect.set_size(100, 100) rect.set_position(20, 20) stage.add(rect) rect.show() # Add a label to the stage label = clutter.Text("Sans 12", "Some Text", actor_color) label.set_size(500, 500) label.set_position(20, 150) stage.add(label) label.show() # Show the stage stage.connect("destroy", clutter.main_quit) stage.show_all() # Start the main loop, so we can respond to events: clutter.main() return 0
def start(): script.load_from_file("templates/signin.template") userinput = script.get_object("signin-user") userinput.set_editable(True) userinput.set_reactive(True) userinput.set_size(20,200) stage = script.get_object("main-stage") stage.connect('key-press-event', parseKeyPress) stage.show_all() clutter.main()
def do_standalone_display(self): """This might be useful somewhere. (no resize)""" stage = clutter.Stage() stage.connect('destroy', clutter.main_quit) stage.connect('key-press-event', lambda x,y: clutter.main_quit()) stage.set_fullscreen(True) stage.set_color(clutter.color_from_string('black')) stage.add(self.group) stage.show_all() clutter.main()
def main(): stage_color = clutter.Color(176, 176, 176, 255) # light gray # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(stage_color) # Create and add a label actor, hidden at first global label_filename label_filename = clutter.Text() label_color = clutter.Color(96, 96, 144, 255) # blueish label_filename.set_color(label_color) label_filename.set_font_name("Sans 24") label_filename.set_position(10, 10) label_filename.set_opacity(0) stage.add(label_filename) label_filename.show() # Add a plane under the ellipse of images rect_color = clutter.Color(255, 255, 255, 255) # white rect = clutter.Rectangle(rect_color) rect.set_height(ELLIPSE_HEIGHT + 20) rect.set_width(stage.get_width() + 100) # Position it so that its center is under the images rect.set_position(-(rect.get_width() - stage.get_width()) / 2, ELLIPSE_Y + IMAGE_HEIGHT - (rect.get_height() / 2)) # Rotate it around its center rect.set_rotation(clutter.X_AXIS, -90, 0, rect.get_height() / 2, 0) stage.add(rect) rect.show() # show the stage stage.connect("destroy", clutter.main_quit) stage.show_all() global timeline_rotation timeline_rotation = clutter.Timeline(2000) # milliseconds timeline_rotation.connect('completed', on_timeline_rotation_completed) # Add an actor for each image load_images("images") add_image_actors(stage) # timeline_rotation.set_loop(True) # Move them a bit to start with global list_items if list_items: rotate_all_until_item_is_at_front(list_items[0]) # Start the main loop, so we can respond to events clutter.main() return 0
def main (): stage = clutter.Stage() stage.set_color(clutter.Color(red=0xff, green=0xcc, blue=0xcc, alpha=0xff)) stage.set_size(width=400, height=300) stage.connect('button-press-event', on_button_press_event) stage.connect('destroy', clutter.main_quit) cairo_tex = clutter.CairoTexture(width=200, height=200) cairo_tex.set_position(x=(stage.get_width() - 200) / 2, y=(stage.get_height() - 200) / 2) # we obtain a cairo context from the clutter.CairoTexture # and then we can use it with the cairo primitives to draw # on it. context = cairo_tex.cairo_create() # we scale the context to the size of the surface context.scale(200, 200) context.set_line_width(0.1) context.set_source_color(clutter.Color(255, 0, 0, 0x88)) context.translate(0.5, 0.5) context.arc(0, 0, 0.4, 0, pi * 2) context.stroke() del(context) # we need to destroy the context so that the # texture gets properly updated with the result # of our operations; you can either move all the # drawing operations into their own function and # let the context go out of scope or you can # explicitly destroy it # clutter.CairoTexture is a clutter.Actor, so we can # manipulate it as any other actor center_x = cairo_tex.get_width() / 2 center_z = cairo_tex.get_height() / 2 cairo_tex.set_rotation(clutter.Y_AXIS, 45.0, center_x, 0, center_z) stage.add(cairo_tex) cairo_tex.show() # clutter.CairoTexture is also a clutter.Texture, so we can save # memory when dealing with multiple copies by simply cloning it # and manipulating the clones clone_tex = clutter.Clone(cairo_tex) clone_tex.set_position((stage.get_width() - 200) / 2, (stage.get_height() - 200) / 2) clone_tex.set_rotation(clutter.Y_AXIS, -45.0, center_x, 0, center_z) stage.add(clone_tex) clone_tex.show() stage.show() clutter.main() return 0
def main(): stage = clutter.Stage() stage.set_color(clutter.Color(red=0xff, green=0xcc, blue=0xcc, alpha=0xff)) stage.set_size(width=400, height=300) stage.connect('button-press-event', on_button_press_event) stage.connect('destroy', clutter.main_quit) cairo_tex = clutter.CairoTexture(width=200, height=200) cairo_tex.set_position(x=(stage.get_width() - 200) / 2, y=(stage.get_height() - 200) / 2) # we obtain a cairo context from the clutter.CairoTexture # and then we can use it with the cairo primitives to draw # on it. context = cairo_tex.cairo_create() # we scale the context to the size of the surface context.scale(200, 200) context.set_line_width(0.1) context.set_source_color(clutter.Color(255, 0, 0, 0x88)) context.translate(0.5, 0.5) context.arc(0, 0, 0.4, 0, pi * 2) context.stroke() del (context) # we need to destroy the context so that the # texture gets properly updated with the result # of our operations; you can either move all the # drawing operations into their own function and # let the context go out of scope or you can # explicitly destroy it # clutter.CairoTexture is a clutter.Actor, so we can # manipulate it as any other actor center_x = cairo_tex.get_width() / 2 center_z = cairo_tex.get_height() / 2 cairo_tex.set_rotation(clutter.Y_AXIS, 45.0, center_x, 0, center_z) stage.add(cairo_tex) cairo_tex.show() # clutter.CairoTexture is also a clutter.Texture, so we can save # memory when dealing with multiple copies by simply cloning it # and manipulating the clones clone_tex = clutter.Clone(cairo_tex) clone_tex.set_position((stage.get_width() - 200) / 2, (stage.get_height() - 200) / 2) clone_tex.set_rotation(clutter.Y_AXIS, -45.0, center_x, 0, center_z) stage.add(clone_tex) clone_tex.show() stage.show() clutter.main() return 0
def main(): stage = Phyesta() stage.connect("key-press-event", clutter.main_quit) stage.show() stage.set_slots(5) #gobject.timeout_add(500, timeout_cb, stage) #for i in xrange(0, len(data)): # stage.add_stream(Stream(data[i][0], data[i][1], data[i][2]), i) # clutter.main()
def main2(): stage = clutter.stage_get_default() stage.set_color(clutter.color_parse("red")) stage.set_size(SCREEN_W, SCREEN_H) stage.show() template = clutter.EffectTemplate() # random_ripple() stage.connect("key-press-event", clutter.main_quit) #stage.connect("key-press-event", clutter.main_quit) clutter.main()
def main (args): stage = clutter.Stage(default=True) stage.set_color('#ccccccff') hands = SuperOh(8) stage.add(hands) hands.spin() stage.show_all() clutter.main() return 0
def __init__(self): #create a clutter stage self.stage = clutter.Stage() #set the stage size in x,y pixels self.stage.set_size(500, 200) #define some clutter colors in rgbo (red,green,blue,opacity) color_black = clutter.Color(0, 0, 0, 255) color_green = clutter.Color(0, 255, 0, 255) color_blue = clutter.Color(0, 0, 255, 255) #set the clutter stages bg color to our black self.stage.set_color(color_black) #we will need to check on the key presses from the user self.stage.connect('key-press-event', self.parseKeyPress) #create a clutter label, is there documentation for creating a clutterlabel? self.label = clutter.Label() #set the labels font self.label.set_font_name('Mono 32') #add some text to the label self.label.set_text("Hello") #make the label green self.label.set_color(color_green) #put the label in the center of the stage (label_width, label_height) = self.label.get_size() label_x = (self.stage.get_width() / 2) - label_width / 2 label_y = (self.stage.get_height() / 2) - label_height / 2 self.label.set_position(label_x, label_y) #make a second label similar to the first label self.label2 = clutter.Label() self.label2.set_font_name('Mono 32') self.label2.set_text("World!") self.label2.set_color(color_blue) (label2_width, label2_height) = self.label2.get_size() label2_x = (self.stage.get_width() / 2) - label2_width / 2 label2_y = (self.stage.get_height() / 2) - label2_height / 2 self.label2.set_position(label2_x, label2_y) #hide the label2 self.label2.set_opacity(0) #create a timeline for the animations that are going to happen self.timeline = clutter.Timeline(fps=20, duration=500) #how will the animation flow? ease in? ease out? or steady? #ramp_inc_func will make the animation steady labelalpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func) #make some opacity behaviours that we will apply to the labels self.hideBehaviour = clutter.BehaviourOpacity(255, 0x00, labelalpha) self.showBehaviour = clutter.BehaviourOpacity(0x00, 255, labelalpha) #add the items to the stage self.stage.add(self.label2) self.stage.add(self.label) #show all stage items and enter the clutter main loop self.stage.show_all() clutter.main()
def main(): stage = clutter.Stage() stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(clutter.Color(0, 0, 0, 255)) stage.connect('button-press-event', on_stage_button_press) stage.connect("destroy", clutter.main_quit) stage.show() clutter.main() return 0
def main(args): stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(clutter.Color(0xcc, 0xcc, 0xcc, 0xff)) stage.connect('key-press-event', clutter.main_quit) stage.connect('destroy', clutter.main_quit) rect = clutter.Rectangle() rect.set_position(0, 0) rect.set_size(150, 150) rect.set_color(clutter.Color(0x33, 0x22, 0x22, 0xff)) rect.set_border_color(clutter.color_from_string('white')) rect.set_border_width(15) rect.show() knots = ( \ ( 0, 0 ), \ ( 300, 0 ), \ ( 300, 300 ), \ ( 0, 300 ), \ ) path = clutter.Path('M 0 0 L 300 0 L 300 300 L 0 300') timeline = clutter.Timeline(3000) timeline.set_loop(True) alpha = clutter.Alpha(timeline, clutter.EASE_OUT_SINE) o_behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255) o_behaviour.apply(rect) p_behaviour = clutter.BehaviourPath(alpha, path) path.add_move_to(0, 0) p_behaviour.apply(rect) r_behaviour = BehaviourRotate(alpha) r_behaviour.apply(rect) stage.add(rect) stage.show() timeline.start() clutter.main() return 0
def main(args): stage = clutter.Stage() stage.connect('destroy', clutter.main_quit) stage.set_color(clutter.Color(0x66, 0x66, 0xdd, 0xff)) rect = clutter.Rectangle(clutter.Color(0x44, 0xdd, 0x44, 0xff)) rect.set_size(50, 50) rect.set_anchor_point(25, 25) rect.set_position(stage.get_width()/2, stage.get_height()/2) rect.set_opacity(0x88) rect.set_reactive(True) rect.connect('button-press-event', on_button_press) stage.add(rect) stage.show() clutter.main()
def main(args): stage = clutter.Stage() stage.connect('destroy', clutter.main_quit) stage.set_color(clutter.Color(0x66, 0x66, 0xdd, 0xff)) rect = clutter.Rectangle(clutter.Color(0x44, 0xdd, 0x44, 0xff)) rect.set_size(50, 50) rect.set_anchor_point(25, 25) rect.set_position(stage.get_width() / 2, stage.get_height() / 2) rect.set_opacity(0x88) rect.set_reactive(True) rect.connect('button-press-event', on_button_press) stage.add(rect) stage.show() clutter.main()
def main (args): stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(clutter.Color(0xcc, 0xcc, 0xcc, 0xff)) stage.connect('key-press-event', clutter.main_quit) stage.connect('destroy', clutter.main_quit) rect = clutter.Rectangle() rect.set_position(0, 0) rect.set_size(150, 150) rect.set_color(clutter.Color(0x33, 0x22, 0x22, 0xff)) rect.set_border_color(clutter.color_from_string('white')) rect.set_border_width(15) rect.show() knots = ( \ ( 0, 0 ), \ ( 300, 0 ), \ ( 300, 300 ), \ ( 0, 300 ), \ ) path = clutter.Path('M 0 0 L 300 0 L 300 300 L 0 300') timeline = clutter.Timeline(3000) timeline.set_loop(True) alpha = clutter.Alpha(timeline, clutter.EASE_OUT_SINE) o_behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255) o_behaviour.apply(rect) p_behaviour = clutter.BehaviourPath(alpha, path) path.add_move_to(0, 0) p_behaviour.apply(rect) r_behaviour = BehaviourRotate(alpha) r_behaviour.apply(rect) stage.add(rect) stage.show() timeline.start() clutter.main() return 0
def main(): stage = Phyesta() stage.connect("key-press-event", clutter.main_quit) data = ( ('Smell like teen spirit', 'Nirvana', '0.jpg'), ('Masquerade', 'Ble ble', '1.jpg'), ('Some', 'Bjork', '4.jpg'), ('Abadi bi abade ba', 'The starting line', '2.jpg'), ('13 steps', 'A perfect circle', '3.jpg') ) stage.show() stage.set_slots(len(data)) for i in xrange(0, len(data)): stage.add_stream(Stream(data[i][0], data[i][1], data[i][2]), i) clutter.main()
def main(): # A stage is like a gtk.Window # By default clutter creates a stage on initializtion, whcih can be retrieved and used as shown below. It is possilbe that support for multiple stages is present. If support for multiple stages is present the programmer must manage them using the clutter_actor_destroy function. stage = clutter.Stage() # The size of the stage that is being operated upon is set with the set_size(width, height) function. stage.set_size(SCREEN_W, SCREEN_H) # The color of the stage may be set with the set_color function. It operates as shown below and takes colors in formats such as #FFFFFF and #FFF. For the color to be acceptable it must be a clutter color object and is create using cluter.color_parse("TheColor"). stage.set_color(clutter.color_parse("#BBCCFF")) ## Clutter Rectangles # As you are able to see in the code below the same functions are available to different clutter objects such as clutter.Rectangles. You can use set_size and set_color just as you would on a clutter stage. # A word about rectangles are that they are what are called an Actor in clutter. They are objects that are placed on the stage. rect1 = clutter.Rectangle() rect2 = clutter.Rectangle() rect1.set_position(20, 20) # set X and Y coordinates rect1.set_size(200, 300) rect1.set_color(clutter.color_parse("#A02020")) rect2.set_position(50, 100) rect2.set_size(350, 300) rect2.set_color(clutter.color_parse("#00000050")) # We can set the border with to what we desire with the set_border_width. When this is used it obliviously increases the size used in the set_size method. If the width is 350 now it is 350 + (border *2). Same goes for the height. rect2.set_border_width(20) rect2.set_border_color(clutter.color_parse("blue")) # Very nice part of adding an object to the stage is that you may add as many as you wish using stage.add(object1, object2, etc...) stage.add(rect1, rect2) # For you Actors to be shown on the stage you must he stage you must also display all the Actors rect1.show() rect2.show() # The stage is shown my using the show() method. stage.show() # Or you may show all the Actors on a stage by using the stages show_all() method. stage.show_all() stage.connect("key-press-event", clutter.main_quit) clutter.main()
def main(): stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(actor_color) rect.set_size(100, 100) rect.set_position(20, 20) stage.add(rect) rect.show() # Rotate it 20 degrees away from us around the x axis # (around its top edge) rect.set_rotation(clutter.X_AXIS, -20, 0, 0, 0) # Add a label to the stage label = clutter.Text("Sans 12", "Some Text", actor_color) label.set_size(500, 500) label.set_position(20, 150) stage.add(label) label.show() # Scale it 300% along the x axis label.set_scale(3., 1.) # Move it up and to the right label.move_by(10, -10) # Move it along the z axis, further from the viewer label.set_depth(-20) # Show the stage stage.connect("destroy", clutter.main_quit) stage.show_all() # Start the main loop, so we can respond to events clutter.main() return 0
def main (args): stage = clutter.Stage() stage.set_size(800,600) stage.set_color(clutter.Color(0, 0, 0, 255)) stage.set_title('Abiquo Release') stage.connect('destroy', clutter.main_quit) group = clutter.Group() stage.add(group) try: tex = clutter.Texture(filename="abiquo-logo.png") except Exception: print "Unable to load the texture file" return 1 reflect = TextureReflection(tex) reflect.set_opacity(100) x_pos = float((stage.get_width() - tex.get_width()) / 2) group.add(tex, reflect) group.set_position(x_pos, 20.0) reflect.set_position(0.0, (tex.get_height() + 20)) timeline = clutter.Timeline(duration=3000) timeline.set_loop(True) alpha = clutter.Alpha(timeline, clutter.LINEAR) behaviour = clutter.BehaviourRotate(clutter.Y_AXIS, 0.0, 360.0, alpha, clutter.ROTATE_CW) behaviour.set_center(int(group.get_width()/2), 0, 0) behaviour.apply(group) AuthorActor(stage) VersionActor(stage) stage.show() #timeline.start() clutter.main() return 0
def run (self): self.load_script() self._timelines = self._script.get_objects('move-timeline', 'scale-timeline', 'fade-timeline') for timeline in self._timelines: print "Timeline: %s" % (clutter.get_script_id (timeline)) self._score.append(timeline=self._timelines[0]) self._score.append(timeline=self._timelines[1], parent=self._timelines[0]) self._score.append(timeline=self._timelines[2], parent=self._timelines[1]) assert(3 == len(self._score.list_timelines())) self._stage = self._script.get_object('main-stage') self._stage.show_all() clutter.main() return 0
def main(): stage_color = clutter.Color(0, 0, 0, 255) rect_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(rect_color) rect.set_size(40, 40) rect.set_position(10, 10) stage.add(rect) rect.show() # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() timeline = clutter.Timeline(5000) # milliseconds timeline.set_loop(True) timeline.start() # Create a clutter alpha for the animation alpha = clutter.Alpha(timeline) alpha.set_func(on_alpha, None) # Create an animation to change the properties # XXX: There is a bug in pygobject that will refuse to convert between # ints and chars. This should be fixed when clutter 1.2 is out and # pyclutter targets it. The result is that the opacity won't be animated # the bug report is https://bugzilla.gnome.org/show_bug.cgi?id=591800 # and shall be fixed in the next release, so perhaps by the time you read # this is already fixed. rect.animate_with_alpha(alpha, 'x', 150.0, 'y', 150.0, 'opacity', 0.0) # Start the main loop, so we can respond to events clutter.main() return 0
def main(): stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a group to the stage group = clutter.Group() group.set_position(40, 40) stage.add(group) group.show() # Add a rectangle to the group rect = clutter.Rectangle(actor_color) rect.set_size(50, 50) rect.set_position(0, 0) group.add(rect) rect.show() # Add a label to the group label = clutter.Text("Sans 9", "Some Text", actor_color) label.set_position(0, 60) group.add(label) label.show() # Scale the group 120% along the x axis group.set_scale(3.0, 1.0) # Rotate it around the z axis group.set_rotation(clutter.Z_AXIS, 10, 0, 0, 0) # Show the stage stage.connect("destroy", clutter.main_quit) stage.show_all() # Start the main loop, so we can respond to events clutter.main()
def main(): stage_color = clutter.Color(0, 0, 0, 255) rect_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage global rect rect = clutter.Rectangle(rect_color) rect.set_size(70, 70) rect.set_position(50, 100) stage.add(rect) rect.show() # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() # Create a score and add two timelines to it, # so the second timeline starts when the first one stops score = clutter.Score() score.set_loop(True) timeline_rotation = clutter.Timeline(5000) # milliseconds timeline_rotation.connect('new-frame', on_timeline_rotation_new_frame) score.append(timeline=timeline_rotation) timeline_move = clutter.Timeline(5000) # milliseconds timeline_move.connect('new-frame', on_timeline_move_new_frame) score.append(parent=timeline_rotation, timeline=timeline_move) score.start() # Start the main loop, so we can respond to events clutter.main() return 0
def main(): stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 255, 153) actor_color2 = clutter.Color(16, 64, 144, 255) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add our custom container to the stage box = ExampleBox() # Set the size to the preferred size of the container box.set_size(-1, -1) box.set_position(20, 20) stage.add(box) box.show() # Add some actors to our container actor = clutter.Rectangle(color=actor_color) actor.set_size(75, 75) box.add(actor) actor.show() actor2 = clutter.Rectangle(color=actor_color2) actor2.set_size(75, 75) box.add(actor2) actor2.show() # Show the stage stage.show() stage.connect('destroy', clutter.main_quit) box.do_remove_all() # Start the main loop, so we can respond to events clutter.main() return 0
def main(args): stage = clutter.Stage() stage.set_color(clutter.Color(0, 0, 0, 255)) stage.set_title('TextureReflection') stage.connect('button-press-event', clutter.main_quit) stage.connect('destroy', clutter.main_quit) group = clutter.Group() stage.add(group) try: tex = clutter.Texture(filename=args[0]) except Exception: print "Unable to load the texture file" return 1 reflect = TextureReflection(tex) reflect.set_opacity(100) x_pos = float((stage.get_width() - tex.get_width()) / 2) group.add(tex, reflect) group.set_position(x_pos, 20.0) reflect.set_position(0.0, (tex.get_height() + 20)) timeline = clutter.Timeline(duration=3000) timeline.set_loop(True) alpha = clutter.Alpha(timeline, clutter.LINEAR) behaviour = clutter.BehaviourRotate(clutter.Y_AXIS, 0.0, 360.0, alpha, clutter.ROTATE_CW) behaviour.set_center(int(group.get_width() / 2), 0, 0) behaviour.apply(group) stage.show() timeline.start() clutter.main() return 0
def main(args): stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(clutter.Color(0xCC, 0xCC, 0xCC, 0xFF)) stage.connect("key-press-event", clutter.main_quit) rect = clutter.Rectangle() rect.set_position(300, 200) rect.set_size(150, 150) rect.set_color(clutter.Color(0x33, 0x22, 0x22, 0xFF)) rect.set_border_color(clutter.color_parse("white")) rect.set_border_width(15) rect.show() knots = ((200, 200), (400, 200), (400, 400), (200, 400)) timeline = clutter.Timeline(fps=50, duration=3000) timeline.set_loop(True) alpha = clutter.Alpha(timeline, clutter.sine_func) o_behaviour = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0x33, opacity_end=255) o_behaviour.apply(rect) p_behaviour = clutter.BehaviourPath(alpha=alpha, knots=knots) p_behaviour.append_knots((200, 200)) p_behaviour.apply(rect) r_behaviour = BehaviourRotate(alpha) r_behaviour.apply(rect) stage.add(rect) stage.show() timeline.start() stage.connect("key-press-event", timeline.start) clutter.main() return 0
def run(self): self.load_script() self._timelines = self._script.get_objects('move-timeline', 'scale-timeline', 'fade-timeline') for timeline in self._timelines: print "Timeline: %s" % (clutter.get_script_id(timeline)) self._score.append(timeline=self._timelines[0]) self._score.append(timeline=self._timelines[1], parent=self._timelines[0]) self._score.append(timeline=self._timelines[2], parent=self._timelines[1]) assert (3 == len(self._score.list_timelines())) self._stage = self._script.get_object('main-stage') self._stage.show_all() clutter.main() return 0
def main(): stage_color = clutter.Color(0, 0, 0, 255) label_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Connect signal handlers to handle mouse clicks on the stage stage.connect('button-press-event', on_stage_button_press) # Add a rectangle to the stage rect = clutter.Rectangle(label_color) rect.set_size(100, 100) rect.set_position(50, 50) rect.show() stage.add(rect) # Allow the actor to emit events. # By default only the stage does this. rect.set_reactive(True) # Connect signal handlers for events rect.connect('button-press-event', on_rect_button_press) rect.connect('button-release-event', on_rect_button_release) rect.connect('motion-event', on_rect_motion) rect.connect('enter-event', on_rect_enter) rect.connect('leave-event', on_rect_leave) # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() # Start the main loop, so we can respond to events clutter.main() return 0
def Main(): """Initiate a DDS frontend.""" CreateDDSDir() InitializeLibraries() level = logging.INFO if FLAGS.debug: level = logging.DEBUG logging.basicConfig(level=level, format='%(asctime)s %(filename)s %(lineno)d ' '%(levelname)s %(message)s') stage = clutter.Stage() HandleFullscreen(stage) SetupCache() show = manager.Manager(stage) SetupStage(stage, show) if not FLAGS.oneslide: timer = xmppthread.XMPPThread() timer.AttachSlideManager(show) timer.start() else: def foo(): show.slides.playlist.add({'position':1, 'mode':'single', 'slides':[-1], 'weights':[1]}) show.slides.playlist.add({'position':1, 'mode':'single', 'slides':[-2], 'weights':[1]}) s = slideobject.Slide() s.oneslide(FLAGS.oneslide) a = slideobject.Slide() a.oneslide(FLAGS.oneslide, id=-2) s.resize(stage.get_width(), stage.get_height()) a.resize(stage.get_width(), stage.get_height()) show._add_slide(s) show._add_slide(a) t = threading.Thread(target=foo) t.start() clutter.main()
def main(): stage_color = clutter.Color(0, 0, 0, 255) rect_color = clutter.Color(255, 255, 255, 153) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(200, 200) stage.set_color(stage_color) # Add a rectangle to the stage rect = clutter.Rectangle(rect_color) rect.set_size(40, 40) rect.set_position(10, 10) stage.add(rect) rect.show() # Show the stage stage.connect('destroy', clutter.main_quit) stage.show() timeline = clutter.Timeline(5000) # milliseconds timeline.set_loop(True) timeline.start() # Instead of our custom callback, # we could use a standard callback. For instance, CLUTTER_ALPHA_SINE_INC. alpha = clutter.Alpha(timeline) alpha.set_func(on_alpha, None) behaviour = clutter.BehaviourPath(alpha, knots=((10, 10), (150, 150))) behaviour.apply(rect) # Start the main loop, so we can respond to events clutter.main() return 0
def vol_to_grids(vol_ffn, grid_config, vol_dbz_offset): #refl cappi index #5 = 2.5km cappi_index = 5 #read radar radar = pyart.aux_io.read_odim_h5(vol_ffn, file_field_names=True) try: #check if DBZH_CLEAN is present refl_field = radar.fields['DBZH_CLEAN']['data'] except: #run clutter filtering if DBZH_CLEAN is missing refl_field, _ = clutter.main(radar, [], 'DBZH') #run range filtering R, A = np.meshgrid(radar.range['data']/1000, radar.azimuth['data']) ma_refl_field = np.ma.masked_where(np.logical_or(R<10, R>120), refl_field.copy()) radar.add_field_like('DBZH', 'MA_DBZH_CLEAN', ma_refl_field, replace_existing=True) #temp data <-- get from ACCESS-R archive temp_data = mesh.temperature_profile_access(radar) #grid grid = pyart.map.grid_from_radars( radar, grid_shape = grid_config['GRID_SHAPE'], grid_limits = grid_config['GRID_LIMITS'], roi_func = 'constant', constant_roi = grid_config['GRID_ROI'], weighting_function = 'Barnes2', fields = ['MA_DBZH_CLEAN']) #extract data and apply refl offset refl_grid = grid.fields['MA_DBZH_CLEAN']['data'] - vol_dbz_offset alt_vec = grid.z['data'] #calculate refl field REFL = refl_grid[cappi_index,:,:] REFL_meta = {'units': 'dBZ', 'long_name': 'Horizontal Reflectivity Factor', 'standard_name': 'reflectivity', 'comments': 'calibrated reflectivity'} #convert to mesh MESH, MESH_meta = mesh.main(refl_grid, alt_vec, temp_data) # fig = plt.figure(figsize=[10,10]) # plt.imshow(REFL) #return 2D mesh grid return MESH, MESH_meta, REFL, REFL_meta
def main(): stage_color = clutter.Color(0, 0, 0, 255) actor_color = clutter.Color(255, 255, 204, 255) # Get the stage and set its size and color stage = clutter.Stage() stage.set_size(800, 200) stage.set_color(stage_color) # Add a non-editable text actor to the stage text = clutter.Text() # Setup text properties text.set_color(actor_color) text.set_text("Non-editable text: Wizard imps and sweat sock pimps," "interstellar mongrel nymphs.") text.set_font_name("Sans 12") text.set_editable(False) text.set_line_wrap(False) # Discover the preferred height and use that height min_height, natural_height = text.get_preferred_height(750) text.set_size(750, natural_height) text.set_position(5, 5) stage.add(text) text.show() # Add a multi-line editable text actor to the stage text = clutter.Text() # Setup text properties text.set_color(actor_color) text.set_text( "Editable text: And as I sat there brooding on the old, unknown world, I thought of " "Gatsby's wonder when he first picked out the green light at the end of " "Daisy's dock. He had come a long way to this blue lawn and his dream " "must have seemed so close that he could hardly fail to grasp it. He did " "not know that it was already behind him, somewhere back in that vast " "obscurity beyond the city, where the dark fields of the republic rolled " "on under the night.") text.set_font_name("Sans 12") text.set_editable(True) text.set_line_wrap(True) # Discover the preferred height and use that height min_height, natural_height = text.get_preferred_height(750) text.set_size(750, natural_height) text.set_position(5, 50) stage.add(text) text.show() # Set focus to handle key presses on the stage stage.set_key_focus(text) # Show the stage stage.show_all() stage.connect('destroy', clutter.main_quit) # Start the main loop, so we can respond to events clutter.main() return 0
cr.line_to(math.sin(hours) * 0.2, -math.cos(hours) * 0.2) cr.stroke() def tick(texture): cr = texture.cairo_create() cr.scale(300, 300)#texture.get_width(), texture.get_height()) drawClock(cr) return True if __name__ == '__main__': stage_color = clutter.Color(0x99, 0xcc, 0xff, 0xff) stage = clutter.Stage() stage.connect('button-press-event', clutter.main_quit) stage.connect('destroy', clutter.main_quit) stage.set_color(stage_color) texture = CairoTexture(300, 300) texture.set_position( (stage.get_width() - 300) / 2, (stage.get_height() - 300) / 2 ) stage.add(texture) texture.show() tick(texture) gobject.timeout_add_seconds(1, tick, texture) stage.show() clutter.main()
def run(self): self.stage.show_all() self.timeline.start() clutter.main()
def run(self): self._timeline.start() clutter.main()
def run(self): """ Run the GUI. """ self.stage.show() clutter.main()