Exemple #1
0
 def __init__(self, stage):
     super(PisakSpellerContainer, self).__init__()
     self.stage = stage
     margin = Clutter.Margin()
     margin.left = margin.right = margin.top = margin.bottom = 20
     self.set_margin(margin)
     self._init_elements()
Exemple #2
0
 def __init__(self):
     super().__init__()
     self.set_x_expand(True)
     self._init_stripes()
     self.set_background_color(colors.TRANSPARENT)
     margin = Clutter.Margin()
     margin.top = margin.bottom = dims.H_SPACING_PX
     self.set_margin(margin)
Exemple #3
0
 def __init__(self):
     super(PisakEduContainer, self).__init__()
     margin = Clutter.Margin()
     margin.left = margin.right = margin.top = margin.bottom = unit.mm(10)
     self.set_margin(margin)
     layout = Clutter.BinLayout()
     self.set_layout_manager(layout)
     self.set_x_expand(True)
     self.set_y_expand(True)
     self._init_training_set()
     self._init_params()
     self._init_panel()
Exemple #4
0
    stage = Clutter.Stage()
    stage.props.title = 'Multi-layout'
    stage.connect('destroy', Clutter.main_quit)
    stage.show()

    N_RECTS = 16
    RECT_SIZE = 64
    N_ROWS = 4
    PADDING = 12
    BOX_SIZE = (RECT_SIZE * (N_RECTS / N_ROWS) + PADDING * (N_RECTS / N_ROWS - 1))

    layout = MultiLayout()
    layout.spacing = PADDING
    box = Clutter.Actor(layout_manager=layout, width=BOX_SIZE, height=BOX_SIZE)
    box.set_margin(Clutter.Margin(PADDING))
    box.add_constraint(Clutter.AlignConstraint(source=stage, align_axis=Clutter.AlignAxis.BOTH, factor=0.5))
    stage.add_child(box)

    for i in range(N_RECTS):
        color = Clutter.Color.from_hls(360 / N_RECTS * i, 0.5, 0.8)
        color.alpha = 128 + 128 / N_RECTS * i

        rect = Clutter.Actor()
        rect.props.background_color = color
        rect.props.opacity = 0
        rect.props.reactive = True
        rect.set_size(RECT_SIZE, RECT_SIZE)
        rect.set_pivot_point(0.5, 0.5)
        rect.set_easing_duration(250)
        rect.set_easing_mode(Clutter.AnimationMode.EASE_OUT_CUBIC)
Exemple #5
0
    # Animate the content gravity changes
    with actor.easing_state():
        actor.set_content_gravity(gravities[current_gravity][0])

    # Cycle through all gravities
    current_gravity += 1
    if current_gravity >= len(gravities):
        current_gravity = 0

if __name__ == '__main__':
    Clutter.init(None)

    # Our stage
    stage = Clutter.Stage(title='Content Box', user_resizable=True)
    stage.set_margin(Clutter.Margin(12))
    stage.connect('destroy', Clutter.main_quit)
    stage.show()

    # Load the texture data from a file
    pixbuf = GdkPixbuf.Pixbuf.new_from_file('redhand.png')

    # Use the correct pixel format depending on whether the image
    # has an alpha channel
    pixel_format = Cogl.PixelFormat.RGB_888
    if pixbuf.get_has_alpha():
        pixel_format = Cogl.PixelFormat.RGBA_8888

    data = pixbuf.read_pixel_bytes()
    width = pixbuf.get_width()
    height = pixbuf.get_height()