def on_button_press_event(self, widget, event):
        if is_in_rect((event.x, event.y),
                      (self.close_rect.x, self.close_rect.y,
                       self.close_rect.width, self.close_rect.height)):
            gobject.source_remove(self.timeout_id)
            self.destroy()
            event_manager.emit("manual-cancelled", self)
            return

        for index, rect in enumerate(self.pointer_hand_rectangles):
            if is_in_rect((event.x, event.y), rect):
                action = self.notification["hints"]["x-deepin-hyperlinks"][index]
                if action.has_key("href"):
                    webbrowser.open_new_tab(action.get("href"))
                return

        for index, rect in enumerate(self.action_button_areas):
            if is_in_rect((event.x, event.y), rect):
                for i, action_key in enumerate(self.action_dict):
                    if i == index:
                        event_manager.emit("action-invoked", (self.notification.id, action_key))
                        gobject.source_remove(self.timeout_id)
                        self.destroy()
                        event_manager.emit("manual-cancelled", self)
                        return

        rect = widget.allocation
        if is_in_rect((event.x, event.y),
                      (rect.x, rect.y, APP_ICON_WIDTH, self.window_height)):
            self.open_source_software()
Esempio n. 2
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)
    def on_motion_notify_event(self, widget, event):
        for rect in self.pointer_hand_rectangles:
            if is_in_rect((event.x, event.y), rect):
                widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
                return
            else:
                widget.window.set_cursor(None)

        for rect in self.action_button_areas:
            if is_in_rect((event.x, event.y), rect):
                widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
                return
            else:
                widget.window.set_cursor(None)
Esempio n. 4
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)
            widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.display_get_default(), get_common_image_pixbuf('cursor/left_arrow.png'), 0, 0))
            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)
            widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.display_get_default(), get_common_image_pixbuf('cursor/right_arrow.png'), 0, 0))
            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)
Esempio n. 5
0
    def is_in_button_area(self, column, offset_x, offset_y):

        pixbuf = app_theme.get_pixbuf("button/start_normal.png").get_pixbuf()
        return (self.install_status and column == 2 and is_in_rect(
            (offset_x, offset_y),
            (self.BUTTON_PADDING_X, (self.height - pixbuf.get_height()) / 2,
             pixbuf.get_width(), pixbuf.get_height())))
 def is_in_name_area(self, x, y):
     (name_width, name_height) = get_content_size(self.alias_name, DEFAULT_FONT_SIZE)
     return is_in_rect((x, y),
                       (0,
                        self.icon_padding_y + self.icon_pixbuf.get_height() + self.name_padding_y,
                        name_width,
                        name_height))
Esempio n. 7
0
 def on_motion_notify(self, widget, event):
     if self.text_rect is not None:
         if dutils.is_in_rect((event.x, event.y), self.text_rect):
             self.is_hover = True
         else:
             self.is_hover = False
         self.queue_draw()
 def is_in_button_area(self, x, y):
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT,
                        self.DRAW_PADDING_Y + self.DRAW_ICON_SIZE + self.DRAW_BUTTON_PADDING_Y,
                        self.BUTTON_WIDTH,
                        self.BUTTON_HEIGHT,
                        ))
Esempio n. 9
0
 def is_stop_button_can_click(self, column, offset_x, offset_y):
     pixbuf = app_theme.get_pixbuf("button/stop.png").get_pixbuf()
     return (column == 1 and is_in_rect(
         (offset_x, offset_y), (self.get_column_widths()[column] -
                                ITEM_CANCEL_BUTTON_PADDING_RIGHT,
                                (ITEM_HEIGHT - pixbuf.get_height()) / 2,
                                pixbuf.get_width(), pixbuf.get_height())))
 def is_in_star_area(self, column, offset_x, offset_y):
     return (column == 1 
             and is_in_rect((offset_x, offset_y), 
                            (0,
                             (ITEM_HEIGHT - STAR_SIZE) / 2,
                             ITEM_STAR_AREA_WIDTH,
                             STAR_SIZE)))
