diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-14 10:27:46 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-14 10:27:46 (GMT) |
commit | 42e2b95379d2e3ddc8a03de1210c2957220fc72b (patch) | |
tree | 2efd76ee633aadcd1f85473c1221b02895fdd3b8 | |
parent | e6e649419a9d64e13b3e991721e6f5ff8389aa27 (diff) |
Misc dnd fixes.
-rw-r--r-- | services/clipboard/typeregistry.py | 2 | ||||
-rw-r--r-- | shell/view/frame/clipboardbox.py | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/services/clipboard/typeregistry.py b/services/clipboard/typeregistry.py index 97ac37b..93cc7e6 100644 --- a/services/clipboard/typeregistry.py +++ b/services/clipboard/typeregistry.py @@ -597,7 +597,7 @@ class UriListFileType(FileType): uris = self._formats['text/uri-list'].get_data().split('\n') if len(uris) == 1: uri = urlparse.urlparse(uris[0]) - ext = posixpath.splitext(uri.path)[1] + ext = posixpath.splitext(uri[2])[1] logging.debug(ext) # FIXME: Bad hack, the type registry should treat text/uri-list as a special case. if ext in ['.jpg', '.jpeg', '.gif', '.png', '.svg']: diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py index 965a6c6..fc81bce 100644 --- a/shell/view/frame/clipboardbox.py +++ b/shell/view/frame/clipboardbox.py @@ -62,9 +62,12 @@ class ClipboardBox(hippo.CanvasBox): return self._owns_clipboard def _get_icon_at_coords(self, x, y): + box_x, box_y = self.get_context().get_position(self) + x -= box_x + y -= box_y for object_id, icon in self._icons.iteritems(): - [icon_x, icon_y] = self.get_position(icon) - [icon_width, icon_height] = icon.get_allocation() + icon_x, icon_y = self.get_position(icon) + icon_width, icon_height = icon.get_allocation() if (x >= icon_x ) and (x <= icon_x + icon_width) and \ (y >= icon_y ) and (y <= icon_y + icon_height): @@ -88,11 +91,11 @@ class ClipboardBox(hippo.CanvasBox): # Copy the file, as it will be deleted when the dnd operation finishes. new_file_path = os.path.join(path, 'cb' + file_name) - shutil.copyfile(uri.path, new_file_path) + shutil.copyfile(uri[2], new_file_path) cb_service.add_object_format(object_id, selection.type, - uri.scheme + "://" + new_file_path, + uri[0] + "://" + new_file_path, on_disk=True) else: cb_service.add_object_format(object_id, @@ -184,7 +187,7 @@ class ClipboardBox(hippo.CanvasBox): return True def drag_data_received_cb(self, widget, context, x, y, selection, targetType, time): - logging.debug('ClipboardBox: got data for target ' + selection.target) + logging.debug('ClipboardBox: got data for target %r' % selection.target) try: if selection: object_id = self._context_map.get_object_id(context) |