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

svn: r17874
This commit is contained in:
Nick Hall 2011-06-30 20:42:05 +00:00
parent 5eea9ca023
commit 92c5cceea3
3 changed files with 33 additions and 14 deletions

View File

@ -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]

View File

@ -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):
"""

View File

@ -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):
"""