Esempio n. 11
0
 def is_in_star_area(self, column, offset_x, offset_y):
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (0,
                             (ITEM_HEIGHT - STAR_SIZE) / 2,
                             ITEM_STAR_AREA_WIDTH,
                             STAR_SIZE)))
 def is_in_star_area(self, x, y):
     return is_in_rect((x, y),
                       ((self.width - STAR_SIZE * 5) / 2,
                        self.icon_padding_y + self.icon_pixbuf.get_height() + self.name_padding_y + DEFAULT_FONT_SIZE + self.star_padding_y,
                        STAR_SIZE * 5,
                        STAR_SIZE
                        ))
Esempio n. 13
0
 def is_in_picture_area(self, column, offset_x, offset_y):
     return (column == 0
             and is_in_rect((offset_x, offset_y),
                            (self.PICTURE_PADDING_X,
                             self.PICTURE_PADDING_Y,
                             self.pixbuf.get_width(),
                             self.pixbuf.get_height())))
 def is_in_name_area(self, x, y):
     (text_width, text_height) = get_content_size(self.alias_name, text_size=NAME_SIZE)
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT + self.pkg_icon_width + self.DRAW_INFO_PADDING_X,
                        self.DRAW_PADDING_Y,
                        text_width,
                        NAME_SIZE))
Esempio n. 15
0
    def is_in_icon_area(self, x, y):
        if self.pkg_picture_pixbuf == None:
            self.pkg_picture_pixbuf = get_common_image_pixbuf('recommend/default_cache.png')

        padding_x = (self.get_width() - self.pkg_picture_pixbuf.get_width()) / 2
        padding_y = (self.get_height() - self.pkg_picture_pixbuf.get_height()) / 2
        return is_in_rect((x, y), (padding_x, padding_y, self.pkg_picture_pixbuf.get_width(), self.pkg_picture_pixbuf.get_height()))
 def is_in_star_area(self, x, y):
     x1 = (self.width - STAR_SIZE * 5) / 2
     y1 = self.icon_padding_y + self.icon_pixbuf.get_height(
     ) + self.name_padding_y + DEFAULT_FONT_SIZE + self.star_padding_y
     w = STAR_SIZE * 5
     h = STAR_SIZE
     return is_in_rect((x, y), (x1, y1, w, h))
 def on_motion_notify(self, widget, event):
     if self.text_rect is not None:
         if dutils.is_in_rect((event.x, event.y), self.text_rect):
             self.is_hover = True
         else:    
             self.is_hover = False
         self.queue_draw()  
 def is_in_star_area(self, x, y):
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT + self.pkg_icon_width + self.DRAW_INFO_PADDING_X,
                        self.DRAW_STAR_PADDING_Y,
                        STAR_SIZE * 5,
                        STAR_SIZE
                        ))
Esempio n. 19
0
 def is_in_name_area(self, column, offset_x, offset_y):
     (name_width, name_height) = get_content_size(self.alias_name,
                                                  NAME_SIZE)
     return (column == 0 and is_in_rect(
         (offset_x, offset_y),
         (ITEM_PADDING_X + ITEM_PKG_OFFSET_X + ICON_SIZE +
          ITEM_PADDING_MIDDLE, ITEM_PADDING_Y, name_width, NAME_SIZE)))
Esempio n. 20
0
 def is_in_button_area(self, column, offset_x, offset_y):
     return (column == 2
             and is_in_rect((offset_x, offset_y),
                            (self.get_column_widths()[column] - self.ITEM_BUTTON_PADDING_RIGHT - self.button_width,
                             (self.ITEM_HEIGHT - self.button_height) / 2,
                             self.button_width,
                             self.button_height)))
 def is_in_button_area(self, column, offset_x, offset_y):
     return (column == 1
             and is_in_rect((offset_x, offset_y), 
                            (self.get_column_widths()[column] - ITEM_BUTTON_PADDING_RIGHT - self.button_width,
                             (ITEM_HEIGHT - self.button_height) / 2,
                             self.button_width,
                             self.button_height)))
Esempio n. 22
0
 def is_in_name_area(self, x, y):
     (text_width, text_height) = get_content_size(self.alias_name,
                                                  text_size=NAME_SIZE)
     return is_in_rect(
         (x, y), (self.DRAW_PADDING_LEFT + self.pkg_icon_width +
                  self.DRAW_INFO_PADDING_X, self.DRAW_PADDING_Y, text_width,
                  NAME_SIZE))
