Exemple #1
0
class AnimatingMenuItem(TextMenuItem):
    """A TextMenuItem implementing animate_in and animate_out."""

    def __init__(self, width, height, text, extra_text=None):
        TextMenuItem.__init__(self, width, height, text, extra_text)

        self.move_anchor_point_from_gravity(clutter.GRAVITY_WEST)
        self.font_size = 0.03
        self.update()

        self.timeline = clutter.Timeline(200)
        alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = FontSizeBehaviour(alpha)
        self.behaviour.apply(self)

    def animate_in(self):
        """Set labels font-size and color when an item gets selected."""
        self.behaviour.start_size = 0.03
        self.behaviour.end_size = 0.05
        self.color = "menuitem_active"
        self.timeline.start()
        self.update()

    def animate_out(self):
        """Set labels font-size and color when an item gets unselected."""
        self.color = "menuitem_inactive"
        self.update()
        self.behaviour.start_size = 0.05
        self.behaviour.end_size = 0.03
        self.timeline.start()
Exemple #2
0
class AnimatingMenuItem(TextMenuItem):
    """A TextMenuItem implementing animate_in and animate_out."""
    def __init__(self, width, height, text, extra_text=None):
        TextMenuItem.__init__(self, width, height, text, extra_text)

        self.move_anchor_point_from_gravity(clutter.GRAVITY_WEST)
        self.font_size = 0.03
        self.update()

        self.timeline = clutter.Timeline(200)
        alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = FontSizeBehaviour(alpha)
        self.behaviour.apply(self)

    def animate_in(self):
        """Set labels font-size and color when an item gets selected."""
        self.behaviour.start_size = 0.03
        self.behaviour.end_size = 0.05
        self.color = "menuitem_active"
        self.timeline.start()
        self.update()

    def animate_out(self):
        """Set labels font-size and color when an item gets unselected."""
        self.color = "menuitem_inactive"
        self.update()
        self.behaviour.start_size = 0.05
        self.behaviour.end_size = 0.03
        self.timeline.start()
Exemple #3
0
    def __init__(self, width, height, text, extra_text=None):
        TextMenuItem.__init__(self, width, height, text, extra_text)

        self.move_anchor_point_from_gravity(clutter.GRAVITY_WEST)
        self.font_size = 0.03
        self.update()

        self.timeline = clutter.Timeline(200)
        alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = FontSizeBehaviour(alpha)
        self.behaviour.apply(self)
Exemple #4
0
    def __init__(self, width, height, text, extra_text=None):
        TextMenuItem.__init__(self, width, height, text, extra_text)

        self.move_anchor_point_from_gravity(clutter.GRAVITY_WEST)
        self.font_size = 0.03
        self.update()

        self.timeline = clutter.Timeline(200)
        alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = FontSizeBehaviour(alpha)
        self.behaviour.apply(self)