* src/PeopleView.py: rebuild after a filter is applied

* src/DbPrompter: remove ZODB option
* src/RelLib.py: remove ZODB option
* src/gramps.glade: remove ZODB option
* src/gramps_main.py: remove ZODB option


svn: r2306
This commit is contained in:
Don Allingham 2003-11-01 19:55:30 +00:00
parent 38e4401965
commit 4dcb9ceb3a
5 changed files with 46 additions and 141 deletions

View File

@ -37,12 +37,6 @@ import GrampsCfg
import VersionControl import VersionControl
from gettext import gettext as _ from gettext import gettext as _
try:
import ZODB
_zodb = 1
except:
_zodb = 0
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# DbPrompter # DbPrompter
@ -73,19 +67,13 @@ class DbPrompter:
}) })
self.new = opendb.get_widget("new") self.new = opendb.get_widget("new")
self.zodb = opendb.get_widget("zodb")
if self.want_new: if self.want_new:
self.new.set_active(1) self.new.set_active(1)
if _zodb:
self.zodb.show()
def open_ok_clicked(self,obj): def open_ok_clicked(self,obj):
if self.new.get_active(): if self.new.get_active():
self.db.clear_database(0) self.db.clear_database(0)
self.save_as_activate() self.save_as_activate()
elif self.zodb.get_active():
self.db.clear_database(1)
self.save_as_activate()
else: else:
self.open_activate() self.open_activate()
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)

View File

@ -184,7 +184,9 @@ class PeopleView:
self.DataFilter = class_init(qualifer) self.DataFilter = class_init(qualifer)
self.DataFilter.set_invert(invert_filter) self.DataFilter.set_invert(invert_filter)
self.model_used = {} self.model_used = {}
self.clear_person_tabs()
self.apply_filter(self.person_tree) self.apply_filter(self.person_tree)
self.goto_active_person()
def add_to_person_list(self,person,change): def add_to_person_list(self,person,change):
key = person.getId() key = person.getId()

View File