Esempio n. 23
0
 def is_in_icon_area(self, column, offset_x, offset_y):
     return (column == 0
             and is_in_rect((offset_x, offset_y),
                            (ITEM_PADDING_X,
                             ITEM_PADDING_Y,
                             self.icon_pixbuf.get_width(),
                             self.icon_pixbuf.get_height()
                             )))
 def is_in_expand_button_area(self, column, offset_x, offset_y):
     pixbuf = app_theme.get_pixbuf("sidebar/close.png").get_pixbuf()
     
     return is_in_rect((offset_x, offset_y),
                       (CATEGORY_VIEW_WIDTH - CATEGORY_ITEM_EXPAND_PADDING_X,
                        (self.get_height() - pixbuf.get_height()) / 2,
                        pixbuf.get_width(),
                        pixbuf.get_height()))
Esempio n. 25
0
 def is_in_name_area(self, column, offset_x, offset_y):
     (name_with, name_height) = get_content_size(self.pkg_title, self.TITLE_SIZE)
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (0,
                             self.PICTURE_PADDING_Y,
                             name_with,
                             name_height)))
 def is_cancel_button_area(self, column, offset_x, offset_y):
     cancel_pixbuf = app_theme.get_pixbuf("button/uninstall_cancel.png").get_pixbuf()
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (self.get_column_widths()[column] - ITEM_CANCEL_BUTTON_PADDING_RIGHT,
                             (ITEM_HEIGHT - cancel_pixbuf.get_height()) / 2,
                             cancel_pixbuf.get_width(),
                             cancel_pixbuf.get_height())))
 def is_in_name_area(self, column, offset_x, offset_y):
     (name_width, name_height) = get_content_size(self.alias_name, NAME_SIZE)
     return (column == 0
             and is_in_rect((offset_x, offset_y),
                            (ITEM_PADDING_X + ITEM_PKG_OFFSET_X + ICON_SIZE + ITEM_PADDING_MIDDLE,
                             ITEM_PADDING_Y,
                             name_width,
                             NAME_SIZE)))
Esempio n. 28
0
 def is_stop_button_can_click(self, column, offset_x, offset_y):
     pixbuf = app_theme.get_pixbuf("button/stop.png").get_pixbuf()
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (self.get_column_widths()[column] - ITEM_CANCEL_BUTTON_PADDING_RIGHT,
                             (ITEM_HEIGHT - pixbuf.get_height()) / 2,
                             pixbuf.get_width(),
                             pixbuf.get_height())))
 def is_in_icon_area(self, x, y):
     self.init_pkg_icon_pixbuf()
         
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT,
                        self.DRAW_PADDING_Y,
                        self.pkg_icon_width,
                        self.pkg_icon_height))
Esempio n. 30
0
 def is_in_button_area(self, x, y):
     return is_in_rect((x, y), (
         self.DRAW_PADDING_LEFT,
         self.DRAW_PADDING_Y + self.DRAW_ICON_SIZE +
         self.DRAW_BUTTON_PADDING_Y,
         self.BUTTON_WIDTH,
         self.BUTTON_HEIGHT,
     ))
 def is_in_icon_area(self, column, offset_x, offset_y):
     return (column == 0
             and is_in_rect((offset_x, offset_y),
                            (ITEM_PADDING_X,
                             ITEM_PADDING_Y,
                             self.icon_pixbuf.get_width(),
                             self.icon_pixbuf.get_height()
                             )))
Esempio n. 32
0
    def is_in_expand_button_area(self, column, offset_x, offset_y):
        pixbuf = app_theme.get_pixbuf("sidebar/close.png").get_pixbuf()

        return is_in_rect(
            (offset_x, offset_y),
            (CATEGORY_VIEW_WIDTH - CATEGORY_ITEM_EXPAND_PADDING_X,
             (self.get_height() - pixbuf.get_height()) / 2, pixbuf.get_width(),
             pixbuf.get_height()))
