diff --git a/ChangeLog b/ChangeLog index 003692931..360e15630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-04 Don Allingham + * src/DataViews/_MediaView.py (MediaView.drag_data_received): handle + multiple images in a drag-n-drop + 2007-09-04 Brian Matherly * src/ReportBase/__init__.py: Add MenuOptions * src/ReportBase/_MenuOptions.py: Added diff --git a/src/DataViews/_MediaView.py b/src/DataViews/_MediaView.py index 9e9bb8019..93d855ebc 100644 --- a/src/DataViews/_MediaView.py +++ b/src/DataViews/_MediaView.py @@ -163,25 +163,27 @@ class MediaView(PageView.ListView): If the selection data is define, extract the value from sel_data.data, and decide if this is a move or a reorder. """ - if sel_data and sel_data.data: - d = Utils.fix_encoding(sel_data.data.replace('\0',' ').strip()) - protocol, site, mfile, j, k, l = urlparse.urlparse(d) - if protocol == "file": - name = Utils.fix_encoding(mfile) - mime = Mime.get_type(name) - if not Mime.is_valid_type(mime): - return - photo = RelLib.MediaObject() - photo.set_path(name) - photo.set_mime_type(mime) - basename = os.path.basename(name) - (root, ext) = os.path.splitext(basename) - photo.set_description(root) - trans = self.dbstate.db.transaction_begin() - self.dbstate.db.add_object(photo, trans) - self.dbstate.db.transaction_commit(trans, - _("Drag Media Object")) + cleaned_string = sel_data.data.replace('\0',' ') + cleaned_string = cleaned_string.replace("\r"," ").strip() + data_list = Utils.fix_encoding(cleaned_string).split('\n') + for d in [item.strip() for item in data_list]: + protocol, site, mfile, j, k, l = urlparse.urlparse(d) + if protocol == "file": + name = Utils.fix_encoding(mfile) + mime = Mime.get_type(name) + if not Mime.is_valid_type(mime): + return + photo = RelLib.MediaObject() + photo.set_path(name) + photo.set_mime_type(mime) + basename = os.path.basename(name) + (root, ext) = os.path.splitext(basename) + photo.set_description(root) + trans = self.dbstate.db.transaction_begin() + self.dbstate.db.add_object(photo, trans) + self.dbstate.db.transaction_commit(trans, + _("Drag Media Object")) widget.emit_stop_by_name('drag_data_received') def get_bookmarks(self):