예제 #1
0
def favorite_animation(window):

    # Add install animation.
    (screen, px, py, modifier_type) = window.get_display().get_pointer()
    ax, ay = px, py

    (wx, wy) = window.window.get_origin()
    offset_bx = 480
    offset_by = 5
    bx, by = wx + offset_bx, wy + offset_by

    offset_cx = 10
    offset_cy = 10
    if ax < bx:
        cx, cy = wx + offset_bx + offset_cx, wy + offset_by + offset_cy
    else:
        cx, cy = wx + offset_bx - offset_cx, wy + offset_by + offset_cy

    [[a], [b], [c]] = solve_parabola((ax, ay), (bx, by), (cx, cy))

    icon_window = IconWindow(utils.get_common_image('heart/heartx2.png'))
    icon_window.move(ax, ay)
    icon_window.show_all()

    timeline = Timeline(500, CURVE_SINE)
    timeline.connect(
        "update",
        lambda source, status: update(source, status, icon_window, (ax, ay),
                                      (bx, by), (cx, cy), (a, b, c)))
    timeline.connect("completed", lambda source: finish(source, icon_window))
    timeline.run()
예제 #2
0
 def start_animation(self, widget):    
     if not self.in_animation:
         self.in_animation = False
         try:
             self.timeline.stop()
         except:    
             pass
         self.timeline = Timeline(self.animation_time, CURVE_SINE)
         self.timeline.connect("update", self.update_animation)
         self.timeline.connect("completed", lambda source: self.completed_animation(source, widget))
         self.timeline.run()
예제 #3
0
 def start_animation(self, x, y):    
     if not self.in_animation:
         self.in_animation = False
         try:
             self.timeline.stop()
         except:    
             pass
         
         self.timeline = Timeline(self.animation_time, CURVE_SINE)
         self.timeline.connect("stop", self.stop_animation)
         self.timeline.connect("update", self.update_animation, x, y)
         self.timeline.connect("completed", self.completed_animation, x, y)
         self.timeline.run()
예제 #4
0
 def start_animation(self, target_pixbuf, is_default=False):
     self.is_default = False
     self.target_pixbuf = target_pixbuf
     if not self.in_animation:
         self.in_animation = False
         try:
             self.timeline.stop()
         except:
             pass
         self.timeline = Timeline(self.animation_time, CURVE_SINE)
         self.timeline.connect("update", self.update_animation)
         self.timeline.connect(
             "completed", lambda source: self.completed_animation(
                 source, target_pixbuf, is_default))
         self.timeline.run()
예제 #5
0
    def start_animation(self, animiation_time, target_index=None):
        if target_index == None:
            if self.active_index >= self.slide_number - 1:
                target_index = 0
            else:
                target_index = self.active_index + 1

        if not self.in_animiation:
            self.in_animiation = True
            self.target_index = target_index
            timeline = Timeline(animiation_time, CURVE_SINE)
            timeline.connect("update", self.update_animation)
            timeline.connect(
                "completed",
                lambda source: self.completed_animation(source, target_index))
            timeline.run()
        return True
예제 #6
0
    def start_animation(self, index, tab_start_x):
        if not self.in_animiation:
            self.in_animiation = True

            source_tab_x = tab_start_x + self.tab_index * self.tab_width
            target_tab_x = tab_start_x + index * self.tab_width

            timeline = Timeline(self.tab_animation_time, CURVE_SINE)
            timeline.connect(
                'update', lambda source, status: self.update_animation(
                    source, status, source_tab_x,
                    (target_tab_x - source_tab_x)))
            timeline.connect(
                "completed",
                lambda source: self.completed_animation(source, index))
            timeline.run()

            self.emit("tab_switch_start", self.items[index])
예제 #7
0
    def start_animation(self, animation_time, index=None):
        # Update ticker with active index if option index is None.
        if index == None:
            if self.active_index >= self.image_number - 1:
                index = 0
            else:
                index = self.active_index + 1

        if not self.in_animiation:
            self.in_animiation = True
            self.target_index = index

            timeline = Timeline(animation_time, CURVE_SINE)
            timeline.connect('update', self.update_animation)
            timeline.connect(
                "completed",
                lambda source: self.completed_animation(source, index))
            timeline.run()

        return True