@ -42,18 +42,6 @@ import GrampsCfg
import sort import sort
import const import const
#-------------------------------------------------------------------------
#
# Attempt to load the ZODB libraries, otherwise provide alternates
#
#-------------------------------------------------------------------------
try:
from ZODB import Persistent
except ImportError:
class Persistent:
"""Dummy class used if ZODB is not installed on the system"""
pass
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Confidence levels # Confidence levels
@ -74,16 +62,7 @@ CONF_VERY_LOW = 0
_id_reg = compile("%\d+d") _id_reg = compile("%\d+d")
def extlist(lst): class SourceNote:
"""Returns a copy of the passed list"""
return lst[:] # Make a copy.
def extmap(map):
"""Returns a map"""
return map
class SourceNote(Persistent):
"""Base class for storing source references and notes""" """Base class for storing source references and notes"""
def __init__(self,source=None): def __init__(self,source=None):
@ -105,11 +84,10 @@ class SourceNote(Persistent):
def addSourceRef(self,id) : def addSourceRef(self,id) :
"""Set the source reference""" """Set the source reference"""
self.source_list.append(id) self.source_list.append(id)
self._p_changed = 1
def getSourceRefList(self) : def getSourceRefList(self) :
"""Return the source reference""" """Return the source reference"""
return extlist(self.source_list) return self.source_list
def setSourceRefList(self,list) : def setSourceRefList(self,list) :
"""Replaces the source reference""" """Replaces the source reference"""
@ -310,7 +288,7 @@ class Place(SourceNote):
def getUrlList(self): def getUrlList(self):
"""Return the list of URLs""" """Return the list of URLs"""
return extlist(self.urls) return self.urls
def setUrlList(self,list): def setUrlList(self,list):
"""Replace the current URL list with the new one""" """Replace the current URL list with the new one"""
@ -319,7 +297,6 @@ class Place(SourceNote):
def addUrl(self,url): def addUrl(self,url):
"""Add a URL to the URL list""" """Add a URL to the URL list"""
self.urls.append(url) self.urls.append(url)
self._p_changed = 1
def setId(self,id): def setId(self,id):
"""Sets the gramps ID for the place object""" """Sets the gramps ID for the place object"""
@ -365,7 +342,7 @@ class Place(SourceNote):
def get_alternate_locations(self): def get_alternate_locations(self):
"""Returns a list of alternate location information objects""" """Returns a list of alternate location information objects"""
return extlist(self.alt_loc) return self.alt_loc
def set_alternate_locations(self,list): def set_alternate_locations(self,list):
"""Replaces the current alternate location list with the new one""" """Replaces the current alternate location list with the new one"""
@ -375,16 +352,14 @@ class Place(SourceNote):
"""Adds a Location to the alternate location list""" """Adds a Location to the alternate location list"""
if loc not in self.alt_loc: if loc not in self.alt_loc:
self.alt_loc.append(loc) self.alt_loc.append(loc)
self._p_changed = 1
def addPhoto(self,photo): def addPhoto(self,photo):
"""Adds a Photo object to the place object's image list""" """Adds a Photo object to the place object's image list"""
self.photoList.append(photo) self.photoList.append(photo)
self._p_changed = 1
def getPhotoList(self): def getPhotoList(self):
"""Returns the list of Photo objects""" """Returns the list of Photo objects"""
return extlist(self.photoList) return self.photoList
def setPhotoList(self,list): def setPhotoList(self,list):
"""Sets the list of Photo objects""" """Sets the list of Photo objects"""
@ -407,7 +382,7 @@ class Place(SourceNote):
else: else:
return [self.title,self.id,'','','','','',self.title.upper(), '','','','',''] return [self.title,self.id,'','','','','',self.title.upper(), '','','','','']
class Researcher(Persistent): class Researcher:
"""Contains the information about the owner of the database""" """Contains the information about the owner of the database"""
def __init__(self): def __init__(self):
@ -472,7 +447,7 @@ class Researcher(Persistent):
if email: if email:
self.email = strip(email) self.email = strip(email)
class Location(Persistent): class Location:
"""Provides information about a place, including city, county, state, """Provides information about a place, including city, county, state,
and country. Multiple Location objects can represent the same place, and country. Multiple Location objects can represent the same place,
since names of citys, countys, states, and even countries can change since names of citys, countys, states, and even countries can change
@ -536,7 +511,7 @@ class Location(Persistent):
"""returns the country name of the Location object""" """returns the country name of the Location object"""
return self.country return self.country
class Note(Persistent): class Note:
"""Provides general text information""" """Provides general text information"""
def __init__(self,text = ""): def __init__(self,text = ""):
@ -623,17 +598,16 @@ class Photo(SourceNote):
but provides a means for XML users to attach other properties to but provides a means for XML users to attach other properties to
the image""" the image"""
self.attrlist.append(attr) self.attrlist.append(attr)
self._p_changed = 1
def getAttributeList(self): def getAttributeList(self):
"""returns the property list associated with the image""" """returns the property list associated with the image"""
return extlist(self.attrlist) return self.attrlist
def setAttributeList(self,list): def setAttributeList(self,list):
self.attrlist = list self.attrlist = list
class ObjectRef(Persistent): class ObjectRef:
"""Object reference class""" """Object reference class"""
def __init__(self,source=None): def __init__(self,source=None):
self.attrlist = [] self.attrlist = []
@ -692,17 +666,15 @@ class ObjectRef(Persistent):
but provides a means for XML users to attach other properties to but provides a means for XML users to attach other properties to
the image""" the image"""
self.attrlist.append(attr) self.attrlist.append(attr)
self._p_changed = 1
def getAttributeList(self): def getAttributeList(self):
"""returns the property list associated with the image""" """returns the property list associated with the image"""
return extlist(self.attrlist) return self.attrlist
def setAttributeList(self,list): def setAttributeList(self,list):
"""sets the property list associated with the image""" """sets the property list associated with the image"""
self.attrlist = list self.attrlist = list
class Attribute(DataObj): class Attribute(DataObj):
"""Provides a simple key/value pair for describing properties. Used """Provides a simple key/value pair for describing properties. Used
by the Person and Family objects to store descriptive information.""" by the Person and Family objects to store descriptive information."""
@ -982,7 +954,7 @@ class Name(DataObj):
index = index + 1 index = index + 1
return 1 return 1
class Url(Persistent): class Url:
"""Contains information related to internet Uniform Resource Locators, """Contains information related to internet Uniform Resource Locators,
allowing gramps to store information about internet resources""" allowing gramps to store information about internet resources"""
@ -1111,7 +1083,7 @@ class Person(SourceNote):
def getAlternateNames(self): def getAlternateNames(self):
"""returns the list of alternate Names""" """returns the list of alternate Names"""
return extlist(self.alternateNames) return self.alternateNames
def setAlternateNames(self,list): def setAlternateNames(self,list):
"""changes the list of alternate names to the passed list""" """changes the list of alternate names to the passed list"""
@ -1120,11 +1092,10 @@ class Person(SourceNote):
def addAlternateName(self,name): def addAlternateName(self,name):
"""adds an alternate Name instance to the list""" """adds an alternate Name instance to the list"""
self.alternateNames.append(name) self.alternateNames.append(name)
self._p_changed = 1
def getUrlList(self): def getUrlList(self):
"""returns the list of URL instances""" """returns the list of URL instances"""
return extlist(self.urls) return self.urls
def setUrlList(self,list): def setUrlList(self,list):
"""sets the list of URL instances to list""" """sets the list of URL instances to list"""
@ -1133,7 +1104,6 @@ class Person(SourceNote):
def addUrl(self,url): def addUrl(self,url):
"""adds a URL instance to the list""" """adds a URL instance to the list"""
self.urls.append(url) self.urls.append(url)
self._p_changed = 1
def setId(self,id): def setId(self,id):
"""sets the gramps ID for the Person""" """sets the gramps ID for the Person"""
@ -1211,11 +1181,10 @@ class Person(SourceNote):
def addPhoto(self,photo): def addPhoto(self,photo):
"""adds a Photo instance to the image list""" """adds a Photo instance to the image list"""
self.photoList.append(photo) self.photoList.append(photo)
self._p_changed = 1
def getPhotoList(self): def getPhotoList(self):
"""returns the list of Photos""" """returns the list of Photos"""
return extlist(self.photoList) return self.photoList
def setPhotoList(self,list): def setPhotoList(self,list):
"""Sets the list of Photo objects""" """Sets the list of Photo objects"""
@ -1224,11 +1193,10 @@ class Person(SourceNote):
def addEvent(self,event): def addEvent(self,event):
"""adds an Event to the event list""" """adds an Event to the event list"""
self.EventList.append(event) self.EventList.append(event)
self._p_changed = 1
def getEventList(self): def getEventList(self):
"""returns the list of Event instances""" """returns the list of Event instances"""
return extlist(self.EventList) return self.EventList
def setEventList(self,list): def setEventList(self,list):
"""sets the event list to the passed list""" """sets the event list to the passed list"""
@ -1239,7 +1207,6 @@ class Person(SourceNote):
families/marriages/partnerships in which the person is a families/marriages/partnerships in which the person is a
parent or spouse""" parent or spouse"""
self.FamilyList.append(family) self.FamilyList.append(family)
self._p_changed = 1
def setPreferred(self,family): def setPreferred(self,family):
if family in self.FamilyList: if family in self.FamilyList:
@ -1249,7 +1216,7 @@ class Person(SourceNote):
def getFamilyList(self) : def getFamilyList(self) :
"""returns the list of Family instances in which the """returns the list of Family instances in which the
person is a parent or spouse""" person is a parent or spouse"""
return extlist(self.FamilyList) return self.FamilyList
def clearFamilyList(self) : def clearFamilyList(self) :
self.FamilyList = [] self.FamilyList = []
@ -1259,22 +1226,19 @@ class Person(SourceNote):
of marriages/partnerships""" of marriages/partnerships"""
if family in self.FamilyList: if family in self.FamilyList:
self.FamilyList.remove(family) self.FamilyList.remove(family)
self._p_changed = 1
def addAddress(self,address): def addAddress(self,address):
"""adds the Address instance to the list of addresses""" """adds the Address instance to the list of addresses"""
self.addressList.append(address) self.addressList.append(address)
self._p_changed = 1
def removeAddress(self,address): def removeAddress(self,address):
"""removes the Address instance from the list of addresses""" """removes the Address instance from the list of addresses"""
if address in self.addressList: if address in self.addressList:
self.addressList.remove(address) self.addressList.remove(address)
self._p_changed = 1
def getAddressList(self): def getAddressList(self):
"""returns the list of addresses""" """returns the list of addresses"""
return extlist(self.addressList) return self.addressList
def setAddressList(self,list): def setAddressList(self,list):
"""sets the address list to the specified list""" """sets the address list to the specified list"""
@ -1283,17 +1247,15 @@ class Person(SourceNote):
def addAttribute(self,attribute): def addAttribute(self,attribute):
"""adds an Attribute instance to the attribute list""" """adds an Attribute instance to the attribute list"""
self.attributeList.append(attribute) self.attributeList.append(attribute)
self._p_changed = 1
def removeAttribute(self,attribute): def removeAttribute(self,attribute):
"""removes the specified Attribute instance from the attribute list""" """removes the specified Attribute instance from the attribute list"""
if attribute in self.attributeList: if attribute in self.attributeList:
self.attributeList.remove(attribute) self.attributeList.remove(attribute)
self._p_changed = 1
def getAttributeList(self): def getAttributeList(self):
"""returns the attribute list""" """returns the attribute list"""
return extlist(self.attributeList) return self.attributeList
def setAttributeList(self,list): def setAttributeList(self,list):
"""sets the attribute list to the specified list""" """sets the attribute list to the specified list"""
@ -1302,13 +1264,12 @@ class Person(SourceNote):
def getParentList(self): def getParentList(self):
"""returns the list of alternate Family instances, in which the Person """returns the list of alternate Family instances, in which the Person
is a child of the family, but not a natural child of both parents""" is a child of the family, but not a natural child of both parents"""
return extlist(self.AltFamilyList) return self.AltFamilyList
def addAltFamily(self,family,mrel,frel): def addAltFamily(self,family,mrel,frel):
"""adds a Family to the alternate family list, indicating the """adds a Family to the alternate family list, indicating the
relationship to the mother (mrel) and the father (frel)""" relationship to the mother (mrel) and the father (frel)"""
self.AltFamilyList.append((family,mrel,frel)) self.AltFamilyList.append((family,mrel,frel))
self._p_changed = 1
def clearAltFamilyList(self): def clearAltFamilyList(self):
self.AltFamilyList = [] self.AltFamilyList = []
@ -1318,7 +1279,6 @@ class Person(SourceNote):
for f in self.AltFamilyList[:]: for f in self.AltFamilyList[:]:
if f[0] == family: if f[0] == family:
self.AltFamilyList.remove(f) self.AltFamilyList.remove(f)
self._p_changed = 1
return f return f
else: else:
return None return None
@ -1329,7 +1289,6 @@ class Person(SourceNote):
for f in self.AltFamilyList[:]: for f in self.AltFamilyList[:]:
if f[0] == family: if f[0] == family:
self.AltFamilyList[index] = (family,mrel,frel) self.AltFamilyList[index] = (family,mrel,frel)
self._p_changed = 1
index += 1 index += 1
def has_family(self,family): def has_family(self,family):
@ -1510,7 +1469,6 @@ class Event(DataObj):
self.description = source.description self.description = source.description
self.name = source.name self.name = source.name
self.cause = source.cause self.cause = source.cause
# old ZODB database may not have this element
try: try:
if source.witness: if source.witness:
self.witness = source.witness[:] self.witness = source.witness[:]
@ -1654,7 +1612,7 @@ class Event(DataObj):
"""sets the Date object associated with the Event""" """sets the Date object associated with the Event"""
self.date = date self.date = date
class Witness(Persistent): class Witness:
def __init__(self,type=Event.NAME,val="",comment=""): def __init__(self,type=Event.NAME,val="",comment=""):
self.set_type(type) self.set_type(type)
self.set_value(val) self.set_value(val)
@ -1721,17 +1679,15 @@ class Family(SourceNote):
def addAttribute(self,attribute) : def addAttribute(self,attribute) :
"""adds an Attribute instance to the attribute list""" """adds an Attribute instance to the attribute list"""
self.attributeList.append(attribute) self.attributeList.append(attribute)
self._p_changed = 1
def removeAttribute(self,attribute): def removeAttribute(self,attribute):
"""removes the specified Attribute instance from the attribute list""" """removes the specified Attribute instance from the attribute list"""
if attribute in self.attributeList: if attribute in self.attributeList:
self.attributeList.remove(attribute) self.attributeList.remove(attribute)
self._p_changed = 1
def getAttributeList(self) : def getAttributeList(self) :
"""returns the attribute list""" """returns the attribute list"""
return extlist(self.attributeList) return self.attributeList
def setAttributeList(self,list) : def setAttributeList(self,list) :
"""sets the attribute list to the specified list""" """sets the attribute list to the specified list"""
@ -1786,7 +1742,6 @@ class Family(SourceNote):
to the child list""" to the child list"""
if person not in self.Children: if person not in self.Children:
self.Children.append(person) self.Children.append(person)
self._p_changed = 1
if person.getAncestor(): if person.getAncestor():
if self.Father: if self.Father:
self.Father.setAncestor(1) self.Father.setAncestor(1)
@ -1797,7 +1752,6 @@ class Family(SourceNote):
"""removes the specified Person from the child list""" """removes the specified Person from the child list"""
if person in self.Children: if person in self.Children:
self.Children.remove(person) self.Children.remove(person)
self._p_changed = 1
if person.getAncestor(): if person.getAncestor():
if self.Father: if self.Father:
self.Father.setAncestor(0) self.Father.setAncestor(0)
@ -1806,7 +1760,7 @@ class Family(SourceNote):
def getChildList(self): def getChildList(self):
"""returns the list of children""" """returns the list of children"""
return extlist(self.Children) return self.Children
def setChildList(self, list): def setChildList(self, list):
"""sets the list of children""" """sets the list of children"""
@ -1829,11 +1783,10 @@ class Family(SourceNote):
def addEvent(self,event): def addEvent(self,event):
"""adds an Event to the event list""" """adds an Event to the event list"""
self.EventList.append(event) self.EventList.append(event)
self._p_changed = 1
def getEventList(self) : def getEventList(self) :
"""returns the list of Event instances""" """returns the list of Event instances"""
return extlist(self.EventList) return self.EventList
def setEventList(self,list) : def setEventList(self,list) :
"""sets the event list to the passed list""" """sets the event list to the passed list"""
@ -1842,11 +1795,10 @@ class Family(SourceNote):
def addPhoto(self,photo): def addPhoto(self,photo):
"""Adds a Photo object to the Family instance's image list""" """Adds a Photo object to the Family instance's image list"""
self.photoList.append(photo) self.photoList.append(photo)
self._p_changed = 1
def getPhotoList(self): def getPhotoList(self):
"""Returns the list of Photo objects""" """Returns the list of Photo objects"""
return extlist(self.photoList) return self.photoList
def setPhotoList(self,list): def setPhotoList(self,list):
"""Sets the list of Photo objects""" """Sets the list of Photo objects"""
@ -1858,7 +1810,7 @@ class Family(SourceNote):
return 1 return 1
return None return None
class Source(Persistent): class Source:
"""A record of a source of information""" """A record of a source of information"""
def __init__(self): def __init__(self):
@ -1886,11 +1838,10 @@ class Source(Persistent):
def addPhoto(self,photo): def addPhoto(self,photo):
"""Adds a Photo object to the Source instance's image list""" """Adds a Photo object to the Source instance's image list"""
self.photoList.append(photo) self.photoList.append(photo)
self._p_changed = 1
def getPhotoList(self): def getPhotoList(self):
"""Returns the list of Photo objects""" """Returns the list of Photo objects"""
return extlist(self.photoList) return self.photoList
def setPhotoList(self,list): def setPhotoList(self,list):
"""Sets the list of Photo objects""" """Sets the list of Photo objects"""
@ -1950,7 +1901,7 @@ class Source(Persistent):
of the Source""" of the Source"""
return self.callno return self.callno
class SourceRef(Persistent): class SourceRef:
"""Source reference, containing detailed information about how a """Source reference, containing detailed information about how a
referenced source relates to it""" referenced source relates to it"""
@ -2110,7 +2061,7 @@ class GenderStats:
return Person.unknown return Person.unknown
class GrampsDB(Persistent): class GrampsDB:
"""GRAMPS database object. This object is a base class for other """GRAMPS database object. This object is a base class for other
objects.""" objects."""
@ -2307,7 +2258,7 @@ class GrampsDB(Persistent):
def getPersonMap(self): def getPersonMap(self):
"""returns a map of gramps's IDs to Person instances""" """returns a map of gramps's IDs to Person instances"""
return extmap(self.personMap) return self.personMap
def setPersonMap(self,map): def setPersonMap(self,map):
"""sets the map of gramps's IDs to Person instances""" """sets the map of gramps's IDs to Person instances"""
@ -2316,7 +2267,7 @@ class GrampsDB(Persistent):
def getPlaceMap(self): def getPlaceMap(self):
"""returns a map of gramps's IDs to Place instances""" """returns a map of gramps's IDs to Place instances"""
return extmap(self.placeMap) return self.placeMap
def setPlaceMap(self,map): def setPlaceMap(self,map):
"""sets the map of gramps's IDs to Place instances""" """sets the map of gramps's IDs to Place instances"""
@ -2324,7 +2275,7 @@ class GrampsDB(Persistent):
def getFamilyMap(self): def getFamilyMap(self):
"""returns a map of gramps's IDs to Family instances""" """returns a map of gramps's IDs to Family instances"""
return extmap(self.familyMap) return self.familyMap
def getFamily(self,id): def getFamily(self,id):
"""returns a map of gramps's IDs to Family instances""" """returns a map of gramps's IDs to Family instances"""
@ -2336,8 +2287,7 @@ class GrampsDB(Persistent):
def getSourceMap(self): def getSourceMap(self):
"""returns a map of gramps's IDs to Source instances""" """returns a map of gramps's IDs to Source instances"""
return extmap(self.sourceMap) return self.sourceMap
def getObjectMap(self): def getObjectMap(self):
"""returns a map of gramps's IDs to Object instances""" """returns a map of gramps's IDs to Object instances"""

