Exemple #1
0
  def on_button_press(self, item, target, event):
    canvas = self.get_canvas()

    if canvas.override:
      # if we're in the process of drawing a line, just 
      # propogate the signal.  first fix the coordinates
      canvas = self.get_canvas()
      event.x, event.y = canvas.convert_from_item_space(self, 
                                                        event.x, event.y)
      return False

    canvas.grab_focus(item)
    logging.debug("**before grab")
    canvas.grab_highlight(self)
    logging.debug("**after grab")

    if event.button is 1:
      self.drag_x = event.x
      self.drag_y = event.y

      fleur = gtk.gdk.Cursor(gtk.gdk.FLEUR)
      canvas = item.get_canvas()
      canvas.pointer_grab(item,
                          gtk.gdk.POINTER_MOTION_MASK 
                           | gtk.gdk.BUTTON_RELEASE_MASK,
                          fleur, event.time)
      self.dragging = True
    elif event.button is 3:
      edit_equation(self.var)
      canvas.drop_highlight()
    else:
      print "unsupported button: %d" % event.button

    return True
Exemple #2
0
  def on_button_press(self, item, target, event):
    canvas = self.get_canvas()

    if canvas.override:
      # if we're in the process of drawing a line, just 
      # propogate the signal.
      return False

    canvas.grab_focus(item)
    logging.debug("**before grab")
    canvas.grab_highlight(self)
    logging.debug("**after grab")

    if event.button is 1:
      pass
    elif event.button is 3:
      edit_equation(self.var)
      canvas.drop_highlight()
    else:
      print "unsupported button: %d" % event.button
    return True