Set new media as active (#1191)
This commit is contained in:
parent
410cffe832
commit
249a3180f0
@ -326,6 +326,7 @@ class EditMedia(EditPrimary):
|
|||||||
with DbTxn(_("Add Media Object (%s)") % self.obj.get_description(),
|
with DbTxn(_("Add Media Object (%s)") % self.obj.get_description(),
|
||||||
self.db) as trans:
|
self.db) as trans:
|
||||||
self.db.add_media(self.obj, trans)
|
self.db.add_media(self.obj, trans)
|
||||||
|
self.uistate.set_active(self.obj.handle, "Media")
|
||||||
else:
|
else:
|
||||||
if self.data_has_changed():
|
if self.data_has_changed():
|
||||||
with DbTxn(_("Edit Media Object (%s)") % self.obj.get_description(),
|
with DbTxn(_("Edit Media Object (%s)") % self.obj.get_description(),
|
||||||
|
@ -169,7 +169,10 @@ class MediaView(ListView):
|
|||||||
"""
|
"""
|
||||||
if not sel_data:
|
if not sel_data:
|
||||||
return
|
return
|
||||||
|
|
||||||
files = sel_data.get_uris()
|
files = sel_data.get_uris()
|
||||||
|
photo = None
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
protocol, site, mfile, j, k, l = urlparse(file)
|
protocol, site, mfile, j, k, l = urlparse(file)
|
||||||
if protocol == "file":
|
if protocol == "file":
|
||||||
@ -191,6 +194,10 @@ class MediaView(ListView):
|
|||||||
photo.set_description(root)
|
photo.set_description(root)
|
||||||
with DbTxn(_("Drag Media Object"), self.dbstate.db) as trans:
|
with DbTxn(_("Drag Media Object"), self.dbstate.db) as trans:
|
||||||
self.dbstate.db.add_media(photo, trans)
|
self.dbstate.db.add_media(photo, trans)
|
||||||
|
|
||||||
|
if photo:
|
||||||
|
self.uistate.set_active(photo.handle, "Media")
|
||||||
|
|
||||||
widget.emit_stop_by_name('drag_data_received')
|
widget.emit_stop_by_name('drag_data_received')
|
||||||
|
|
||||||
def define_actions(self):
|
def define_actions(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user