Speed up Event, Media, and Repo reference editors
This commit is contained in:
parent
7d6113cf38
commit
67b83794ef
@ -66,6 +66,7 @@ class EditEventRef(EditReference):
|
||||
def __init__(self, state, uistate, track, event, event_ref, update):
|
||||
EditReference.__init__(self, state, uistate, track, event, event_ref,
|
||||
update)
|
||||
self.original = event.serialize()
|
||||
self._init_event()
|
||||
|
||||
def _local_init(self):
|
||||
@ -268,6 +269,8 @@ class EditEventRef(EditReference):
|
||||
def ok_clicked(self, obj):
|
||||
|
||||
if self.source.handle:
|
||||
# only commit if it has changed
|
||||
if self.source.serialize() != self.original:
|
||||
with DbTxn(_("Modify Event"), self.db) as trans:
|
||||
self.commit_event(self.source, trans)
|
||||
else:
|
||||
|
@ -84,6 +84,8 @@ class EditMediaRef(EditReference):
|
||||
#show the addmedia dialog immediately, with track of parent.
|
||||
AddMedia(state, self.uistate, self.track, self.source,
|
||||
self._update_addmedia)
|
||||
else:
|
||||
self.original = self.source.serialize()
|
||||
|
||||
def _local_init(self):
|
||||
|
||||
@ -518,6 +520,8 @@ class EditMediaRef(EditReference):
|
||||
|
||||
#first save primary object
|
||||
if self.source.handle:
|
||||
# only commit if it has changed
|
||||
if self.source.serialize() != self.original:
|
||||
with DbTxn(_("Edit Media Object (%s)") %
|
||||
self.source.get_description(), self.db) as trans:
|
||||
self.db.commit_media(self.source, trans)
|
||||
|
@ -51,6 +51,7 @@ class EditRepoRef(EditReference):
|
||||
|
||||
EditReference.__init__(self, state, uistate, track, source,
|
||||
source_ref, update)
|
||||
self.original = source.serialize()
|
||||
|
||||
def _local_init(self):
|
||||
|
||||
@ -189,6 +190,8 @@ class EditRepoRef(EditReference):
|
||||
def ok_clicked(self, obj):
|
||||
|
||||
if self.source.handle:
|
||||
# only commit if it has changed
|
||||
if self.source.serialize() != self.original:
|
||||
with DbTxn(_("Modify Repository"), self.db) as trans:
|
||||
self.db.commit_repository(self.source, trans)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user