Ejemplo n.º 1
0
    def onleftdown(self, e):
        rem_ico_size = self.rem_ico.Size

        rect = Rect(self.Size.width - rem_ico_size.width - 4,
                    self.Size.height // 2 - rem_ico_size.height // 2,
                    *rem_ico_size)

        if rect.Contains(e.Position):
            self.mouse_flag = True
        else:
            e.Skip()
Ejemplo n.º 2
0
    def leftup(self, e):

        rem_ico_size = self.rem_ico.Size

        rect = Rect(self.Size.width - rem_ico_size.width - 4,
                    self.Size.height // 2 - rem_ico_size.height // 2,
                    *rem_ico_size)

        if rect.Contains(e.Position):
            if self.mouse_flag:
                remove_row = getattr(self.Parent, 'remove_row', None)
                if remove_row is not None:
                    remove_row(self.data)
                else:
                    p = self.Parent.Parent.Parent
                    wx.CallAfter(p.remove_item, self.data)
        else:
            e.Skip()
        self.mouse_flag = False
    def __is_correct_element(self, element, area, location_offset):
        bad_element_tags = ['option', 'script']

        if area:
            if type(area) not in (tuple, list) or len(area) != 4:
                raise Exception(u"Bad area data '%s'" % str(area))
            area = Rect(*area)
            x, y = self.browser.get_location(element)
            if location_offset:
                # fixing location because it is located inside frame
                x += location_offset[0]
                y += location_offset[1]
            w, h = self.browser.get_dimensions(element)
            element_center = Point(x + w / 2, y + h / 2)
            is_element_inside = area.Contains(element_center)
        else:
            is_element_inside = True

        return (self.browser.is_visible(element)
                and not element.tag_name in bad_element_tags
                and is_element_inside)