Beispiel #1
0
    def __init__(self):
        stage = clutter.Stage()
        stage.set_size(400, 400)
        stage.set_color(clutter.color_parse("#FFFFFF"))

        rect1 = clutter.Rectangle()
        rect2 = clutter.Rectangle()

        group1 = clutter.Group()
        group2 = clutter.Group() 

        group1.add(rect1, group2)
        group2.add(rect2)

        group1.set_position(75, 75)
        group2.set_position(75, 75)

        rect1.set_position(0, 0)
        rect2.set_position(0, 0)

        rect1.set_size(200, 200)
        rect2.set_size(200, 200)

        rect1.set_color(clutter.color_parse("red"))
        rect2.set_color(clutter.color_parse("blue"))

        stage.add(group1)

        stage.show_all()
        stage.connect('destroy', clutter.main_quit)
        group1.show_all()
        group2.show_all()
Beispiel #2
0
  def __init__(self):
    self.stage = clutter.stage_get_default()
    self.stage.set_fullscreen(True)
    self.stage.set_color(clutter.color_parse("black"))

    self.spectrum = clutter.Texture('spectrum.png')
    self.spectrum.set_width(self.stage.get_width())
    self.spectrum.set_height(self.stage.get_height())
    self.spectrum.set_position(0,0)
    self.stage.add(self.spectrum)

    self.textsliced = clutter.Texture('text-sliced.png')
    self.textsliced.set_width(self.stage.get_width())
    self.textsliced.set_height(self.stage.get_height())
    self.textsliced.set_position(0,0)
    self.stage.add(self.textsliced)

    self.timeline = clutter.Timeline(1000)
    self.timeline.set_loop(True)
    alpha = clutter.Alpha(self.timeline, clutter.LINEAR)
    self.behaviour = clutter.BehaviourOpacity(0xdd, 0, alpha)
    self.behaviour.apply(self.textsliced)

    self.stage.connect('destroy', clutter.main_quit)
    self.stage.connect('key-press-event', on_key_press_event)
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 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()
Beispiel #5
0
 def __init__(self):
   self.slide = clutter.Group()
   self.slide.visible = True
   a = clutter.Rectangle()
   a.set_width(16)
   a.set_height(9)
   a.set_color(clutter.color_parse('red'))
   a.set_position(0,0)
   a.visible = True
   self.slide.add(a)
   self.slide._timeline = clutter.Timeline(30, 25)
   self.slide._timeline.set_loop(True)
   alpha = clutter.Alpha(self.slide._timeline, clutter.ramp_func)
   self.slide._behaviour = clutter.BehaviourOpacity(0xdd, 0, alpha)
   self.slide._behaviour.apply(a)
   self.slide._timeline.start()
 def __init__(self, size, max_image_size, padding, background, timeline):
     self.x = size[0]
     self.y = size[1]
     self.max_image_size = max_image_size
     self.padding = padding
     self.stage = clutter.Stage()
     self.stage.set_size(size[0], size[1])
     self.stage.set_color(clutter.color_parse(background))
     self.timeline = timeline
     self.image_number = 0
     self.selection = 0
     self.old_selection = 0
     self.row_size = int(math.floor((size[0] - self.padding[0]) / (max_image_size[0] + self.padding[0])))
     print str(self.row_size)
     self.behaviours = []
     self.textures = []
