Пример #1
0
    def forward_effect(self, from_screen, to_screen):
        """
        Fade out all components from the "from_screen" and fade in all
        components of the "to_screen".
        @param from_screen: Screen object (Currently displayed screen)
        @param to_screen: Screen object (Screen displayed after transition)
        """
        # Initialize to_screen for animation
        to_screen.set_opacity(0x00)
        to_screen.show()

        # Fade out current screen
        if from_screen is not None:
            fade_out = clutter.Timeline(20, 60)
            alpha_out = clutter.Alpha(fade_out, clutter.smoothstep_inc_func)
            self.out_behaviour = clutter.BehaviourOpacity(
                0xff, 0x00, alpha_out)
            self.out_behaviour.apply(from_screen)

            if self.direction == self.BACKWARD:
                self.direction = self.FORWARD  # Reset value
                fade_out.connect('completed', self._remove_from_stage_callback,
                                 from_screen)

        # Fade in timeline
        fade_in = clutter.Timeline(20, 60)
        alpha_in = clutter.Alpha(fade_in, clutter.smoothstep_inc_func)
        self.in_behaviour = clutter.BehaviourOpacity(0x00, 0xff, alpha_in)
        self.in_behaviour.apply(to_screen)

        # Start transition animation
        if from_screen is not None:
            fade_out.start()
        fade_in.start()
Пример #2
0
    def __init__(self, theme):
        clutter.Group.__init__(self)
        self.animate_selector = False

        selector_filename = theme.getImage("selector")
        glow_filename = theme.getImage("selector_glow")

        # Set selector base texture
        self.selector = Texture(selector_filename)
        self.selector.set_opacity(200)
        self.add(self.selector)

        # Set selector GLOW texture
        self.glow = Texture(glow_filename)
        self.glow.set_opacity(0)
        self.add(self.glow)

        # Animate selector (Glow effect with glow overlay texture)
        self.in_time = clutter.Timeline(1500)
        self.in_alpha = clutter.Alpha(self.in_time, clutter.EASE_IN_OUT_SINE)
        self.in_behaviour = clutter.BehaviourOpacity(0, 255, self.in_alpha)
        self.in_behaviour.apply(self.glow)

        self.out_time = clutter.Timeline(1500)
        self.out_alpha = clutter.Alpha(self.out_time, clutter.EASE_IN_OUT_SINE)
        self.out_behaviour = clutter.BehaviourOpacity(255, 0, self.out_alpha)
        self.out_behaviour.apply(self.glow)

        self.score = clutter.Score()
        self.score.set_loop(True)
        self.score.append(timeline=self.in_time)
        # Link the out Timeline so that there is a smooth fade out.
        self.score.append(timeline=self.out_time, parent=self.in_time)
Пример #3
0
    def _change_preview_image(self):
        """
        Run a timeline that crossfades preview images. This method is a callback
        that is called every 4 seconds.
        """
        if len(self.preview_textures) <= 1:
            self.preview_textures[0].set_opacity(255)
        elif self.config.show_effects:
            #Fade out timeline
            fade_out = clutter.Timeline(500)
            alpha_out = clutter.Alpha(fade_out, clutter.EASE_IN_OUT_SINE)
            self.out_behaviour = clutter.BehaviourOpacity(255, 0, alpha_out)
            self.out_behaviour.apply(self.preview_textures[0])

            # Fade in timeline
            fade_in = clutter.Timeline(500)
            alpha_in = clutter.Alpha(fade_in, clutter.EASE_IN_OUT_SINE)
            self.in_behaviour = clutter.BehaviourOpacity(0, 255, alpha_in)
            self.in_behaviour.apply(self.preview_textures[1])

            # Start animation
            fade_out.start()
            fade_in.start()
        else:
            self.preview_textures[0].set_opacity(0)
            self.preview_textures[1].set_opacity(255)

        # Scroll images
        self.preview_textures = self.preview_textures[1:] + \
            self.preview_textures[:1]

        return True
Пример #4
0
    def _update_albumart(self, artist, title):
        """
        Search album art for current audio disc. This function is called only
        if album art doesn't exist already. If album art is found then we
        replace current disc icon with the new album art.
        @param artist: Artist name
        @param title: Album title
        """
        art_file = os.path.join(self.config.ALBUM_ART_DIR,
            artist + " - " + title + ".jpg")

        if os.path.exists(art_file):
            clutter.threads_enter()
            self.art2 = Texture(art_file, 0.1, 0.165)
            clutter.threads_leave()

            self.art2.set_size(self.get_abs_x(0.3148), self.get_abs_y(0.5599))
            self.art2.set_opacity(0)
            self.add(self.art2)

            timeline_in = clutter.Timeline(35, 26)
            alpha_in = clutter.Alpha(timeline_in, clutter.smoothstep_inc_func)
            self.in_behaviour = clutter.BehaviourOpacity(0, 255, alpha_in)
            self.in_behaviour.apply(self.art2)

            timeline_out = clutter.Timeline(35, 26)
            alpha_out = clutter.Alpha(timeline_out, clutter.smoothstep_inc_func)
            self.out_behaviour = clutter.BehaviourOpacity(255, 0, alpha_out)
            self.out_behaviour.apply(self.art)

            timeline_out.start()
            timeline_in.start()
Пример #5
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()
Пример #6
0
 def __init__(self, theme):
     """Initialize overlay texture."""
     Texture.__init__(self, filename=theme.getImage("menu_overlay"))
     self.timeline = clutter.Timeline(500)
     self.alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
     self.behaviour = clutter.BehaviourOpacity(255, 0, self.alpha)
     self.behaviour.apply(self)
