* src/GrampsDb/_GrampsInMemDB.py (abort_changes): Remove method.
* src/GrampsDb/_GrampsDbBase.py (abort_changes): Remove method. * src/GrampsDb/_GrampsBSDDB.py (undo,redo): Use the status from GrampsDbBase undo/redo; (abort_changes): Remove method. * src/ViewManager.py (abort): Add method for abandoning changes. svn: r6536
This commit is contained in:
parent
2edee552db
commit
7011115d16
@ -1,4 +1,11 @@
|
|||||||
2006-05-03 Alex Roitman <shura@gramps-project.org>
|
2006-05-03 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsInMemDB.py (abort_changes): Remove method.
|
||||||
|
* src/GrampsDb/_GrampsDbBase.py (abort_changes): Remove method.
|
||||||
|
* src/GrampsDb/_GrampsBSDDB.py (undo,redo): Use the status from
|
||||||
|
GrampsDbBase undo/redo;
|
||||||
|
(abort_changes): Remove method.
|
||||||
|
* src/ViewManager.py (abort): Add method for abandoning changes.
|
||||||
|
|
||||||
* configure.in: Set release to 0.SVN.
|
* configure.in: Set release to 0.SVN.
|
||||||
* src/DataViews/_PersonView.py (define_actions): Change label.
|
* src/DataViews/_PersonView.py (define_actions): Change label.
|
||||||
|
|
||||||
|
@ -795,11 +795,6 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def abort_changes(self):
|
|
||||||
while self.undo():
|
|
||||||
pass
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if not self.db_is_open:
|
if not self.db_is_open:
|
||||||
return
|
return
|
||||||
@ -1138,19 +1133,27 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
print "Undoing it"
|
print "Undoing it"
|
||||||
if self.UseTXN:
|
if self.UseTXN:
|
||||||
self.txn = self.env.txn_begin()
|
self.txn = self.env.txn_begin()
|
||||||
GrampsDbBase.undo(self)
|
status = GrampsDbBase.undo(self)
|
||||||
if self.UseTXN:
|
if self.UseTXN:
|
||||||
self.txn.commit()
|
if status:
|
||||||
|
self.txn.commit()
|
||||||
|
else:
|
||||||
|
self.txn.abort()
|
||||||
self.txn = None
|
self.txn = None
|
||||||
|
return status
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
print "Redoing it"
|
print "Redoing it"
|
||||||
if self.UseTXN:
|
if self.UseTXN:
|
||||||
self.txn = self.env.txn_begin()
|
self.txn = self.env.txn_begin()
|
||||||
GrampsDbBase.redo(self)
|
status = GrampsDbBase.redo(self)
|
||||||
if self.UseTXN:
|
if self.UseTXN:
|
||||||
self.txn.commit()
|
if status:
|
||||||
self.txn = None
|
self.txn.commit()
|
||||||
|
else:
|
||||||
|
self.txn.abort()
|
||||||
|
self.txn = None
|
||||||
|
return status
|
||||||
|
|
||||||
def undo_reference(self,data,handle):
|
def undo_reference(self,data,handle):
|
||||||
if data == None:
|
if data == None:
|
||||||
|
@ -259,6 +259,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
|
|
||||||
self.undoindex = -1
|
self.undoindex = -1
|
||||||
self.translist = [None] * _UNDO_SIZE
|
self.translist = [None] * _UNDO_SIZE
|
||||||
|
self.abort_possible = True
|
||||||
self.default = None
|
self.default = None
|
||||||
self.owner = Researcher()
|
self.owner = Researcher()
|
||||||
self.bookmarks = []
|
self.bookmarks = []
|
||||||
@ -345,9 +346,6 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def abort_changes(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def is_open(self):
|
def is_open(self):
|
||||||
"""
|
"""
|
||||||
Returns 1 if the database has been opened.
|
Returns 1 if the database has been opened.
|
||||||
@ -1221,6 +1219,9 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
transaction.set_description(msg)
|
transaction.set_description(msg)
|
||||||
self.undoindex += 1
|
self.undoindex += 1
|
||||||
if self.undoindex >= _UNDO_SIZE:
|
if self.undoindex >= _UNDO_SIZE:
|
||||||
|
# We overran the undo size.
|
||||||
|
# Aborting the session completely will become impossible.
|
||||||
|
self.abort_possible = False
|
||||||
self.translist = self.translist[0:-1] + [ transaction ]
|
self.translist = self.translist[0:-1] + [ transaction ]
|
||||||
else:
|
else:
|
||||||
self.translist[self.undoindex] = transaction
|
self.translist[self.undoindex] = transaction
|
||||||
@ -1229,32 +1230,29 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
for index in range(self.undoindex+1, _UNDO_SIZE):
|
for index in range(self.undoindex+1, _UNDO_SIZE):
|
||||||
self.translist[index] = None
|
self.translist[index] = None
|
||||||
|
|
||||||
person_add = self._do_commit(transaction.person_add,
|
person_add = self._do_commit(transaction.person_add,self.person_map)
|
||||||
self.person_map)
|
family_add = self._do_commit(transaction.family_add,self.family_map)
|
||||||
family_add = self._do_commit(transaction.family_add,
|
source_add = self._do_commit(transaction.source_add,self.source_map)
|
||||||
self.family_map)
|
place_add = self._do_commit(transaction.place_add, self.place_map)
|
||||||
source_add = self._do_commit(transaction.source_add,
|
media_add = self._do_commit(transaction.media_add, self.media_map)
|
||||||
self.source_map)
|
event_add = self._do_commit(transaction.event_add, self.event_map)
|
||||||
place_add = self._do_commit(transaction.place_add, self.place_map)
|
repository_add= self._do_commit(transaction.repository_add,
|
||||||
media_add = self._do_commit(transaction.media_add, self.media_map)
|
|
||||||
event_add = self._do_commit(transaction.event_add, self.event_map)
|
|
||||||
repository_add = self._do_commit(transaction.repository_add,
|
|
||||||
self.repository_map)
|
self.repository_map)
|
||||||
|
|
||||||
person_upd = self._do_commit(transaction.person_update,
|
person_upd = self._do_commit(transaction.person_update,
|
||||||
self.person_map)
|
self.person_map)
|
||||||
family_upd = self._do_commit(transaction.family_update,
|
family_upd = self._do_commit(transaction.family_update,
|
||||||
self.family_map)
|
self.family_map)
|
||||||
source_upd = self._do_commit(transaction.source_update,
|
source_upd = self._do_commit(transaction.source_update,
|
||||||
self.source_map)
|
self.source_map)
|
||||||
place_upd = self._do_commit(transaction.place_update,
|
place_upd = self._do_commit(transaction.place_update,
|
||||||
self.place_map)
|
self.place_map)
|
||||||
media_upd = self._do_commit(transaction.media_update,
|
media_upd = self._do_commit(transaction.media_update,
|
||||||
self.media_map)
|
self.media_map)
|
||||||
event_upd = self._do_commit(transaction.event_update,
|
event_upd = self._do_commit(transaction.event_update,
|
||||||
self.event_map)
|
self.event_map)
|
||||||
repository_upd = self._do_commit(transaction.repository_update,
|
repository_upd= self._do_commit(transaction.repository_update,
|
||||||
self.repository_map)
|
self.repository_map)
|
||||||
|
|
||||||
self._do_emit('person', person_add, person_upd, transaction.person_del)
|
self._do_emit('person', person_add, person_upd, transaction.person_del)
|
||||||
self._do_emit('family', family_add, family_upd, transaction.family_del)
|
self._do_emit('family', family_add, family_upd, transaction.family_del)
|
||||||
|
@ -137,9 +137,6 @@ class GrampsInMemDB(GrampsDbBase):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def abort_changes(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_name_group_mapping(self,name,group):
|
def set_name_group_mapping(self,name,group):
|
||||||
if group == None and self.name_group.has_key(name):
|
if group == None and self.name_group.has_key(name):
|
||||||
del self.name_group[name]
|
del self.name_group[name]
|
||||||
|
@ -319,7 +319,7 @@ class ViewManager:
|
|||||||
('Export', gtk.STOCK_SAVE_AS, _('_Export'), "<control>e", None,
|
('Export', gtk.STOCK_SAVE_AS, _('_Export'), "<control>e", None,
|
||||||
self.export_data),
|
self.export_data),
|
||||||
('Abandon', gtk.STOCK_REVERT_TO_SAVED,
|
('Abandon', gtk.STOCK_REVERT_TO_SAVED,
|
||||||
_('_Abandon changes and quit')),
|
_('_Abandon changes and quit'), None, None, self.abort),
|
||||||
('CmpMerge', None, _('_Compare and merge')),
|
('CmpMerge', None, _('_Compare and merge')),
|
||||||
('FastMerge', None, _('_Fast merge')),
|
('FastMerge', None, _('_Fast merge')),
|
||||||
('ScratchPad', gtk.STOCK_PASTE, _('_ScratchPad'), "", None,
|
('ScratchPad', gtk.STOCK_PASTE, _('_ScratchPad'), "", None,
|
||||||
@ -409,6 +409,22 @@ class ViewManager:
|
|||||||
Config.sync()
|
Config.sync()
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
|
def abort(self,obj=None):
|
||||||
|
"""
|
||||||
|
Abandon changes and quit.
|
||||||
|
"""
|
||||||
|
if self.state.db.abort_possible:
|
||||||
|
self.state.db.disable_signals()
|
||||||
|
while self.state.db.undo():
|
||||||
|
pass
|
||||||
|
self.quit()
|
||||||
|
else:
|
||||||
|
QuestionDialog.WarningDialog(
|
||||||
|
_('Cannot cleanly abandon changes'),
|
||||||
|
_('Changes cannot be abandoned because the number of '
|
||||||
|
'changes made exceeded the limit.'))
|
||||||
|
|
||||||
|
|
||||||
def _build_ui_manager(self):
|
def _build_ui_manager(self):
|
||||||
self.merge_ids = []
|
self.merge_ids = []
|
||||||
self.uimanager = gtk.UIManager()
|
self.uimanager = gtk.UIManager()
|
||||||
|
Loading…
Reference in New Issue
Block a user