[Gazpacho] [Fwd: Re: [Gazpacho-commits] r1724 - in gazpacho/trunk: . gazpacho]

Mattias Karlsson enkidude at gmail.com
Mon Aug 29 23:55:15 CEST 2005


On 8/29/05, Johan Dahlin <johan at gnome.org> wrote:
> d'oh, wrong mail.
> 
> -------- Original Message --------
> Subject: Re: [Gazpacho-commits] r1724 - in gazpacho/trunk: . gazpacho
> Date: Mon, 29 Aug 2005 17:37:50 -0300
> From: Johan Dahlin <jdahlin at async.com.br>
> Organization: Async Open Source
> To: lgs at sicem.biz
> CC: gazpacho-commits at sicem.biz
> References: <20050829203243.9185F11F465 at linuxserver.sicem.biz>
> 
> > @@ -425,8 +423,24 @@
> >      def _dnd_drag_leave_cb(self, target_widget, drag_context, time):
> >          if self._dnd_drop_region:
> >              self._dnd_drop_region = None
> > +            target_widget.queue_draw()
> 
> Why does this (the redrawing) need to be done, maybe you can add a comment?

Otherwise the drop region isn't cleared when we're leaving the widget.
Is there a better way of doing it? Do you want a comment?

> >      def _dnd_drag_motion_cb(self, target_widget, drag_context, x, y, time):
> > +        # Check if it is a valid target type
> > +        targets = target_widget.drag_dest_get_target_list()
> > +        target = target_widget.drag_dest_find_target(drag_context, targets)
> > +        if target == "NONE":
> > +            return False
> 
> Where is "NONE" coming from? Is it a constant?

Good question. I thought drag_dest_find_target would return None, but
instead it returned the string "NONE".

> > +        # Not a valid drop zone if target == source
> > +        gtk_source = drag_context.get_source_widget()
> > +        if gtk_source:
> > +            gsource = Widget.from_widget(gtk_source)
> > +            gwidget = gsource.dnd_widget
> > +            if not gwidget or (gwidget == self):
> > +                return False
> 
> Do you need both checks? the parenthesis is not neccessary.

I'm not sure actually. The 'not gwidget' check was used in
_dnd_drag_data_received_cb and I just added the second check. The
parenthesis can of course be removed if you want.


More information about the Gazpacho mailing list