Пример #7
0
    def __init__(self, message):
        self.stage = clutter.Stage()
        self.stage.set_color(clutter.color_from_string('DarkSlateGrey'))
        self.stage.set_size(800, 600)
        self.stage.set_title('My First Clutter Application')
        self.stage.connect('key-press-event', clutter.main_quit)
        self.stage.connect('button-press-event', self.on_button_press_event)

        color = clutter.Color(0xff, 0xcc, 0xcc, 0xdd)

        self.label = clutter.Text()
        self.label.set_font_name('Mono 32')
        self.label.set_text(message)
        self.label.set_color(color)
        (label_width, label_height) = self.label.get_size()
        label_x = self.stage.get_width() - label_width - 50
        label_y = self.stage.get_height() - label_height
        self.label.set_position(label_x, label_y)
        self.stage.add(self.label)

        self.cursor = clutter.Rectangle()
        self.cursor.set_color(color)
        self.cursor.set_size(20, label_height)
        cursor_x = self.stage.get_width() - 50
        cursor_y = self.stage.get_height() - label_height
        self.cursor.set_position(cursor_x, cursor_y)
        self.stage.add(self.cursor)

        self.timeline = clutter.Timeline(500)
        self.timeline.set_loop(True)
        alpha = clutter.Alpha(self.timeline, clutter.LINEAR)
        self.behaviour = clutter.BehaviourOpacity(0xdd, 0, alpha)
        self.behaviour.apply(self.cursor)
