From 92c5cceea39475867975f92f53bcabe48af48098 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Thu, 30 Jun 2011 20:42:05 +0000 Subject: [PATCH] 5055: Issue warning when attempting to edit media reference when media object is already being edited svn: r17874 --- src/gui/editors/displaytabs/eventembedlist.py | 5 ++-- src/gui/editors/displaytabs/gallerytab.py | 18 ++++++++++++-- .../editors/displaytabs/sourceembedlist.py | 24 ++++++++++++------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/gui/editors/displaytabs/eventembedlist.py b/src/gui/editors/displaytabs/eventembedlist.py index 5ef193b23..ded47407b 100644 --- a/src/gui/editors/displaytabs/eventembedlist.py +++ b/src/gui/editors/displaytabs/eventembedlist.py @@ -249,8 +249,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): except Errors.WindowActiveError: from QuestionDialog import WarningDialog WarningDialog(_("Cannot share this reference"), - self.__blocked_text() ) - pass + self.__blocked_text()) def edit_button_clicked(self, obj): ref = self.get_selected() @@ -263,7 +262,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): except Errors.WindowActiveError: from QuestionDialog import WarningDialog WarningDialog(_("Cannot edit this reference"), - self.__blocked_text() ) + self.__blocked_text()) elif ref and ref[0] != self._WORKGROUP: #bring up family editor key = self._groups[ref[0]][0] diff --git a/src/gui/editors/displaytabs/gallerytab.py b/src/gui/editors/displaytabs/gallerytab.py index 2e2c79f2c..4ab121bde 100644 --- a/src/gui/editors/displaytabs/gallerytab.py +++ b/src/gui/editors/displaytabs/gallerytab.py @@ -282,6 +282,16 @@ class GalleryTab(ButtonTab, DbGUIElement): self.changed = True self.rebuild() + def __blocked_text(self): + """ + Return the common text used when mediaref cannot be edited + """ + return _("This media reference cannot be edited at this time. " + "Either the associated media object is already being " + "edited or another media reference that is associated with " + "the same media object is being edited.\n\nTo edit this " + "media reference, you need to close the media object.") + def share_button_clicked(self, obj): """ Function called when the Share button is clicked. @@ -300,7 +310,9 @@ class GalleryTab(ButtonTab, DbGUIElement): EditMediaRef(self.dbstate, self.uistate, self.track, src, sref, self.add_callback) except Errors.WindowActiveError: - pass + from QuestionDialog import WarningDialog + WarningDialog(_("Cannot share this reference"), + self.__blocked_text()) def del_button_clicked(self, obj): ref = self.get_selected() @@ -318,7 +330,9 @@ class GalleryTab(ButtonTab, DbGUIElement): EditMediaRef(self.dbstate, self.uistate, self.track, obj, ref, None) except Errors.WindowActiveError: - pass + from QuestionDialog import WarningDialog + WarningDialog(_("Cannot edit this reference"), + self.__blocked_text()) def media_delete(self, del_media_handle_list): """ diff --git a/src/gui/editors/displaytabs/sourceembedlist.py b/src/gui/editors/displaytabs/sourceembedlist.py index b38842f4d..2c327b97b 100644 --- a/src/gui/editors/displaytabs/sourceembedlist.py +++ b/src/gui/editors/displaytabs/sourceembedlist.py @@ -113,6 +113,16 @@ class SourceEmbedList(EmbeddedList, DbGUIElement): except Errors.WindowActiveError: pass + def __blocked_text(self): + """ + Return the common text used when sourceref cannot be edited + """ + return _("This source reference cannot be edited at this time. " + "Either the associated source is already being edited " + "or another source reference that is associated with " + "the same source is being edited.\n\nTo edit this " + "source reference, you need to close the source.") + def share_button_clicked(self, obj): from gui.editors import EditSourceRef SelectSource = SelectorFactory('Source') @@ -130,7 +140,9 @@ class SourceEmbedList(EmbeddedList, DbGUIElement): self.object_added) except Errors.WindowActiveError: - pass + from QuestionDialog import WarningDialog + WarningDialog(_("Cannot share this reference"), + self.__blocked_text()) def edit_button_clicked(self, obj): from gui.editors import EditSourceRef @@ -143,14 +155,8 @@ class SourceEmbedList(EmbeddedList, DbGUIElement): src, sref, self.object_edited) except Errors.WindowActiveError: from QuestionDialog import WarningDialog - WarningDialog( - _("Cannot edit this reference"), - _("This source reference cannot be edited at this time. " - "Either the associated source is already being edited " - "or another source reference that is associated with " - "the same source is being edited.\n\nTo edit this " - "source reference, you need to close the source.") - ) + WarningDialog(_("Cannot edit this reference"), + self.__blocked_text()) def object_added(self, reference, primary): """