Esempio n. 33
0
 def is_in_button_area(self, column, offset_x, offset_y):
     pixbuf = app_theme.get_pixbuf("button/start_normal.png").get_pixbuf()
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (self.get_column_widths()[column] - ITEM_BUTTON_PADDING_RIGHT - pixbuf.get_width(),
                             (ITEM_HEIGHT - pixbuf.get_height()) / 2,
                             pixbuf.get_width(),
                             pixbuf.get_height()
                             )))
Esempio n. 34
0
 def is_cancel_button_area(self, column, offset_x, offset_y):
     cancel_pixbuf = app_theme.get_pixbuf(
         "button/uninstall_cancel.png").get_pixbuf()
     return (column == 1 and is_in_rect(
         (offset_x, offset_y),
         (self.get_column_widths()[column] -
          ITEM_CANCEL_BUTTON_PADDING_RIGHT,
          (ITEM_HEIGHT - cancel_pixbuf.get_height()) / 2,
          cancel_pixbuf.get_width(), cancel_pixbuf.get_height())))
 def is_in_icon_area(self, x, y):
     if self.pkg_icon_pixbuf == None:
         self.pkg_icon_pixbuf = gtk.gdk.pixbuf_new_from_file(get_icon_pixbuf_path(self.pkg_name))        
         
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT,
                        self.DRAW_PADDING_Y,
                        self.pkg_icon_pixbuf.get_width(),
                        self.pkg_icon_pixbuf.get_height()))
Esempio n. 36
0
    def on_button_press(self, widget, event):
        ex, ey =  event.x_root, event.y_root

        win = widget.get_toplevel()
        x, y = win.get_position()
        tmp_x, tmp_y, w, h = win.allocation

        if not is_in_rect((ex, ey), (x, y, w, h)):
            self.dismiss()
 def is_in_button_area(self, column, offset_x, offset_y):
     pixbuf = app_theme.get_pixbuf("button/start_normal.png").get_pixbuf()
     return (column == 1
             and is_in_rect((offset_x, offset_y),
                            (self.get_column_widths()[column] - ITEM_BUTTON_PADDING_RIGHT - pixbuf.get_width(),
                             (ITEM_HEIGHT - pixbuf.get_height()) / 2,
                             pixbuf.get_width(),
                             pixbuf.get_height()
                             )))
 def is_in_button_area(self, x, y):
     if self.is_installed != None:
         pixbuf = app_theme.get_pixbuf("button/start_small_normal.png").get_pixbuf()
         return is_in_rect((x, y),
                         (self.BUTTON_PADDING_X,
                         self.height - self.BUTTON_PADDING_BOTTOM - pixbuf.get_height(),
                         pixbuf.get_width(),
                         pixbuf.get_height()))
     else:
         return False
 def is_in_button_area(self, x, y):
     if self.install_status == "uninstalled" or self.desktops:
         pixbuf = app_theme.get_pixbuf("button/start_small_normal.png").get_pixbuf()
         x1 = self.BUTTON_PADDING_X
         y1 = self.height - self.BUTTON_PADDING_BOTTOM - pixbuf.get_height()
         w = pixbuf.get_width()
         h = pixbuf.get_height()
         return is_in_rect((x, y), (x1, y1, w, h))
     else:
         return False
Esempio n. 40
0
    def is_in_button_area(self, column, offset_x, offset_y):

        pixbuf = app_theme.get_pixbuf("button/start_normal.png").get_pixbuf()
        return (self.install_status and column == 2
                and is_in_rect((offset_x, offset_y),
                               (self.BUTTON_PADDING_X,
                                (self.height - pixbuf.get_height()) / 2,
                                pixbuf.get_width(),
                                pixbuf.get_height()
                                )))
Esempio n. 41
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)
Esempio n. 42
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)
 def is_in_button_area(self, x, y):
     if self.install_status == "uninstalled" or self.desktops:
         pixbuf = app_theme.get_pixbuf(
             "button/start_small_normal.png").get_pixbuf()
         x1 = self.BUTTON_PADDING_X
         y1 = self.height - self.BUTTON_PADDING_BOTTOM - pixbuf.get_height()
         w = pixbuf.get_width()
         h = pixbuf.get_height()
         return is_in_rect((x, y), (x1, y1, w, h))
     else:
         return False
