Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/view
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-04-18 21:52:46 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-04-18 21:52:46 (GMT)
commitd223579f22c4327eec367b0362cc18f214137e76 (patch)
tree95bed22fc4ff1f535b98569839ca7b7420fe64c5 /shell/view
parent71d718e97b991d15eba07638b0d06eb24811f1c8 (diff)
Recognize images dropped into the clipboard as such.
Diffstat (limited to 'shell/view')
-rw-r--r--shell/view/frame/clipboardbox.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py
index c057a42..4a01610 100644
--- a/shell/view/frame/clipboardbox.py
+++ b/shell/view/frame/clipboardbox.py
@@ -1,6 +1,7 @@
import shutil
import os
import logging
+import urlparse
import hippo
import gtk
@@ -79,15 +80,19 @@ class ClipboardBox(hippo.CanvasBox):
cb_service = clipboardservice.get_instance()
if selection.type == 'text/uri-list':
+ uris = selection.data.split('\n')
+ if len(uris) > 1:
+ raise NotImplementedError('Multiple uris in text/uri-list still not supported.')
+ uri = urlparse.urlparse(uris[0])
+ path, file_name = os.path.split(uri.path)
+
# Copy the file, as it will be deleted when the dnd operation finishes.
- file_path = selection.data.replace('file://', '')
- new_file_path = os.path.join(os.path.split(file_path)[0],
- "cb" + os.path.split(file_path)[1])
- shutil.copyfile(file_path, new_file_path)
+ new_file_path = os.path.join(path, 'cb' + file_name)
+ shutil.copyfile(uri.path, new_file_path)
cb_service.add_object_format(object_id,
selection.type,
- 'file://' + new_file_path,
+ uri.scheme + "://" + new_file_path,
on_disk=True)
else:
cb_service.add_object_format(object_id,