Пример #8
0
    def __init__(self, name, title="Untitled tab", callback=None):
        Base.__init__(self)
        clutter.Group.__init__(self)

        self.name = name
        self.title = title
        self.callback = callback
        self.theme = self.config.theme

        self.dispatch = {
            UserEvent.NAVIGATE_UP : self._handle_up,
            UserEvent.NAVIGATE_DOWN : self._handle_down,
            UserEvent.NAVIGATE_LEFT : self._handle_left,
            UserEvent.NAVIGATE_RIGHT : self._handle_right,
            UserEvent.NAVIGATE_SELECT : self._handle_select,
        }

        # show/hide animation on the Tab
        self.timeline = clutter.Timeline(500)
        self.timeline.connect('completed', self._on_timeline_completed)
        self.alpha = clutter.Alpha(self.timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = clutter.BehaviourOpacity(0, 255, self.alpha)
        self.behaviour.apply(self)

        # Tabs are created deactivated and invisible
        self._active = None
        self._visible = False
        self.set_opacity(0)
        self.hide()
Пример #9
0
    def _update_album_preview(self, album):
        """
        Update album preview. Display preview images from the current album.
        @param album: Currently selected album in menu
        """
        if self.preview_fade is not None:
            gobject.source_remove(self.preview_fade)

        new = self._create_album_preview(album)

        if self.config.show_effects:
            old = self.preview
            new.set_opacity(0)
            self.preview = new
            self.add(self.preview)

            #Fade out timeline
            timeline1 = clutter.Timeline(500)
            alpha1 = clutter.Alpha(timeline1, clutter.EASE_IN_OUT_SINE)
            self.out_opacity = clutter.BehaviourOpacity(255, 0, alpha1)
            self.out_opacity.apply(old)

            timeline1.connect('completed', self._change_preview_timeline_ended,
                              old)

            # Fade in timeline
            timeline2 = clutter.Timeline(500)
            alpha2 = clutter.Alpha(timeline2, clutter.EASE_IN_OUT_SINE)
            self.in_opacity = clutter.BehaviourOpacity(0, 255, alpha2)
            self.in_opacity.apply(new)

            # Start animation
            timeline1.start()
            timeline2.start()
        else:
            # Do it without animation
            if self.preview is not None:
                self.remove(self.preview)
            self.preview = new
            self.add(self.preview)

        if len(self.preview_textures) > 1:
            self.preview_fade = gobject.timeout_add(6000,
                                                    self._change_preview_image)

        return False  # see gobject.timeout_add() doc
Пример #10
0
    def hide(self):
        '''Hide throbber smoothly and stop animation.'''
        timeline = clutter.Timeline(2000)
        alpha = clutter.Alpha(timeline, clutter.EASE_IN_OUT_SINE)
        self.behaviour = clutter.BehaviourOpacity(255, 0, alpha)
        self.behaviour.apply(self)
        timeline.start()

        gobject.timeout_add(5, self._stop_rotating, timeline)
Пример #11
0
    def __init__(self, x, y, width, height, color="title"):
        Base.__init__(self)
        clutter.Group.__init__(self)

        self.width = self.get_abs_x(width)
        self.height = self.get_abs_y(height)
        self.bar_width = int(self.width * self.BAR_LENGTH)
        self.bar_x = int(self.width * self.INFO_LENGTH)
        self.media_length_x = (1 - self.INFO_LENGTH + 0.05) * width

        self.set_position(self.get_abs_x(x), self.get_abs_y(y))

        self._color = self._color_to_cairo_color(
            self.config.theme.get_color(color))

        self._background = clutter.CairoTexture(self.bar_width, self.height)
        self._draw_background()
        self._background.set_position(self.bar_x, 0)
        self.add(self._background)

        self._foreground = clutter.CairoTexture(self.height, self.height)
        self._foreground.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
        self._draw_foreground()
        self._foreground.set_position(self.bar_x, 0)
        self.add(self._foreground)

        self.media_position = Label(0.037, "title", 0, 0, "")
        self.add(self.media_position)

        self.media_length = Label(0.037, "title", self.media_length_x, 0, "")
        self.add(self.media_length)

        self._media_player = None
        self._progress_bar_moving = False

        self._hide_timeout_key = None
        self.auto_display = False
        self._visible = None
        self._timeline = clutter.Timeline(500)
        self._alpha = clutter.Alpha(self._timeline, clutter.EASE_IN_OUT_SINE)
        self._behaviour = clutter.BehaviourOpacity(0, 255, self._alpha)
        self._behaviour.apply(self)

        self._progress = None
        # Call the property setter to initialize the displayed position.
        self.progress = 0

        # Preparation to pointer events handling.
        self._motion_handler = 0
        self.set_reactive(True)
        self.connect('scroll-event', self._on_scroll_event)
        self.connect('button-press-event', self._on_button_press_event)
        self.connect('button-release-event', self._on_button_release_event)
        self.connect('enter-event', self._on_enter_event)
        self.connect('leave-event', self._on_leave_event)
Пример #12
0
    def forward_effect(self, from_screen, to_screen):
        """
        Fade+zoom out all components from the "from_screen" and fade+zoom in
        all components of the "to_screen".
        @param from_screen: Screen object (Currently displayed screen)
        @param to_screen: Screen object (Screen displayed after transition)
        """
        # Initialize to_screen for animation
        to_screen.set_opacity(0)
        to_screen.show()

        # Fade out current screen
        if from_screen is not None:
            fade_out = clutter.Timeline(22, 85)
            alpha_out = clutter.Alpha(fade_out, clutter.smoothstep_inc_func)
            self.out_fade = clutter.BehaviourOpacity(255, 0, alpha_out)
            self.out_fade.apply(from_screen)
            #from_screen.set_anchor_point_from_gravity(
            #                                       clutter.GRAVITY_CENTER)
            self.out_zoom = clutter.BehaviourScale(1.0, 1.0, 1.2, 1.2,
                                                    alpha_out)
            #from_screen.set_anchor_point(0,0)
            self.out_zoom.apply(from_screen)

        # Fade in timeline
        fade_in = clutter.Timeline(22, 85)
        alpha_in = clutter.Alpha(fade_in, clutter.smoothstep_inc_func)
        self.in_behaviour = clutter.BehaviourOpacity(0, 255, alpha_in)
        self.in_behaviour.apply(to_screen)
        #to_screen.set_anchor_point_from_gravity(
        #                                           clutter.GRAVITY_CENTER)
        self.in_zoom = clutter.BehaviourScale(0.8, 0.8, 1.0, 1.0, alpha_in)
        #to_screen.set_anchor_point(0,0)
        self.in_zoom.apply(to_screen)

        # Start transition animation
        if from_screen is not None:
            fade_out.start()
        fade_in.start()
Пример #13
0
 def __init__(self, actor, function, duration, target, start=None):
     self.actor = actor
     self.function = function
     self.duration = duration
     if start is None:
         self.startValue = actor.get_opacity()
     else:
         self.startValue = start
     self.targetValue = target
     self.timeline = clutter.Timeline(self.duration)
     self.alpha = clutter.Alpha(self.timeline, self.function)
     self.BehOp = clutter.BehaviourOpacity(self.startValue,
                                           self.targetValue, self.alpha)
     self.BehOp.apply(actor)
Пример #14
0
    def backward_effect(self, from_screen, to_screen):
        """ 
        Do the same as forward_effect, but zoom backwards. This gives an
        illusion of going back.
        @param from_screen: Screen object (Currently displayed screen)
        @param to_screen: Screen object (Screen displayed after transition)
        """
        # Initialize to_screen for animation
        to_screen.set_opacity(0x00)
        to_screen.show()

        # Fade out current screen
        fade_out = clutter.Timeline(22, 85)
        alpha_out = clutter.Alpha(fade_out, clutter.smoothstep_inc_func)
        self.out_fade = clutter.BehaviourOpacity(255, 0, alpha_out)
        self.out_fade.apply(from_screen)
        #from_screen.set_anchor_point_from_gravity(
        #                                           clutter.GRAVITY_CENTER)
        self.out_zoom = clutter.BehaviourScale(1.0, 1.0, 0.8, 0.8, alpha_out)
        self.out_zoom.apply(from_screen)
        fade_out.connect('completed', self._remove_from_stage_callback,
                                                    from_screen)

        # Fade in timeline
        fade_in = clutter.Timeline(22, 85)
        alpha_in = clutter.Alpha(fade_in, clutter.smoothstep_inc_func)
        self.in_behaviour = clutter.BehaviourOpacity(0, 255, alpha_in)
        self.in_behaviour.apply(to_screen)
        #to_screen.set_anchor_point_from_gravity(
        #                                           clutter.GRAVITY_CENTER)
        self.in_zoom = clutter.BehaviourScale(1.2, 1.2, 1.0, 1.0, alpha_in)
        self.in_zoom.apply(to_screen)

        # Start transition animation
        if from_screen is not None:
            fade_out.start()
        fade_in.start()
Пример #15
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
Пример #16
0
    def __init__(self, obj):
        super(BlinkingText, self).__init__(
            settings.SCROLLING_TEXT_FONT, obj.__str__()
            )
        self.obj = obj

        # Setup text attributes
        self.set_color(FONT_COLOR)
        self.set_opacity(FONT_OPACITY)
        self.set_property('scale-gravity', clutter.GRAVITY_CENTER)
        self.set_line_alignment(ALIGN_CENTER)
        self.set_line_wrap(True)

        # Setup blinking timeline.
        self.timeline = clutter.Timeline(duration=settings.BLINKING_TEXT_RATE)
        self.timeline.set_loop(True)
        self.alpha = clutter.Alpha(self.timeline, clutter.LINEAR)
        self.blink = clutter.BehaviourOpacity(alpha=self.alpha,
                                              opacity_start=FONT_OPACITY,
                                              opacity_end=255)
        self.timeline.connect('completed', self.on_blink_completed)
Пример #17
0
    def _update_preview_area(self):
        '''Update the preview area to display the current menu item.'''
        self.preview.remove_all()
        item = self.menu.get_selected()

        self.preview.set_opacity(0x00)

        update = True

        if item.get_name() == "playing":
            self.preview.add(self._create_playing_preview())
        else:
            update = False

        # If the preview was updated fade it in.
        if update:
            fade_in = clutter.Timeline(500)
            alpha_in = clutter.Alpha(fade_in, clutter.EASE_IN_OUT_SINE)
            self.behaviour = clutter.BehaviourOpacity(0, 255, alpha_in)
            self.behaviour.apply(self.preview)
            fade_in.start()
Пример #18
0
def on_timeline_rotation_completed(timeline):
    # All the items have now been rotated so that the clicked item is at the
    # front.  Now we transform just this one item gradually some more, and
    # show the filename.

    # Transform the image
    global timeline_moveup
    actor = item_at_front.actor
    timeline_moveup = clutter.Timeline(1000) # milliseconds
    alpha = clutter.Alpha(timeline_moveup, clutter.EASE_OUT_SINE)

    # Scale the item from its normal scale to approximately twice the normal scale
    scale_start = actor.get_scale()[0]
    scale_end = scale_start * 1.8

    global behaviour_scale
    behaviour_scale = clutter.BehaviourScale(scale_start, scale_start,
                                             scale_end, scale_end,
                                             alpha=alpha)
    behaviour_scale.apply(actor)

    # Move the item up the y axis
    knots = (
        (int(actor.get_x()), int(actor.get_y())),
        (int(actor.get_x()), int(actor.get_y() - 250)),
    )
    global behaviour_path
    behaviour_path = clutter.BehaviourPath(alpha, knots=knots)
    behaviour_path.apply(actor)

    # Show the filename gradually
    global label_filename
    label_filename.set_text(item_at_front.filepath)
    global behaviour_opacity
    behaviour_opacity = clutter.BehaviourOpacity(0, 255, alpha=alpha)
    behaviour_opacity.apply(label_filename)

    # Start the timeline and handle its "completed" signal so we can unref it
    timeline_moveup.connect('completed', on_timeline_moveup_completed)
    timeline_moveup.start()
Пример #19
0
    def _change_image(self, index):
        """
        Change current image. Display image from given index.
        """
        if self.texture:
            self.texture.destroy()

        # Create a new texture and display it
        image = self.images[index]
        self.index = index
        self.texture = Texture(image.get_filename())
        self._scale_image(self.texture)

        timeline = clutter.Timeline(1000)
        alpha = clutter.Alpha(timeline, clutter.EASE_IN_OUT_SINE)
        self.opacity_behaviour = clutter.BehaviourOpacity(alpha=alpha,
                                                          opacity_start=0,
                                                          opacity_end=255)
        self.opacity_behaviour.apply(self.texture)
        self.texture.set_opacity(0)
        timeline.start()

        self.add(self.texture)
Пример #20
0
    def __init__(self, image_library, music_library, video_library,
        quit_client_callback):
        self.quit_client_callback = quit_client_callback
        self.config = Configuration()

        # Store the dimensions in case users want to return to window mode
        self.old_width = self.config.stage_width
        self.old_height = self.config.stage_height

        self.logger = Logger().getLogger('client.gui.UserInterface')

        self.window = gtk.Window()
        self.window.connect('destroy', self.destroy_callback)
        self.window.set_title('Entertainer')

        # Set the window icon
        icon_theme = gtk.icon_theme_get_default()
        try:
            icon = icon_theme.load_icon('entertainer', 48, 0)
            self.window.set_icon(icon)
        except gobject.GError:
            # Must not be installed from a package, get icon from the branch
            file_dir = os.path.dirname(__file__)
            icon_path = os.path.join(file_dir, '..', '..', 'icons',
                'hicolor', '48x48', 'apps', 'entertainer.png')
            icon = gtk.gdk.pixbuf_new_from_file(icon_path)
            self.window.set_icon(icon)

        # cluttergtk.Embed contains the stage that is the canvas for the GUI
        embed = cluttergtk.Embed()
        # Enforce a minimum size to prevent weird widget bugs
        embed.set_size_request(
            self.config.stage_width, self.config.stage_height)
        self.window.add(embed)

        # The embed widget must be realized before you can get the stage.
        embed.realize()
        self.stage = embed.get_stage()

        self._hide_cursor_timeout_key = None

        self.stage.connect('key-press-event', self.handle_keyboard_event)
        self.stage.connect('motion-event', self._handle_motion_event)
        self.stage.set_color(self.config.theme.get_color("background"))
        self.stage.set_size(self.config.stage_width, self.config.stage_height)
        self.stage.set_title("Entertainer")

        if self.config.start_in_fullscreen:
            self._fullscreen()
            self.is_fullscreen = True
        else:
            self.is_fullscreen = False

        # Initialize Screen history (allows user to navigate "back")
        self.history = ScreenHistory(self._remove_from_stage)

        self.player = MediaPlayer(self.stage,
            self.config.stage_width, self.config.stage_height)
        self.player.connect('volume-changed', self._on_volume_changed)

        # Initialize menu overlay texture
        self.is_overlay = False
        self.menu_overlay = MenuOverlay(self.config.theme)
        self.menu_overlay.set_opacity(0)
        self.menu_overlay.set_size(
            self.config.stage_width, self.config.stage_height)
        self.stage.add(self.menu_overlay)

        self.volume_indicator = VolumeIndicator()
        self.stage.add(self.volume_indicator)
        self.volume_indicator.connect('hiding',
            self._on_volume_indicator_hiding)
        self.fade_screen_timeline = clutter.Timeline(200)
        alpha = clutter.Alpha(self.fade_screen_timeline,
            clutter.EASE_IN_OUT_SINE)
        self.fade_screen_behaviour = clutter.BehaviourOpacity(255, 0, alpha)

        # Transition object. Handles effects between screen changes.
        transition_factory = TransitionFactory(self._remove_from_stage)
        self.transition = transition_factory.generate_transition()

        # Screen factory to create new screens
        self.screen_factory = ScreenFactory(
            image_library, music_library, video_library, self.player,
            self.move_to_new_screen, self.move_to_previous_screen)

        def default_key_to_user_event():
            '''Return the default user event provided by an unmapped keyboard
            event.'''
            return UserEvent.DEFAULT_EVENT

        # Dictionary for keyboard event handling
        self.key_to_user_event = defaultdict(default_key_to_user_event, {
            clutter.keysyms.Return : UserEvent.NAVIGATE_SELECT,
            clutter.keysyms.Up : UserEvent.NAVIGATE_UP,
            clutter.keysyms.Down : UserEvent.NAVIGATE_DOWN,
            clutter.keysyms.Left : UserEvent.NAVIGATE_LEFT,
            clutter.keysyms.Right : UserEvent.NAVIGATE_RIGHT,
            clutter.keysyms.BackSpace : UserEvent.NAVIGATE_BACK,
            clutter.keysyms.h : UserEvent.NAVIGATE_HOME,
            clutter.keysyms.w : UserEvent.NAVIGATE_FIRST_PAGE,
            clutter.keysyms.e : UserEvent.NAVIGATE_PREVIOUS_PAGE,
            clutter.keysyms.r : UserEvent.NAVIGATE_NEXT_PAGE,
            clutter.keysyms.t : UserEvent.NAVIGATE_LAST_PAGE,
            clutter.keysyms.f : UserEvent.TOGGLE_FULLSCREEN,
            clutter.keysyms.p : UserEvent.PLAYER_PLAY_PAUSE,
            clutter.keysyms.s : UserEvent.PLAYER_STOP,
            clutter.keysyms._1 : UserEvent.USE_ASPECT_RATIO_1,
            clutter.keysyms._2 : UserEvent.USE_ASPECT_RATIO_2,
            clutter.keysyms._3 : UserEvent.USE_ASPECT_RATIO_3,
            clutter.keysyms._4 : UserEvent.USE_ASPECT_RATIO_4,
            clutter.keysyms.x : UserEvent.PLAYER_SKIP_BACKWARD,
            clutter.keysyms.c : UserEvent.PLAYER_SKIP_FORWARD,
            clutter.keysyms.z : UserEvent.PLAYER_PREVIOUS,
            clutter.keysyms.v : UserEvent.PLAYER_NEXT,
            clutter.keysyms.m : UserEvent.PLAYER_VOLUME_UP,
            clutter.keysyms.l : UserEvent.PLAYER_VOLUME_DOWN,
            clutter.keysyms.q : UserEvent.QUIT,
            clutter.keysyms.Escape : UserEvent.QUIT
        })

        self.event_handlers = {
            UserEvent.DEFAULT_EVENT : self._handle_default,
            UserEvent.NAVIGATE_SELECT : self._handle_default,
            UserEvent.NAVIGATE_UP : self._handle_default,
            UserEvent.NAVIGATE_DOWN : self._handle_default,
            UserEvent.NAVIGATE_LEFT : self._handle_default,
            UserEvent.NAVIGATE_RIGHT : self._handle_default,
            UserEvent.NAVIGATE_BACK : self._handle_navigate_back,
            UserEvent.NAVIGATE_HOME : self._handle_navigate_home,
            UserEvent.NAVIGATE_FIRST_PAGE : self._handle_default,
            UserEvent.NAVIGATE_PREVIOUS_PAGE : self._handle_default,
            UserEvent.NAVIGATE_NEXT_PAGE : self._handle_default,
            UserEvent.NAVIGATE_LAST_PAGE : self._handle_default,
            UserEvent.TOGGLE_FULLSCREEN : self._handle_toggle_fullscreen,
            UserEvent.PLAYER_PLAY_PAUSE : self._handle_player_play_pause,
            UserEvent.PLAYER_STOP : self._handle_player_stop,
            UserEvent.USE_ASPECT_RATIO_1 : self._handle_aspect_ratio,
            UserEvent.USE_ASPECT_RATIO_2 : self._handle_aspect_ratio,
            UserEvent.USE_ASPECT_RATIO_3 : self._handle_aspect_ratio,
            UserEvent.USE_ASPECT_RATIO_4 : self._handle_aspect_ratio,
            UserEvent.PLAYER_SKIP_BACKWARD : self._handle_player_skip_backward,
            UserEvent.PLAYER_SKIP_FORWARD : self._handle_player_skip_forward,
            UserEvent.PLAYER_PREVIOUS : self._handle_player_previous,
            UserEvent.PLAYER_NEXT : self._handle_player_next,
            UserEvent.PLAYER_VOLUME_UP : self._handle_player_volume_up,
            UserEvent.PLAYER_VOLUME_DOWN : self._handle_player_volume_down,
            UserEvent.QUIT : self._handle_quit_client
        }

        self.logger.debug("Frontend GUI initialized succesfully")
Пример #21
0
    def _create_navigation_textures(self):
        '''Create the pause, seek-backward & seek-forward textures.'''
        self.pause_texture = Texture(
            self.theme.getImage("media-playback-pause"), 0.5, 0.5)
        self.pause_texture.set_anchor_point_from_gravity(
            clutter.GRAVITY_CENTER)
        self.pause_texture.hide()
        self.add(self.pause_texture)

        pause_in_time = clutter.Timeline(1000)
        in_alpha_pause = clutter.Alpha(pause_in_time, clutter.EASE_IN_OUT_SINE)

        self.pause_in_opacity = clutter.BehaviourOpacity(alpha=in_alpha_pause,
                                                         opacity_start=100,
                                                         opacity_end=255)
        self.pause_in_scale = clutter.BehaviourScale(1.0, 1.0, 1.4, 1.4,
                                                     in_alpha_pause)

        self.pause_in_opacity.apply(self.pause_texture)
        self.pause_in_scale.apply(self.pause_texture)

        pause_out_time = clutter.Timeline(1000)
        out_alpha_pause = clutter.Alpha(pause_out_time,
                                        clutter.EASE_IN_OUT_SINE)

        self.pause_out_opacity = clutter.BehaviourOpacity(
            alpha=out_alpha_pause, opacity_start=255, opacity_end=100)
        self.pause_out_scale = clutter.BehaviourScale(1.4, 1.4, 1.0, 1.0,
                                                      out_alpha_pause)

        self.pause_out_opacity.apply(self.pause_texture)
        self.pause_out_scale.apply(self.pause_texture)

        self.score = clutter.Score()
        self.score.set_loop(True)
        self.score.append(timeline=pause_in_time)
        self.score.append(timeline=pause_out_time, parent=pause_in_time)
        self.score.start()

        self.seekbackward_texture = Texture(
            self.theme.getImage("media-seek-backward"), 0.1, 0.5)
        self.seekbackward_texture.set_anchor_point_from_gravity(
            clutter.GRAVITY_CENTER)
        self.seekbackward_texture.set_opacity(0)
        self.add(self.seekbackward_texture)

        self.seekbackward_timeline = clutter.Timeline(1000)
        alpha_seekbackward = clutter.Alpha(self.seekbackward_timeline,
                                           clutter.EASE_IN_OUT_SINE)

        self.seekbackward_opacity = clutter.BehaviourOpacity(
            alpha=alpha_seekbackward, opacity_start=255, opacity_end=0)
        self.seekbackward_opacity.apply(self.seekbackward_texture)

        self.seekforward_texture = Texture(
            self.theme.getImage("media-seek-forward"), 0.9, 0.5)
        self.seekforward_texture.set_anchor_point_from_gravity(
            clutter.GRAVITY_CENTER)
        self.seekforward_texture.set_opacity(0)
        self.add(self.seekforward_texture)

        self.seekforward_timeline = clutter.Timeline(1000)
        alpha_seekforward = clutter.Alpha(self.seekforward_timeline,
                                          clutter.EASE_IN_OUT_SINE)

        self.seekforward_opacity = clutter.BehaviourOpacity(
            alpha=alpha_seekforward, opacity_start=255, opacity_end=0)
        self.seekforward_opacity.apply(self.seekforward_texture)
Пример #22
0
 def _fadeOutOpac(self, page):
     self.b1 = clutter.BehaviourOpacity(255, 0, self.pageTurnAlpha)
     self.b2 = clutter.BehaviourDepth(0, 255, self.pageTurnAlpha)
     self.b1.apply(page)
     self.b2.apply(page)
Пример #23
0
 def _fadeInOpac(self, page):
     self.a1 = clutter.BehaviourOpacity(0, 255, self.pageTurnAlpha)
     self.a2 = clutter.BehaviourDepth(-255, 0, self.pageTurnAlpha)
     self.a1.apply(page)
     self.a2.apply(page)
Пример #24
0
    def __init__(self, width=DEFAULT_SYMBOL_SIZE, color='solid'):
        super(Symbol, self).__init__(clutter.BinLayout(True, True))

        self.set_width(width)

        self.circle = clutter.CairoTexture(width, width)
        cr = self.circle.cairo_create()
        cr.set_operator(cairo.OPERATOR_CLEAR)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)
        cr.arc(width / 2, width / 2, width / 2, 0.0, 2 * math.pi)

        if color == 'solid':
            pattern = cairo.SolidPattern(0.20, 0.20, 0.20, 0.9)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

        elif color == 'bubble':
            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0, 0.88, 0.95, 0.99, 0.1)
            pattern.add_color_stop_rgba(0.6, 0.88, 0.95, 0.99, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.67, 0.83, 0.91, 0.2)
            pattern.add_color_stop_rgba(0.9, 0.5, 0.67, 0.88, 0.7)
            pattern.add_color_stop_rgba(1.0, 0.3, 0.43, 0.69, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.LinearGradient(0, 0, width, width)
            pattern.add_color_stop_rgba(0.0, 1.0, 1.0, 1.0, 0.0)
            pattern.add_color_stop_rgba(0.15, 1.0, 1.0, 1.0, 0.95)
            pattern.add_color_stop_rgba(0.3, 1.0, 1.0, 1.0, 0.0)
            pattern.add_color_stop_rgba(0.7, 1.0, 1.0, 1.0, 0.95)
            pattern.add_color_stop_rgba(1.0, 1.0, 1.0, 1.0, 0.0)
            cr.set_source(pattern)
            cr.fill()
            del pattern

        elif color == 'blue':
            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0, 0.22, 0.22, 0.99, 0.1)
            pattern.add_color_stop_rgba(0.6, 0.22, 0.22, 0.88, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.22, 0.22, 0.67, 0.2)
            pattern.add_color_stop_rgba(0.9, 0.22, 0.22, 0.55, 0.7)
            pattern.add_color_stop_rgba(1.0, 0.22, 0.22, 0.44, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0.9, 0.22, 0.22, 0.99, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.22, 0.22, 0.88, 0.1)
            pattern.add_color_stop_rgba(0.75, 0.22, 0.22, 0.67, 0.2)
            pattern.add_color_stop_rgba(0.7, 0.22, 0.22, 0.55, 0.7)
            pattern.add_color_stop_rgba(0.1, 0.22, 0.22, 0.44, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.LinearGradient(0, 0, width, width)
            pattern.add_color_stop_rgba(0.0, 0.0, 0.0, 1.0, 0.0)
            pattern.add_color_stop_rgba(0.15, 0.0, 0.0, 1.0, 0.95)
            pattern.add_color_stop_rgba(0.3, 0.0, 0.0, 1.0, 0.0)
            pattern.add_color_stop_rgba(0.7, 0.0, 0.0, 1.0, 0.95)
            pattern.add_color_stop_rgba(1.0, 0.0, 0.0, 1.0, 0.0)
            cr.set_source(pattern)
            cr.fill()
            del pattern

        elif color == 'green':
            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0, 0.22, 0.99, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.6, 0.22, 0.88, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.22, 0.67, 0.22, 0.2)
            pattern.add_color_stop_rgba(0.9, 0.22, 0.55, 0.22, 0.7)
            pattern.add_color_stop_rgba(1.0, 0.22, 0.44, 0.22, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0.9, 0.22, 0.99, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.22, 0.88, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.75, 0.22, 0.67, 0.22, 0.2)
            pattern.add_color_stop_rgba(0.7, 0.22, 0.55, 0.22, 0.7)
            pattern.add_color_stop_rgba(0.1, 0.22, 0.44, 0.22, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.LinearGradient(0, 0, width, width)
            pattern.add_color_stop_rgba(0.0, 0.0, 1.0, 0.0, 0.0)
            pattern.add_color_stop_rgba(0.15, 0.0, 1.0, 0.0, 0.95)
            pattern.add_color_stop_rgba(0.3, 0.0, 1.0, 0.0, 0.0)
            pattern.add_color_stop_rgba(0.7, 0.0, 1.0, 0.0, 0.95)
            pattern.add_color_stop_rgba(1.0, 0.0, 1.0, 0.0, 0.0)
            cr.set_source(pattern)
            cr.fill()
            del pattern

        elif color == 'red':
            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0, 0.99, 0.22, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.6, 0.88, 0.22, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.67, 0.22, 0.22, 0.2)
            pattern.add_color_stop_rgba(0.9, 0.55, 0.22, 0.22, 0.7)
            pattern.add_color_stop_rgba(1.0, 0.44, 0.22, 0.22, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.RadialGradient(width / 2, width / 2, 0, width / 2,
                                           width / 2, width / 2)
            pattern.add_color_stop_rgba(0.9, 0.99, 0.22, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.8, 0.88, 0.22, 0.22, 0.1)
            pattern.add_color_stop_rgba(0.75, 0.67, 0.22, 0.22, 0.2)
            pattern.add_color_stop_rgba(0.7, 0.55, 0.22, 0.22, 0.7)
            pattern.add_color_stop_rgba(0.1, 0.44, 0.22, 0.22, 0.8)
            cr.set_source(pattern)
            cr.fill_preserve()
            del pattern

            pattern = cairo.LinearGradient(0, 0, width, width)
            pattern.add_color_stop_rgba(0.0, 1.0, 0.0, 0.0, 0.0)
            pattern.add_color_stop_rgba(0.15, 1.0, 0.0, 0.0, 0.95)
            pattern.add_color_stop_rgba(0.3, 1.0, 0.0, 0.0, 0.0)
            pattern.add_color_stop_rgba(0.7, 1.0, 0.0, 0.0, 0.95)
            pattern.add_color_stop_rgba(1.0, 1.0, 0.0, 0.0, 0.0)
            cr.set_source(pattern)
            cr.fill()
            del pattern

        del cr

        self.add(self.circle)

        # glowing timeline
        self.timeline = clutter.Timeline(duration=settings.ARROW_BLINK_RATE)
        self.timeline.set_loop(True)
        self.alpha = clutter.Alpha(self.timeline, clutter.LINEAR)
        self.blink = clutter.BehaviourOpacity(alpha=self.alpha,
                                              opacity_start=BLINK_OFF_OPACITY,
                                              opacity_end=255)
        self.timeline.connect('completed', self.on_blink_completed)

        # By default we enable blinking for arrow.
        self.blink_on()
Пример #25
0
    def __init__(self, fullscreen=True):
        self.fullscreen = fullscreen
        self.transition = 'FADE'

        self.stage = clutter.Stage()
        if self.fullscreen == True:
            self.stage.set_fullscreen(True)
        else:
            self.stage.set_size(1200, 800)

        size = self.stage.get_size()
        print "%r" % (size,)

        display_width = size[0]*0.7
        display_height = size[1]*0.7

        self.stage.set_color(clutter.Color(0,0,0))
        if self.fullscreen == True:
            self.stage.connect('button-press-event', lambda x,y: reactor.stop())
        self.stage.connect('destroy', lambda x: reactor.stop())
        #self.stage.connect('key-press-event', self.process_key)

        self.texture_group = clutter.Group()
        self.stage.add(self.texture_group)

        self.texture_1 = clutter.Texture()
        self.texture_1.set_opacity(0)
        self.texture_1.set_keep_aspect_ratio(True)
        self.texture_1.set_size(display_width,display_height)
        self.texture_1.haz_image = False

        self.texture_2 = clutter.Texture()
        self.texture_2.set_opacity(0)
        self.texture_2.set_keep_aspect_ratio(True)
        self.texture_2.set_size(display_width,display_height)
        self.texture_2.haz_image = False

        self.texture_1.reflection = TextureReflection(self.texture_1)
        self.texture_1.reflection.set_reflection_height(display_height/3)
        self.texture_1.reflection.set_opacity(100)

        self.texture_2.reflection = TextureReflection(self.texture_2)
        self.texture_2.reflection.set_reflection_height(display_height/3)
        self.texture_2.reflection.set_opacity(0)

        x_pos = float((self.stage.get_width() - self.texture_1.get_width()) / 2)

        self.texture_group.add(self.texture_1, self.texture_1.reflection)
        self.texture_group.add(self.texture_2, self.texture_2.reflection)
        self.texture_group.set_position(x_pos, 20.0)
        self.texture_1.reflection.set_position(0.0, (self.texture_1.get_height() + 20))
        self.texture_2.reflection.set_position(0.0, (self.texture_2.get_height() + 20))

        def timeline_out_1_comleted(x):
            self.info("timeline_out_1_comleted")

        def timeline_out_2_comleted(x):
            self.info("timeline_out_2_comleted")

        def timeline_in_1_comleted(x):
            self.info("timeline_in_1_comleted")

        def timeline_in_2_comleted(x):
            self.info("timeline_in_2_comleted")

        self.texture_1.transition_fade_out_timeline = clutter.Timeline(2000)
        self.texture_1.transition_fade_out_timeline.connect('completed',timeline_out_1_comleted)
        alpha=clutter.Alpha(self.texture_1.transition_fade_out_timeline, clutter.EASE_OUT_SINE)
        self.fade_out_texture_behaviour_1 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=255, opacity_end=0)
        self.fade_out_texture_behaviour_1.apply(self.texture_1)
        self.fade_out_reflection_behaviour_1 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=100, opacity_end=0)
        self.fade_out_reflection_behaviour_1.apply(self.texture_1.reflection)
        self.texture_1.transition_fade_out_timeline.add_marker_at_time('out_nearly_finished', 500)

        self.texture_1.transition_fade_in_timeline = clutter.Timeline(2000)
        self.texture_1.transition_fade_in_timeline.connect('completed',timeline_in_1_comleted)
        alpha=clutter.Alpha(self.texture_1.transition_fade_in_timeline, clutter.EASE_OUT_SINE)
        self.fade_in_texture_behaviour_1 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=255)
        self.fade_in_texture_behaviour_1.apply(self.texture_1)
        self.fade_in_reflection_behaviour_1 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=100)
        self.fade_in_reflection_behaviour_1.apply(self.texture_1.reflection)

        self.texture_2.transition_fade_out_timeline = clutter.Timeline(2000)
        self.texture_2.transition_fade_out_timeline.connect('completed',timeline_out_2_comleted)
        alpha=clutter.Alpha(self.texture_2.transition_fade_out_timeline, clutter.EASE_OUT_SINE)
        self.fade_out_texture_behaviour_2 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=255, opacity_end=0)
        self.fade_out_texture_behaviour_2.apply(self.texture_2)
        self.fade_out_reflection_behaviour_2 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=100, opacity_end=0)
        self.fade_out_reflection_behaviour_2.apply(self.texture_2.reflection)
        self.texture_2.transition_fade_out_timeline.add_marker_at_time('out_nearly_finished', 500)

        self.texture_2.transition_fade_in_timeline = clutter.Timeline(2000)
        self.texture_2.transition_fade_in_timeline.connect('completed',timeline_in_2_comleted)
        alpha=clutter.Alpha(self.texture_2.transition_fade_in_timeline, clutter.EASE_OUT_SINE)
        self.fade_in_texture_behaviour_2 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=255)
        self.fade_in_texture_behaviour_2.apply(self.texture_2)
        self.fade_in_reflection_behaviour_2 = clutter.BehaviourOpacity(alpha=alpha, opacity_start=0, opacity_end=100)
        self.fade_in_reflection_behaviour_2.apply(self.texture_2.reflection)

        self.texture_1.fading_score = clutter.Score()
        self.texture_1.fading_score.append(timeline=self.texture_2.transition_fade_out_timeline)
        self.texture_1.fading_score.append_at_marker(timeline=self.texture_1.transition_fade_in_timeline,parent=self.texture_2.transition_fade_out_timeline,marker_name='out_nearly_finished')
        def score_1_started(x):
            self.info("score_1_started")
        def score_1_completed(x):
            self.info("score_1_completed")
        self.texture_1.fading_score.connect('started', score_1_started)
        self.texture_1.fading_score.connect('completed', score_1_completed)

        self.texture_2.fading_score = clutter.Score()
        self.texture_2.fading_score.append(timeline=self.texture_1.transition_fade_out_timeline)
        self.texture_2.fading_score.append_at_marker(timeline=self.texture_2.transition_fade_in_timeline,parent=self.texture_1.transition_fade_out_timeline,marker_name='out_nearly_finished')
        def score_2_started(x):
            self.info("score_2_started")
        def score_2_completed(x):
            self.info("score_2_completed")
        self.texture_2.fading_score.connect('started', score_2_started)
        self.texture_2.fading_score.connect('completed', score_2_completed)

        self.in_texture = self.texture_1
        self.out_texture = self.texture_2
        self.stage.show()