Esempio n. 44
0
    def is_in_button_area(self, x, y):
        '''
        Helper function to detect button event is in button area.

        You can add this function in callback function of TreeItem, such as:
         - hover/unhover
         - motion_notify
         - button_press/button_release
         - single_click/double_click

        @param x: X coordinate of button event.
        @param y: Y coordiante of button event.
        '''
        return is_in_rect((x, y), (self.render_padding_x, self.render_padding_y, self.render_width, self.render_height))
 def on_listview_button_pressed(self, widget, event, listview):
     x = event.x
     y = event.y
     
     if event.button == 1:
         for item in listview.get_items():
             for index, rect in enumerate(item.pointer_hand_rectangles):
                 if is_in_rect((x, y), rect):
                     action = item.message["hints"]["x-deepin-hyperlinks"][index]
                     
                     if action.has_key("href"):
                         webbrowser.open_new_tab(action.get("href"))
                         
                         return
Esempio n. 46
0
    def is_in_button_area(self, x, y):
        '''
        Helper function to detect button event is in button area.

        You can add this function in callback function of TreeItem, such as:
         - hover/unhover
         - motion_notify
         - button_press/button_release
         - single_click/double_click

        @param x: X coordinate of button event.
        @param y: Y coordiante of button event.
        '''
        return is_in_rect((x, y), (self.render_padding_x, self.render_padding_y, self.render_width, self.render_height))
 def on_listview_motion_notify(self, widget, event, listview):
     x = event.x
     y = event.y
     flag = False
     for item in listview.get_items():
         if flag:
             break
         for rect in item.pointer_hand_rectangles:
             if is_in_rect((x, y), rect):
                 flag = True
                 break
     if flag:
         widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND1))
     else:
         widget.window.set_cursor(None)
Esempio n. 48
0
    def icon_item_motion_notify(self, x, y):
        '''
        Handle `motion-notify-event` signal.
        
        This is IconView interface, you should implement it.
        '''
        if is_in_rect(
            (x, y),
            (self.hover_response_rect.x, self.hover_response_rect.y,
             self.hover_response_rect.width, self.hover_response_rect.height)):
            self.hover_flag = True
        else:
            self.hover_flag = False

        self.emit_redraw_request()
 def is_in_icon_area(self, x, y):
     x1 = self.ICON_PADDING_X
     y1 = self.ICON_PADDING_TOP
     w = self.icon_pixbuf.get_width()
     h = self.icon_pixbuf.get_height()
     return is_in_rect((x, y), (x1, y1, w, h))
Esempio n. 50
0
 def is_in_star_area(self, x, y):
     return is_in_rect((x, y),
                       (self.DRAW_PADDING_LEFT + self.pkg_icon_width +
                        self.DRAW_INFO_PADDING_X, self.DRAW_STAR_PADDING_Y,
                        STAR_SIZE * 5, STAR_SIZE))
 def is_in_name_area(self, x, y):
     x1 = 0
     y1 = self.icon_padding_y + self.icon_pixbuf.get_height(
     ) + self.name_padding_y
     (w, h) = get_content_size(self.alias_name, DEFAULT_FONT_SIZE)
     return is_in_rect((x, y), (x1, y1, w, h))
Esempio n. 52
0
    def is_in_icon_area(self, x, y):
        self.init_pkg_icon_pixbuf()

        return is_in_rect((x, y), (self.DRAW_PADDING_LEFT, self.DRAW_PADDING_Y,
                                   self.pkg_icon_width, self.pkg_icon_height))
Esempio n. 53
0
 def is_in_picture_area(self, column, offset_x, offset_y):
     return (column == 0 and is_in_rect(
         (offset_x, offset_y),
         (self.PICTURE_PADDING_X, self.PICTURE_PADDING_Y,
          self.pixbuf.get_width(), self.pixbuf.get_height())))
Esempio n. 54
0
 def is_in_name_area(self, column, offset_x, offset_y):
     (name_with, name_height) = get_content_size(self.pkg_title,
                                                 self.TITLE_SIZE)
     return (column == 1 and is_in_rect(
         (offset_x, offset_y),
         (0, self.PICTURE_PADDING_Y, name_with, name_height)))