Example #1
0
    def motion_notify(self, widget, event):
        """
        Internal callback for `motion-notify-event` signal.

        @param widget: A widget of gtk.Widget.
        @param event: The motion-notify-event of type gtk.gdk.Event
        """
        if self.enable_resize and self.shadow_is_visible:
            self.cursor_type = self.get_cursor_type(event)
            set_cursor(self.window_shadow, self.cursor_type)
Example #2
0
    def motion_notify(self, widget, event):
        '''
        Internal callback for `motion-notify-event` signal.

        @param widget: A widget of gtk.Widget.
        @param event: The motion-notify-event of type gtk.gdk.Event
        '''
        if self.enable_resize and self.shadow_is_visible:
            self.cursor_type = self.get_cursor_type(event)
            set_cursor(self.window_shadow, self.cursor_type)
Example #3
0
    def leave_notify_slide_switcher(self, widget, event):
        rect = widget.allocation
        if is_in_rect((event.x, event.y), (0, 0, rect.width, rect.height)):
            self.handle_animation(widget, event)
        else:
            self.start_auto_slide()

        set_cursor(widget, None)

        self.emit("leave-notify-index", self.active_index)
Example #4
0
 def motion_notify(self, widget, event):
     '''Callback for motion-notify event.'''
     if self.enable_resize and self.shadow_is_visible:
         cursor_type = self.get_cursor_type(event)
         if cursor_type != None:
             set_cursor(self, self.cursor_type)
         elif self.cursor_type != None:
             set_cursor(self, None)
             
         self.cursor_type = cursor_type
Example #5
0
    def leave_notify_slide_switcher(self, widget, event):
        rect = widget.allocation
        if is_in_rect((event.x, event.y), (0, 0, rect.width, rect.height)):
            self.handle_animation(widget, event)
        else:
            self.start_auto_slide()

        set_cursor(widget, None)

        self.emit("leave-notify-index", self.active_index)
Example #6
0
 def handle_animation(self, widget, event):    
     self.motion_index = None
     for index, rect in self.pointer_coords.items():
         if rect.x <= event.x <= rect.x + rect.width and rect.y <= event.y <= rect.y + rect.height:
             set_cursor(widget, gtk.gdk.HAND2)
             self.motion_index = index
             break    
     else:    
         self.motion_index = None
         set_cursor(widget, None)
Example #7
0
 def handle_animation(self, widget, event):
     self.motion_index = None
     for index, rect in self.pointer_coords.items():
         if rect.x <= event.x <= rect.x + rect.width and rect.y <= event.y <= rect.y + rect.height:
             set_cursor(widget, gtk.gdk.HAND2)
             self.motion_index = index
             break
     else:
         self.motion_index = None
         set_cursor(widget, None)
Example #8
0
    def motion_notify(self, widget, event):
        '''
        Internal callback for `motion-notify` signal. 

        @param widget: A widget of gtk.Widget.
        @param event: The motion-notify-event of type gtk.gdk.Event
        '''
        if self.enable_resize and self.shadow_is_visible:
            cursor_type = self.get_cursor_type(event)
            if cursor_type != None:
                set_cursor(self, self.cursor_type)
            elif self.cursor_type != None:
                set_cursor(self, None)
                
            self.cursor_type = cursor_type
Example #9
0
    def handle_animation(self, widget, event, button_press=False):
        # Init.
        rect = widget.allocation

        start_x = rect.width + self.pointer_offset_x - self.pointer_radious
        start_y = rect.height + self.pointer_offset_y
        self.left_retangle = (0, 0, rect.width / 3, rect.height - self.pointer_offset_y)
        self.right_retangle = (0 + 2 * rect.width / 3, 0, rect.width / 3, rect.height - self.pointer_offset_y)

        if self.image_number > 1 and (
            start_y - 4 * self.pointer_radious < event.y < start_y + self.pointer_radious * 6
            and start_x - 2 * self.pointer_radious
            < event.x
            < start_x + 4 * self.pointer_padding + 4 * self.pointer_radious
        ):

            set_cursor(widget, gtk.gdk.HAND2)

            if self.hover_switch or button_press:
                self.motion_index = None
                for index in range(0, self.image_number):
                    if start_x + index * self.pointer_padding < event.x < start_x + (index + 1) * self.pointer_padding:
                        self.motion_index = index
                        if self.active_index != index:
                            self.start_animation(self.hover_animation_time, index)
                        break
        elif self.image_number > 1 and is_in_rect((event.x, event.y), self.left_retangle) and self.navigate_switch:
            if not self.in_left_nav:
                self.in_left_nav = True
                self.queue_draw()
            set_cursor(widget, gtk.gdk.SB_LEFT_ARROW)
            if button_press:
                self.to_left_animation()
        elif self.image_number > 1 and is_in_rect((event.x, event.y), self.right_retangle) and self.navigate_switch:
            if not self.in_right_nav:
                self.in_right_nav = True
                self.queue_draw()
            set_cursor(widget, gtk.gdk.SB_RIGHT_ARROW)
            if button_press:
                self.to_right_animation()
        else:
            if self.in_left_nav or self.in_right_nav:
                self.in_left_nav = False
                self.in_right_nav = False
                self.queue_draw()
            set_cursor(widget, None)

            if button_press:
                self.emit("button-press-index", self.active_index)
            else:
                self.emit("motion-notify-index", self.active_index)
