5055: Issue warning when attempting to edit media reference when media object is already being edited

svn: r17873
This commit is contained in:
Nick Hall 2011-06-30 20:41:15 +00:00
parent ce508eb8a3
commit f34d60ad9d
3 changed files with 33 additions and 14 deletions

View File

@ -249,8 +249,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
except Errors.WindowActiveError: except Errors.WindowActiveError:
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"),
self.__blocked_text() ) self.__blocked_text())
pass
def edit_button_clicked(self, obj): def edit_button_clicked(self, obj):
ref = self.get_selected() ref = self.get_selected()
@ -263,7 +262,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
except Errors.WindowActiveError: except Errors.WindowActiveError:
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
WarningDialog(_("Cannot edit this reference"), WarningDialog(_("Cannot edit this reference"),
self.__blocked_text() ) self.__blocked_text())
elif ref and ref[0] != self._WORKGROUP: elif ref and ref[0] != self._WORKGROUP:
#bring up family editor #bring up family editor
key = self._groups[ref[0]][0] key = self._groups[ref[0]][0]

View File

@ -284,6 +284,16 @@ class GalleryTab(ButtonTab, DbGUIElement):
self.changed = True self.changed = True
self.rebuild() 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): def share_button_clicked(self, obj):
""" """
Function called when the Share button is clicked. Function called when the Share button is clicked.
@ -302,7 +312,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
EditMediaRef(self.dbstate, self.uistate, self.track, EditMediaRef(self.dbstate, self.uistate, self.track,
src, sref, self.add_callback) src, sref, self.add_callback)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass from QuestionDialog import WarningDialog
WarningDialog(_("Cannot share this reference"),
self.__blocked_text())
def del_button_clicked(self, obj): def del_button_clicked(self, obj):
ref = self.get_selected() ref = self.get_selected()
@ -320,7 +332,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
EditMediaRef(self.dbstate, self.uistate, self.track, EditMediaRef(self.dbstate, self.uistate, self.track,
obj, ref, self.edit_callback) obj, ref, self.edit_callback)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass from QuestionDialog import WarningDialog
WarningDialog(_("Cannot edit this reference"),
self.__blocked_text())
def edit_callback(self, media_ref, media): def edit_callback(self, media_ref, media):
""" """

View File

@ -113,6 +113,16 @@ class SourceEmbedList(EmbeddedList, DbGUIElement):
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass 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): def share_button_clicked(self, obj):
from gui.editors import EditSourceRef from gui.editors import EditSourceRef
SelectSource = SelectorFactory('Source') SelectSource = SelectorFactory('Source')
@ -130,7 +140,9 @@ class SourceEmbedList(EmbeddedList, DbGUIElement):
self.object_added) self.object_added)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass from QuestionDialog import WarningDialog
WarningDialog(_("Cannot share this reference"),
self.__blocked_text())
def edit_button_clicked(self, obj): def edit_button_clicked(self, obj):
from gui.editors import EditSourceRef from gui.editors import EditSourceRef
@ -143,14 +155,8 @@ class SourceEmbedList(EmbeddedList, DbGUIElement):
src, sref, self.object_edited) src, sref, self.object_edited)
except Errors.WindowActiveError: except Errors.WindowActiveError:
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
WarningDialog( WarningDialog(_("Cannot edit this reference"),
_("Cannot edit this reference"), self.__blocked_text())
_("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 object_added(self, reference, primary): def object_added(self, reference, primary):
""" """