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
_______________________________________________ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar