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,8 +269,10 @@ class EditEventRef(EditReference):
|
||||
def ok_clicked(self, obj):
|
||||
|
||||
if self.source.handle:
|
||||
with DbTxn(_("Modify Event"), self.db) as trans:
|
||||
self.commit_event(self.source,trans)
|
||||
# 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:
|
||||
if self.check_for_duplicate_id('Event'):
|
||||
return
|
||||
|
@ -83,7 +83,9 @@ class EditMediaRef(EditReference):
|
||||
if not self.source.get_handle():
|
||||
#show the addmedia dialog immediately, with track of parent.
|
||||
AddMedia(state, self.uistate, self.track, self.source,
|
||||
self._update_addmedia)
|
||||
self._update_addmedia)
|
||||
else:
|
||||
self.original = self.source.serialize()
|
||||
|
||||
def _local_init(self):
|
||||
|
||||
@ -518,9 +520,11 @@ class EditMediaRef(EditReference):
|
||||
|
||||
#first save primary object
|
||||
if self.source.handle:
|
||||
with DbTxn(_("Edit Media Object (%s)") %
|
||||
self.source.get_description(), self.db) as trans:
|
||||
self.db.commit_media(self.source, trans)
|
||||
# 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)
|
||||
else:
|
||||
if self.check_for_duplicate_id('Media'):
|
||||
return
|
||||
|
@ -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,8 +190,10 @@ class EditRepoRef(EditReference):
|
||||
def ok_clicked(self, obj):
|
||||
|
||||
if self.source.handle:
|
||||
with DbTxn(_("Modify Repository"), self.db) as trans:
|
||||
self.db.commit_repository(self.source,trans)
|
||||
# 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:
|
||||
if self.check_for_duplicate_id('Repository'):
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user