Ejemplo n.º 1
0
 def glue(self, item, handle, vpos):
     """
     Perform a small glue action to ensure the handle is at a
     proper location for connecting.
     """
     if self.motion_handle:
         return self.motion_handle.glue(vpos)
     else:
         return HandleInMotion(item, handle, self.view).glue(vpos)
Ejemplo n.º 2
0
    def on_motion_notify(self, event):
        """
        Handle motion events. If a handle is grabbed: drag it around,
        else, if the pointer is over a handle, make the owning item the
        hovered-item.
        """
        view = self.view
        if self.grabbed_handle and event.state & gtk.gdk.BUTTON_PRESS_MASK:
            canvas = view.canvas
            item = self.grabbed_item
            handle = self.grabbed_handle
            pos = event.x, event.y

            if not self.motion_handle:
                self.motion_handle = HandleInMotion(item, handle, self.view)
                self.motion_handle.start_move(pos)
            self.motion_handle.move(pos)

            return True