View File

@ -6357,7 +6357,7 @@
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">300</property> <property name="default_width">300</property>
<property name="default_height">200</property> <property name="default_height">150</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="icon">gramps.png</property> <property name="icon">gramps.png</property>
@ -6476,25 +6476,6 @@
<property name="fill">False</property> <property name="fill">False</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkRadioButton" id="zodb">
<property name="border_width">5</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Create a new _ZODB database</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">existing</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>

View File

@ -74,12 +74,6 @@ import VersionControl
import ReadXML import ReadXML
import GrampsXML import GrampsXML
try:
import GrampsZODB
zodb_ok = 1
except:
zodb_ok = 0
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants
@ -121,7 +115,6 @@ class Gramps:
self.place_loaded = 0 self.place_loaded = 0
self.bookmarks = None self.bookmarks = None
self.c_details = 6 self.c_details = 6
self.id2col = {}
self.cl = 0 self.cl = 0
gtk.rc_parse(const.gtkrcFile) gtk.rc_parse(const.gtkrcFile)
@ -134,7 +127,7 @@ class Gramps:
"security risks.")) "security risks."))
# This will never contain data - It will be replaced by either # This will never contain data - It will be replaced by either
# a GrampsXML or GrampsZODB # a GrampsXML
self.history = [] self.history = []
self.mhistory = [] self.mhistory = []
@ -685,7 +678,8 @@ class Gramps:
if self.find_person: if self.find_person:
self.find_person.show() self.find_person.show()
else: else:
self.find_person = Find.FindPerson(self.find_goto_person,self.db,self.id2col) self.find_person = Find.FindPerson(self.find_goto_person,self.db,
self.people_view.id2col)
def on_findname_activate(self,obj): def on_findname_activate(self,obj):
"""Display the find box""" """Display the find box"""
@ -849,7 +843,7 @@ class Gramps:
import DbPrompter import DbPrompter
DbPrompter.DbPrompter(self,1,self.topWindow) DbPrompter.DbPrompter(self,1,self.topWindow)
def clear_database(self,zodb=1): def clear_database(self):
"""Clear out the database if permission was granted""" """Clear out the database if permission was granted"""
const.personalEvents = const.init_personal_event_list() const.personalEvents = const.init_personal_event_list()
const.personalAttributes = const.init_personal_attribute_list() const.personalAttributes = const.init_personal_attribute_list()
@ -864,12 +858,7 @@ class Gramps:
self.people_view.clear_person_tabs() self.people_view.clear_person_tabs()
if zodb == 1: self.db = GrampsXML.GrampsXML()
self.db = GrampsZODB.GrampsZODB()
elif zodb == 2:
self.db = RelLib.GrampsDB()
else:
self.db = GrampsXML.GrampsXML()
self.db.set_iprefix(GrampsCfg.iprefix) self.db.set_iprefix(GrampsCfg.iprefix)
self.db.set_oprefix(GrampsCfg.oprefix) self.db.set_oprefix(GrampsCfg.oprefix)
self.db.set_fprefix(GrampsCfg.fprefix) self.db.set_fprefix(GrampsCfg.fprefix)
@ -958,7 +947,7 @@ class Gramps:
return return
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
self.clear_database(0) self.clear_database()
if getoldrev.get_active(): if getoldrev.get_active():
vc = VersionControl.RcsVersionControl(filename) vc = VersionControl.RcsVersionControl(filename)
@ -1028,10 +1017,10 @@ class Gramps:
self.displayError(_("Database could not be opened"), self.displayError(_("Database could not be opened"),
_("%s is not a directory.") % filename + ' ' + \ _("%s is not a directory.") % filename + ' ' + \
_("You should select a directory that contains a " _("You should select a directory that contains a "
"data.gramps file or a gramps.zodb file.")) "data.gramps file."))
return return
self.clear_database(2) self.clear_database()
if self.load_database(filename) == 1: if self.load_database(filename) == 1:
if filename[-1] == '/': if filename[-1] == '/':
filename = filename[:-1] filename = filename[:-1]
@ -1153,7 +1142,7 @@ class Gramps:
self.displayError(_("Database could not be opened"), self.displayError(_("Database could not be opened"),
_("%s is not a directory.") % filename + ' ' + \ _("%s is not a directory.") % filename + ' ' + \
_("You should select a directory that contains a " _("You should select a directory that contains a "
"data.gramps file or a gramps.zodb file.")) "data.gramps file."))
return return
else: else:
try: try:
@ -1432,7 +1421,6 @@ class Gramps:
self.db.new() self.db.new()
self.active_person = None self.active_person = None
self.place_loaded = 0 self.place_loaded = 0
self.id2col = {}
self.read_file(file) self.read_file(file)
Utils.clearModified() Utils.clearModified()
Utils.clear_timer() Utils.clear_timer()
@ -1700,11 +1688,7 @@ class Gramps:
def load_database(self,name): def load_database(self,name):
filename = "%s/%s" % (name,const.xmlFile) filename = "%s/%s" % (name,const.xmlFile)
if not os.path.isfile(filename) and zodb_ok: self.clear_database()
filename = "%s/%s" % (name,const.zodbFile)
self.clear_database(1)
else:
self.clear_database(0)
self.status_text(_("Loading %s...") % name) self.status_text(_("Loading %s...") % name)
if self.db.load(filename,self.load_progress) == 0: if self.db.load(filename,self.load_progress) == 0: