Hi,

On 10/10/07, Seltzer <[EMAIL PROTECTED]> wrote:
> i was wondering how you accomplished "Prevents moving a row into another
> row".
> was it a settings thing? or a check if it happed and stop it?

You have to connect an handler to the drag-motion signal. Then you
have to change the accepted targets to something invalid when the drop
position is not something you want to accept, or to your normal
targets when it's a correct position.

So your handler would look like this:

def onDragMotion(self, tree, context, x, y, time):
  drop = self.get_dest_row_at_pos(int(x), int(y))

  if drop is not None and (drop[1] == gtk.TREE_VIEW_DROP_INTO_OR_AFTER
or drop[1] == gtk.TREE_VIEW_DROP_INTO_OR_BEFORE):
    self.enable_model_drag_dest([('invalid-position', 0, -1)],
gdk.ACTION_DEFAULT)
  else:
    self.enable_model_drag_dest(self.dndTargets, gdk.ACTION_DEFAULT)

This assumes that self.dndTargets contain a list of your standard targets.
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to