示例#1
0
 def __init__(self):
     """Initializes, and registers click and drag handlers.
     """
     CachedBgDrawingArea.__init__(self)
     self._manager = None
     self.connect("button-press-event", self.__button_press_cb)
     self.connect("motion-notify-event", self.__motion_notify_cb)
     self.connect("button-release-event", self.__button_release_cb)
     self.add_events(gdk.BUTTON_PRESS_MASK | gdk.BUTTON_RELEASE_MASK)
     self.add_events(gdk.BUTTON_MOTION_MASK)
     self.connect("realize", self.__realize_cb)
     if self.tooltip_text is not None:
         self.set_tooltip_text(self.tooltip_text)
示例#2
0
文件: adjbases.py 项目: j-fu/mypaint
 def __init__(self):
     """Initializes, and registers click and drag handlers.
     """
     CachedBgDrawingArea.__init__(self)
     self.__button_down = None
     self.__drag_start_pos = None
     self.__drag_start_color = None
     self.connect("button-press-event", self.__button_press_cb)
     self.connect("motion-notify-event", self.__motion_notify_cb)
     self.connect("button-release-event", self.__button_release_cb)
     self.add_events(gdk.BUTTON_PRESS_MASK | gdk.BUTTON_RELEASE_MASK)
     self.add_events(gdk.BUTTON_MOTION_MASK)
     self._init_color_drag()
     if self.STATIC_TOOLTIP_TEXT is not None:
         self.set_tooltip_text(self.STATIC_TOOLTIP_TEXT)
示例#3
0
    def __init__(self):
        """Initializes, and registers click and drag handlers.
        """
        CachedBgDrawingArea.__init__(self)
        self.__button_down = None
        self.__drag_start_pos = None
        self.__drag_start_color = None
        self.__initial_bg_validity = None
        self.connect("button-press-event", self.__button_press_cb)
        self.connect("motion-notify-event", self.__motion_notify_cb)
        self.connect("button-release-event", self.__button_release_cb)
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.BUTTON_MOTION_MASK)
        self._init_color_drag()
        if self.STATIC_TOOLTIP_TEXT is not None:
            self.set_tooltip_text(self.STATIC_TOOLTIP_TEXT)

        # Use twice the standard threshold because tablets always send
        # more tiny motions than mice.
        settings = Gtk.Settings.get_default()
        thres = min(4, int(settings.get_property("gtk-dnd-drag-threshold")))
        self._drag_threshold = 2 * thres