Beispiel #7
0
    def __init__(self):
        self.stage = clutter.Stage()
        self.stage.set_size(400, 400)
        self.stage.set_color(clutter.color_from_string("red"))

        self.text = clutter.Text()
        self.text.set_text("Text Entry")
        self.text.set_color(clutter.color_parse("green"))
        self.text.set_size(150, 50)
        self.text.set_position(200, 200)
        self.text.set_reactive(True)
        self.text.set_editable(True)

        self.text.connect("button-press-event", self.on_mouse_press_event)
        self.text.connect("key-press-event", self.on_key_press_event)
        self.stage.connect('destroy', clutter.main_quit)

        self.stage.add(self.text)        
        self.stage.show_all()
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
class ClutterDisplay:

	def __init__(self, (size_x, size_y), background, behaviours):
		self.x = size_x
		self.y = size_y
		self.stage = clutter.stage_get_default()
		self.stage.set_size(size_x, size_y)
		self.stage.set_color(clutter.color_parse(background))
		self.behaviours = behaviours

	def add_rectangle(self, (position_x, position_y), (size_x, size_y), color, border = 0, border_color = "#FFFFFF"):
		rectangle = clutter.Rectangle()
		rectangle.set_position(position_x, position_y)
		rectangle.set_size(size_x, size_y)
		rectangle.set_color(clutter.color_parse(color))
		if border > 0:
			rectangle.set_border_width(border)
			rectangle.set_border_color(clutter.color_parse(border_color))
		self.stage.add(rectangle)
		for behaviour in behaviours:
			behaviour.apply(rectangle)
		rectangle.show()

	def input_keys(self, arg2, arg3):
		print "Input width (zero to quit): ",
		width = input()
		if width == 0:
			clutter.main_quit()
			return
		print "Input height (zero to quit): ",
    def __init__(self):

        color_grey = clutter.Color(127, 127, 127, 255)
        color_lightgrey = clutter.Color(192, 192, 192, 255)
        color_darkgrey = clutter.Color(92, 92, 92, 255)
        color_green = clutter.Color(20, 166, 42, 255)
        color_black = clutter.Color(0, 0, 0, 255)

        self.messageQueue = []
        self.messageLock = threading.Lock()
        self.messageThread = threading.Thread(group=None, target=self.networkingThread, args=(self,))

        self.stage = clutter.Stage()
        self.stage.set_user_resizable(True)
        self.stage.set_color(color_darkgrey)
        # we're looking at 16:9 ratio
        self.stage.set_size(800, 450)

        # make callbacks
        self.stage.connect("key-press-event", self.parseKeyPress)
        # self.stage.connect('allocation-changed', self.handleResize)
        self.stage.connect("destroy", clutter.main_quit)

        self.globalContainer = BezeledContainer.BezeledRectangle()
        self.globalContainer.set_position(0, 0)
        self.globalContainer.set_size(800, 450)
        self.stage.add(self.globalContainer)

        self.leftSide = BezeledContainer.BezeledRectangle()
        self.leftSide.set_size(408, 442)
        self.globalContainer.add(self.leftSide)

        self.rightSide = BezeledContainer.BezeledRectangle()
        self.rightSide.set_size(380, 442)
        self.globalContainer.add(self.rightSide)

        self.MonitorPane = BezeledContainer.BezeledRectangle()
        self.MonitorPane.set_size(400, 388)
        self.MonitorPane._color = [0, 0, 0]
        self.leftSide.add(self.MonitorPane)

        # Same for stop button.
        self.stopBtn = clutter.Rectangle()
        self.stopBtn.set_color(clutter.Color(255, 0, 0, 255))
        self.stopBtn.set_size(50, 30)
        self.stopBtn.set_position(218, 34)
        self.stage.add(self.stopBtn)

        StopTxt = clutter.Label()
        StopTxt.set_text("Error")
        StopTxt.set_font_name("Mono 32")
        StopTxt.set_color(clutter.color_parse("Black"))
        topLeftContraint = clutter.Constraint(self.MonitorPane, clutter.CLUTTER_BIND_X, 0)
        StopTxt.add_constraint(topLeftConstraint)
        self.stage.add(StopTxt)

        self.MonitorDesc = BezeledContainer.BezeledRectangle()
        self.MonitorDesc.set_size(400, 50)
        self.leftSide.add(self.MonitorDesc)

        #        self.labelGroup = clutter.Group()
        #        self.capLabel = clutter.Text()
        #        self.capLabel.set_text("Capacity")
        #        self.capLabel.set_color( color_black )
        #        self.capLabel.set_font_name("Mono 16")
        #        self.labelGroup.add( self.capLabel )
        #        self.globalLabel = clutter.Text()
        #        self.globalLabel.set_text("Global")
        #        self.globalLabel.set_color( color_black )
        #        self.globalLabel.set_font_name("Mono 16")
        #        self.labelGroup.add( self.globalLabel )
        #        self.rightSide.add( self.labelGroup )

        self.subsystemLabel = clutter.Text()
        self.subsystemLabel.set_text("ACCRE Status")
        self.subsystemLabel.set_color(color_black)
        self.subsystemLabel.set_font_name("Helvetica Bold Italic 32")
        self.MonitorDesc.add(self.subsystemLabel)

        self.stage.show_all()
        clutter.main()
        print "I made it?"
        return

        self.subContainer = BezeledContainer.BezeledRectangle()
        # self.globalContainer.add( self.subContainer )

        # Add blocks
        self.subsystemGroup = clutter.Group()
        self.subsystemGroup.set_position(12.5, 12.5)
        self.stage.add(self.subsystemGroup)

        self.subsystemContainer = BezeledContainer.BezeledRectangle()
        # self.subsystemContainer.set_color( color_green)
        self.subsystemContainer.set_position(0, 0)
        # self.subsystemContainer.set_size(350,375)
        # changed from subsystemGroup
        self.stage.add(self.subsystemContainer)

        self.subsystemLabelContainer = clutter.Rectangle()
        self.subsystemLabelContainer.set_color(color_grey)
        self.subsystemLabelContainer.set_position(0, 375)
        self.subsystemLabelContainer.set_size(350, 50)
        self.subsystemGroup.add(self.subsystemLabelContainer)

        self.subsystemLabel = clutter.Text()
        self.subsystemLabel.set_text("ACCRE Status")
        self.subsystemLabel.set_color(color_green)
        self.subsystemLabel.set_font_name("Mono 32")
        # (label_width, label_height) = self.label.get_size()
        self.subsystemLabel.set_position(0, 375)
        self.subContainer.add(self.subsystemLabel)