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:
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

@ -284,6 +284,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.
@ -302,7 +312,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()
@ -320,7 +332,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
EditMediaRef(self.dbstate, self.uistate, self.track,
obj, ref, self.edit_callback)
except Errors.WindowActiveError:
pass
from QuestionDialog import WarningDialog
WarningDialog(_("Cannot edit this reference"),
self.__blocked_text())
def edit_callback(self, media_ref, media):
"""

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