Example #10
0
    def handle_animation(self, widget, event, button_press=False):
        # Init.
        rect = widget.allocation

        start_x = rect.width + self.pointer_offset_x - self.pointer_radious
        start_y = rect.height + self.pointer_offset_y
        self.left_retangle = (0, 0, rect.width/3, rect.height - self.pointer_offset_y)
        self.right_retangle = (0 + 2*rect.width/3, 0, rect.width/3, rect.height - self.pointer_offset_y)

        if self.image_number > 1 and (start_y - 4 * self.pointer_radious < event.y < start_y + self.pointer_radious * 6
            and start_x - 2 * self.pointer_radious < event.x < start_x + 4 * self.pointer_padding + 4 * self.pointer_radious):

            set_cursor(widget, gtk.gdk.HAND2)

            if self.hover_switch or button_press:
                self.motion_index = None
                for index in range(0, self.image_number):
                    if start_x + index * self.pointer_padding < event.x < start_x + (index + 1) * self.pointer_padding:
                        self.motion_index = index
                        if self.active_index != index:
                            self.start_animation(self.hover_animation_time, index)
                        break
        elif self.image_number > 1 and is_in_rect((event.x, event.y), self.left_retangle) and self.navigate_switch:
            if not self.in_left_nav:
                self.in_left_nav = True
                self.queue_draw()
            set_cursor(widget, gtk.gdk.SB_LEFT_ARROW)
            if button_press:
                self.to_left_animation()
        elif self.image_number > 1 and is_in_rect((event.x, event.y), self.right_retangle) and self.navigate_switch:
            if not self.in_right_nav:
                self.in_right_nav = True
                self.queue_draw()
            set_cursor(widget, gtk.gdk.SB_RIGHT_ARROW)
            if button_press:
                self.to_right_animation()
        else:
            if self.in_left_nav or self.in_right_nav:
                self.in_left_nav = False
                self.in_right_nav = False
                self.queue_draw()
            set_cursor(widget, None)

            if button_press:
                self.emit("button-press-index", self.active_index)
            else:
                self.emit("motion-notify-index", self.active_index)
Example #11
0
    def __motion_notify(self, widget, event):
        if event.y < self.min_height:
            if event.y < self.min_height - 10:
                set_cursor(widget, None)
            else:
                set_cursor(widget, gtk.gdk.SB_V_DOUBLE_ARROW)
            return

        if self.resizable:
            set_cursor(widget, gtk.gdk.SB_V_DOUBLE_ARROW)
            self.height = event.y
        else:
            self.height = self.min_height

        if self.button_pressed:
            # redraw the widget
            self.queue_draw()
Example #12
0
    def __motion_notify(self, widget, event):
        if event.y < self.min_height:
            if event.y < self.min_height - 10:
                set_cursor(widget, None)
            else:
                set_cursor(widget, gtk.gdk.SB_V_DOUBLE_ARROW)
            return

        if self.resizable:
            set_cursor(widget, gtk.gdk.SB_V_DOUBLE_ARROW)
            self.height = event.y
        else:
            self.height = self.min_height

        if self.button_pressed:
            # redraw the widget
            self.queue_draw()
Example #13
0
 def motion_notify(self, widget, event):
     '''Callback for motion-notify event.'''
     if self.enable_resize and self.shadow_is_visible:
         self.cursor_type = self.get_cursor_type(event)
         set_cursor(self.window_shadow, self.cursor_type)
Example #14
0
 def leave_notify(self, widget, event):
     set_cursor(self, None)
Example #15
0
 def leave_notify(self, widget, event):
     set_cursor(self, None)
Example #16
0
 def on_leave_notify(self, widget, event):
     self.auto_animation()
     set_cursor(widget, None)
Example #17
0
 def on_leave_notify(self, widget, event):
     self.auto_animation()
     set_cursor(widget, None)