I have a problem knowing when I can remove a file in /tmp after it has been placed on the clipboard successfully.<br><br>Responding to a key-press-event callback, I call the following:<br><font size="2"><br></font><div style="margin-left: 40px;">
<font size="2"><span style="font-family: courier new,monospace;">gtk.Clipboard().set_with_data( [('text/uri-list', 0, 0)], self._clipboardGetFuncCb, self._clipboardClearFuncCb, tempImgPath )</span></font><br style="font-family: courier new,monospace;">
</div><br>which, in turn, calls back:<br><font size="2"><br></font><div style="margin-left: 40px;"><font size="2"><span style="font-family: courier new,monospace;">def _clipboardGetFuncCb( self, clipboard, selection_data, info, tempImgPath):
</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;"> tempImgUri = "file://" + tempImgPath</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> selection_data.set( "text/uri-list", 8, tempImgUri )</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">def _clipboardClearFuncCb( self, clipboard, tempImgPath):</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">
if (tempImgPath != None):</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;"> if (os.path.exists(tempImgPath)):</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> os.remove( tempImgPath )</span></font><br></div><br><font size="2">_clipboardGetFuncCb is called before </font><font size="2">_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.
<br><br>Looking into the clipboardservice.py code, it seems that a "</font><font size="2">_handle_file_completed" call can fire a </font>"file-completed"... but I am not sure of the right way for an activity to plug into that logic. Suggestions?
<br><br>Thanks.<br>Erik<font size="2"><span style="font-family: courier new,monospace;"></span></font><br>