[sugar] more clipboard questions

Tomeu Vizoso tomeu
Sun Jul 29 05:05:16 EDT 2007

Hi Erik,

seems that you are doing things correctly.

What is happening here is that sugar's clipboard lacks support for
text/uri-list targets when they come through owner-change (ctrl-c), it
only had support for text/uri-list in dnd.

Adding that support is very simple, as you can see in the patch

I would ask you to apply this patch in your xo, test there and report
the results. Then I think we can get this for trial2.

I have added the ticket https://dev.laptop.org/ticket/2570 for tracking
this. Can you give feedback on the ticket after you have tested it?



On Sat, 2007-07-28 at 23:16 -0400, Erik Blankinship wrote:
> I have a problem knowing when I can remove a file in /tmp after it has
> been placed on the clipboard successfully.
> Responding to a key-press-event callback, I call the following:
> gtk.Clipboard().set_with_data( [('text/uri-list', 0, 0)],
> self._clipboardGetFuncCb, self._clipboardClearFuncCb, tempImgPath )
> which, in turn, calls back:
> def _clipboardGetFuncCb( self, clipboard, selection_data, info,
> tempImgPath):
>      tempImgUri = "file://" + tempImgPath
>      selection_data.set( "text/uri-list", 8, tempImgUri )
> def _clipboardClearFuncCb( self, clipboard, tempImgPath):
>      if (tempImgPath != None):
>           if (os.path.exists(tempImgPath)):
>                os.remove( tempImgPath )
> _clipboardGetFuncCb is called before _clipboardClearFuncCb, but the
> second callback prevents any data from being placed on the clipboard
> (an image icon appears, but it has no data).  If the second callback
> doesn't delete the file, the copy works!  It would seem I need a
> callback to know when the clipboard has completed copying the data
> from /tmp before deleting the file from /tmp. 
> Looking into the clipboardservice.py code, it seems that a
> "_handle_file_completed" call can fire a "file-completed"... but I am
> not sure of the right way for an activity to plug into that logic.
> Suggestions? 
> Thanks.
> Erik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-2570-Accept-correctly-image-drops-from-Record.patch
Type: application/mbox
Size: 0 bytes
Desc: not available
Url : http://lists.laptop.org/pipermail/sugar/attachments/20070729/d00a6b13/attachment.bin 

More information about the Sugar-devel mailing list