* src/ArgHandler.py: Make sure all databases are closed before
creating a new one. * src/DisplayModels.py: Calculate new nodes properly after a node has be deleted. The node hasn't been removed from the database yet. * src/EditPerson.py: Add check for unknown gender before closing * src/EditSource.py: Remove unnecessary updates * src/GrampsBSDDB.py: check for open in close() * src/GrampsDbBase.py: spelling error * src/MediaView.py: connect to database-changed * src/PedView.py: remove unused update function * src/PeopleView.py: connect to database-changed * src/PlaceView.py: connect to database-changed * src/SourceView.py: connect to database-changed, remove unnecessary callback * src/gramps_main.py: add database-changed signal svn: r4288
This commit is contained in:
parent
9a6894df98
commit
8126f34ec9
@ -1,3 +1,21 @@
|
||||
2005-04-03 Don Allingham <don@gramps-project.org>
|
||||
* src/ArgHandler.py: Make sure all databases are closed before
|
||||
creating a new one.
|
||||
* src/DisplayModels.py: Calculate new nodes properly after a
|
||||
node has be deleted. The node hasn't been removed from the database
|
||||
yet.
|
||||
* src/EditPerson.py: Add check for unknown gender before closing
|
||||
* src/EditSource.py: Remove unnecessary updates
|
||||
* src/GrampsBSDDB.py: check for open in close()
|
||||
* src/GrampsDbBase.py: spelling error
|
||||
* src/MediaView.py: connect to database-changed
|
||||
* src/PedView.py: remove unused update function
|
||||
* src/PeopleView.py: connect to database-changed
|
||||
* src/PlaceView.py: connect to database-changed
|
||||
* src/SourceView.py: connect to database-changed, remove unnecessary
|
||||
callback
|
||||
* src/gramps_main.py: add database-changed signal
|
||||
|
||||
2005-04-03 Alex Roitman <shura@gramps-project.org>
|
||||
* src/AddMedia.py: Remove unneeded update argument.
|
||||
* src/ArgHandler.py (auto_save_load): Mysterious workaround :-).
|
||||
|
@ -225,21 +225,20 @@ class ArgHandler:
|
||||
filename = os.path.normpath(os.path.abspath(filename))
|
||||
filetype = GrampsMime.get_type(filename)
|
||||
if filetype == const.app_gramps:
|
||||
# FIXME: For some reason the following two lines are needed
|
||||
# to prevent source view from getting out of sync. Makes no
|
||||
# sense to me right now, but it seems to fix a problem and
|
||||
# make no harm otherwise. Should remove when understood.
|
||||
import GrampsBSDDB
|
||||
self.parent.db.close()
|
||||
self.parent.db = GrampsBSDDB.GrampsBSDDB()
|
||||
self.parent.read_file(filename)
|
||||
return 1
|
||||
elif filetype == const.app_gramps_xml:
|
||||
import GrampsXMLDB
|
||||
self.parent.db.close()
|
||||
self.parent.db = GrampsXMLDB.GrampsXMLDB()
|
||||
self.parent.read_file(filename)
|
||||
return 1
|
||||
elif filetype == const.app_gedcom:
|
||||
import GrampsGEDDB
|
||||
self.parent.db.close()
|
||||
self.parent.db = GrampsGEDDB.GrampsGEDDB()
|
||||
self.parent.read_file(filename)
|
||||
return 1
|
||||
|
@ -72,9 +72,6 @@ class BaseModel(gtk.GenericTreeModel):
|
||||
self.datalist = []
|
||||
self.indexlist = []
|
||||
|
||||
def on_row_inserted(self,obj,path,node):
|
||||
self.rebuild_data()
|
||||
|
||||
def add_row_by_handle(self,handle):
|
||||
self.datalist = self.sort_keys()
|
||||
i = 0
|
||||
@ -88,7 +85,15 @@ class BaseModel(gtk.GenericTreeModel):
|
||||
|
||||
def delete_row_by_handle(self,handle):
|
||||
index = self.indexlist[handle]
|
||||
self.rebuild_data()
|
||||
|
||||
self.indexlist = {}
|
||||
self.datalist = []
|
||||
i = 0
|
||||
for key in self.sort_keys():
|
||||
if key != handle:
|
||||
self.indexlist[key] = i
|
||||
self.datalist.append(key)
|
||||
i += 1
|
||||
self.row_deleted(index)
|
||||
|
||||
def update_row_by_handle(self,handle):
|
||||
|
@ -61,7 +61,7 @@ import DateHandler
|
||||
import TransTable
|
||||
import NameDisplay
|
||||
|
||||
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog
|
||||
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2
|
||||
|
||||
from DdTargets import DdTargets
|
||||
|
||||
@ -1682,6 +1682,18 @@ class EditPerson:
|
||||
|
||||
def on_apply_person_clicked(self,obj):
|
||||
|
||||
if self.is_unknown.get_active():
|
||||
dialog = QuestionDialog2(
|
||||
_("Unknown gender specified"),
|
||||
_("The gender of the person is currently unknown. "
|
||||
"Usually, this is a mistake. You may choose to "
|
||||
"either continue saving, or returning to the "
|
||||
"Edit Person dialog to fix the problem."),
|
||||
_("Continue saving"), _("Return to window"),
|
||||
self.window)
|
||||
if not dialog.run():
|
||||
return
|
||||
|
||||
self.window.hide()
|
||||
trans = self.db.transaction_begin()
|
||||
|
||||
|
@ -375,11 +375,10 @@ class EditSource:
|
||||
|
||||
|
||||
class DelSrcQuery:
|
||||
def __init__(self,source,db,the_lists,update):
|
||||
def __init__(self,source,db,the_lists):
|
||||
self.source = source
|
||||
self.db = db
|
||||
self.the_lists = the_lists
|
||||
self.update = update
|
||||
|
||||
def query_response(self):
|
||||
trans = self.db.transaction_begin()
|
||||
@ -420,5 +419,5 @@ class DelSrcQuery:
|
||||
self.db.commit_media_object(media,trans)
|
||||
|
||||
self.db.remove_source(self.source.get_handle(),trans)
|
||||
self.db.transaction_commit(trans,_("Delete Source (%s)") % self.source.get_title())
|
||||
self.update(self.source.get_handle())
|
||||
self.db.transaction_commit(
|
||||
trans,_("Delete Source (%s)") % self.source.get_title())
|
||||
|
@ -207,6 +207,8 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
self.close()
|
||||
|
||||
def close(self):
|
||||
if not self.person_map:
|
||||
return
|
||||
self.name_group.close()
|
||||
self.person_map.close()
|
||||
self.family_map.close()
|
||||
@ -402,7 +404,6 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
print 'Successfully finished all upgrades'
|
||||
|
||||
def upgrade_2(self,child_rel_notrans):
|
||||
print "Upgrading to DB version 2"
|
||||
cursor = self.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
@ -428,7 +429,6 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
cursor.close()
|
||||
|
||||
def upgrade_3(self):
|
||||
print "Upgrading to DB version 3"
|
||||
cursor = self.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
@ -444,7 +444,6 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
cursor.close()
|
||||
|
||||
def upgrade_4(self,child_rel_notrans):
|
||||
print "Upgrading to DB version 4"
|
||||
cursor = self.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
@ -476,6 +475,7 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
# comments into note in SourceRefs
|
||||
# in all primary and secondary objects
|
||||
# Also MediaObject gets place attribute removed
|
||||
|
||||
cursor = self.get_media_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
|
@ -189,8 +189,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
||||
self.bookmarks = []
|
||||
self.path = ""
|
||||
self.place2title = {}
|
||||
self.name_groups = {}
|
||||
|
||||
self.name_group = {}
|
||||
|
||||
def need_upgrade(self):
|
||||
return False
|
||||
|
@ -72,6 +72,7 @@ _HANDLE_COL = len(column_names)
|
||||
class MediaView:
|
||||
def __init__(self,parent,db,glade,update):
|
||||
self.parent = parent
|
||||
self.parent.connect('database-changed',self.change_db)
|
||||
self.db = db
|
||||
self.list = glade.get_widget("media_list")
|
||||
self.mid = glade.get_widget("mid")
|
||||
|
@ -182,7 +182,7 @@ class DispBox:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PedigreeView:
|
||||
def __init__(self,parent,canvas,update,status_bar,change_active,lp):
|
||||
def __init__(self,parent,canvas,update,status_bar,lp):
|
||||
self.parent = parent
|
||||
self.canvas = canvas
|
||||
self.canvas_items = []
|
||||
@ -197,7 +197,6 @@ class PedigreeView:
|
||||
self.y2 = 0
|
||||
self.update = update
|
||||
self.sb = status_bar
|
||||
self.change_active_person = change_active
|
||||
self.load_person = lp
|
||||
self.anchor = None
|
||||
self.canvas.parent.connect('button-press-event',self.on_canvas_press)
|
||||
@ -339,7 +338,7 @@ class PedigreeView:
|
||||
ypts[mindex], h, w, p[0], style, p[1])
|
||||
p = lst[i]
|
||||
box = DispBox(self.root,style,xpts[i],ypts[i],w,h,p[0],self.parent.db,
|
||||
self.change_active_person,
|
||||
self.parent.change_active_person,
|
||||
self.load_person, self.build_full_nav_menu)
|
||||
self.boxes.append(box)
|
||||
self.change_active_person(person)
|
||||
|
@ -69,6 +69,8 @@ class PeopleView:
|
||||
def __init__(self,parent):
|
||||
self.parent = parent
|
||||
|
||||
self.parent.connect('database-changed',self.change_db)
|
||||
|
||||
all = GenericFilter.GenericFilter()
|
||||
all.set_name(_("Entire Database"))
|
||||
all.add_rule(GenericFilter.Everyone([]))
|
||||
@ -170,7 +172,7 @@ class PeopleView:
|
||||
self.parent.db.connect('person-update', self.person_updated)
|
||||
self.parent.db.connect('person-delete', self.person_removed)
|
||||
self.parent.db.connect('person-rebuild', self.redisplay_person_list)
|
||||
|
||||
self.apply_filter()
|
||||
|
||||
def remove_from_person_list(self,person):
|
||||
"""Remove the selected person from the list. A person object is
|
||||
|
@ -69,15 +69,15 @@ class PlaceView:
|
||||
|
||||
def __init__(self,parent,db,glade):
|
||||
self.parent = parent
|
||||
self.parent.connect('database-changed',self.change_db)
|
||||
|
||||
self.glade = glade
|
||||
self.list = glade.get_widget("place_list")
|
||||
self.list.connect('button-press-event',self.button_press)
|
||||
self.list.connect('key-press-event',self.key_press)
|
||||
self.selection = self.list.get_selection()
|
||||
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
|
||||
|
||||
self.renderer = gtk.CellRendererText()
|
||||
|
||||
self.model = DisplayModels.PlaceModel(self.parent.db)
|
||||
|
||||
self.list.set_model(self.model)
|
||||
|
@ -66,6 +66,7 @@ _HANDLE_COL = len(column_names)
|
||||
class SourceView:
|
||||
def __init__(self,parent,db,glade):
|
||||
self.parent = parent
|
||||
self.parent.connect('database-changed',self.change_db)
|
||||
self.glade = glade
|
||||
self.list = glade.get_widget("source_list")
|
||||
#self.list.set_property('fixed-height-mode',True)
|
||||
@ -178,8 +179,7 @@ class SourceView:
|
||||
source = self.parent.db.get_source_from_handle(handle)
|
||||
|
||||
the_lists = Utils.get_source_referents(handle,self.parent.db)
|
||||
ans = EditSource.DelSrcQuery(source,self.parent.db,the_lists,
|
||||
self.model.delete_row_by_handle)
|
||||
ans = EditSource.DelSrcQuery(source,self.parent.db,the_lists)
|
||||
|
||||
if filter(None,the_lists): # quick test for non-emptiness
|
||||
msg = _('This source is currently being used. Deleting it '
|
||||
|
@ -52,6 +52,7 @@ import gtk.gdk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import RelLib
|
||||
import GrampsDbBase
|
||||
import GrampsBSDDB
|
||||
import PedView
|
||||
import MediaView
|
||||
@ -77,11 +78,10 @@ import RelImage
|
||||
import RecentFiles
|
||||
import NameDisplay
|
||||
import Errors
|
||||
import GrampsDBCallback
|
||||
|
||||
from GrampsMime import mime_type_is_defined
|
||||
|
||||
from QuestionDialog import *
|
||||
|
||||
from bsddb import db
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -106,10 +106,16 @@ MEDIA_VIEW = 6
|
||||
# Main GRAMPS class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Gramps:
|
||||
class Gramps(GrampsDBCallback.GrampsDBCallback):
|
||||
|
||||
__signals__ = {
|
||||
'database-changed' : (GrampsDbBase.GrampsDbBase,),
|
||||
}
|
||||
|
||||
def __init__(self,args):
|
||||
|
||||
GrampsDBCallback.GrampsDBCallback.__init__(self)
|
||||
|
||||
try:
|
||||
self.program = gnome.program_init('gramps',const.version,
|
||||
gnome.libgnome_module_info_get(),
|
||||
@ -318,9 +324,9 @@ class Gramps:
|
||||
self.family_view = FamilyView.FamilyView(self)
|
||||
self.people_view = PeopleView.PeopleView(self)
|
||||
|
||||
self.pedigree_view = PedView.PedigreeView(self,
|
||||
self.canvas, self.modify_statusbar, self.statusbar,
|
||||
self.change_active_person, self.load_person
|
||||
self.pedigree_view = PedView.PedigreeView(
|
||||
self, self.canvas, self.modify_statusbar, self.statusbar,
|
||||
self.load_person
|
||||
)
|
||||
|
||||
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop)
|
||||
@ -496,12 +502,7 @@ class Gramps:
|
||||
if self.active_person:
|
||||
p = self.db.get_person_from_handle(self.active_person.get_handle())
|
||||
self.change_active_person(p)
|
||||
self.place_view.change_db(self.db)
|
||||
self.family_view.change_db()
|
||||
self.people_view.change_db(self.db)
|
||||
self.people_view.apply_filter()
|
||||
self.source_view.change_db(self.db)
|
||||
self.media_view.change_db(self.db)
|
||||
self.emit('database-changed',(self.db,))
|
||||
|
||||
def exit_and_undo(self,*args):
|
||||
self.db.abort_changes()
|
||||
@ -1111,21 +1112,14 @@ class Gramps:
|
||||
|
||||
def full_update(self):
|
||||
"""Brute force display update, updating all the pages"""
|
||||
self.people_view.person_model.rebuild_data()
|
||||
if Utils.wasHistory_broken():
|
||||
self.clear_history()
|
||||
Utils.clearHistory_broken()
|
||||
self.family_view.change_db()
|
||||
self.people_view.change_db(self.db)
|
||||
self.people_view.apply_filter()
|
||||
self.emit('database-changed',(self.db,))
|
||||
if not self.active_person:
|
||||
self.change_active_person(self.find_initial_person())
|
||||
self.goto_active_person()
|
||||
|
||||
self.place_view.change_db(self.db)
|
||||
self.source_view.change_db(self.db)
|
||||
self.media_view.change_db(self.db)
|
||||
|
||||
def update_display(self,changed=True):
|
||||
"""Incremental display update, update only the displayed page"""
|
||||
page = self.views.get_current_page()
|
||||
@ -1240,8 +1234,8 @@ class Gramps:
|
||||
self.gtop.get_widget('edit_bookmarks').set_sensitive(not self.db.readonly)
|
||||
self.gtop.get_widget('tools_menu').set_sensitive(not self.db.readonly)
|
||||
self.gtop.get_widget('tools').set_sensitive(not self.db.readonly)
|
||||
|
||||
self.goto_active_person()
|
||||
self.update_display()
|
||||
return 1
|
||||
|
||||
def save_media(self,filename):
|
||||
|
Loading…
Reference in New Issue
Block a user