diff --git a/gramps/src/Config.py b/gramps/src/Config.py
index a805c624b..c937eb012 100644
--- a/gramps/src/Config.py
+++ b/gramps/src/Config.py
@@ -105,6 +105,7 @@ nameof = utils.normal_name
display_attr = 0
attr_name = ""
status_bar = 0
+calendar = 0
paper_preference = None
output_preference = None
report_dir = "./"
@@ -157,6 +158,7 @@ def loadConfig(call):
global autoload
global owner
global usetabs
+ global calendar
global usevc
global iprefix
global fprefix
@@ -187,6 +189,7 @@ def loadConfig(call):
_callback = call
lastfile = get_string("/gramps/data/LastFile")
usetabs = get_bool("/gramps/config/UseTabs")
+ calendar = get_bool("/gramps/config/ShowCalendar")
usevc = get_bool("/gramps/config/UseVersionControl")
vc_comment = get_bool("/gramps/config/UseComment")
uncompress = get_bool("/gramps/config/DontCompressXML")
@@ -279,6 +282,8 @@ def loadConfig(call):
autoload = 1
if usetabs == None:
usetabs = 0
+ if calendar == None:
+ calendar = 0
if usevc == None:
usevc = 0
if vc_comment == None:
@@ -390,6 +395,7 @@ def on_propertybox_apply(obj,page):
global nameof
global owner
global usetabs
+ global calendar
global usevc
global iprefix
global fprefix
@@ -420,6 +426,7 @@ def on_propertybox_apply(obj,page):
display_attr = prefsTop.get_widget("attr_display").get_active()
attr_name = string.strip(prefsTop.get_widget("attr_name").get_text())
usetabs = prefsTop.get_widget("usetabs").get_active()
+ calendar = prefsTop.get_widget("calendar").get_active()
usevc = prefsTop.get_widget("use_vc").get_active()
vc_comment = prefsTop.get_widget("vc_comment").get_active()
uncompress = prefsTop.get_widget("uncompress").get_active()
@@ -469,6 +476,7 @@ def on_propertybox_apply(obj,page):
output_preference = output_obj.get_data(DATA)
set_bool("/gramps/config/UseTabs",usetabs)
+ set_bool("/gramps/config/ShowCalendar",calendar)
set_bool("/gramps/config/UseVersionControl",usevc)
set_bool("/gramps/config/UseComment",vc_comment)
set_bool("/gramps/config/DontCompressXML",uncompress)
@@ -631,6 +639,7 @@ def display_preferences_box(db):
idedit = prefsTop.get_widget("gid_edit")
index_vis = prefsTop.get_widget("show_child_id")
tabs = prefsTop.get_widget("usetabs")
+ cal = prefsTop.get_widget("calendar")
vc = prefsTop.get_widget("use_vc")
vcom = prefsTop.get_widget("vc_comment")
compress = prefsTop.get_widget("uncompress")
@@ -640,6 +649,7 @@ def display_preferences_box(db):
auto.set_active(autoload)
detail.set_active(show_detail)
tabs.set_active(usetabs)
+ cal.set_active(calendar)
vc.set_active(usevc)
vcom.set_active(vc_comment)
compress.set_active(uncompress)
diff --git a/gramps/src/Date.py b/gramps/src/Date.py
index af7b910e9..48571de2b 100644
--- a/gramps/src/Date.py
+++ b/gramps/src/Date.py
@@ -29,7 +29,23 @@ _ = gettext
#-------------------------------------------------------------------------
#
-#
+# Calendar Mappings
+#
+#-------------------------------------------------------------------------
+GREGORIAN = 0
+JULIAN = 1
+HEBREW = 2
+FRENCH = 3
+
+_index2cal = [ _("Gregorian"), _("Julian"), _("Hebrew"), _("French Republican") ]
+_cal2index = { _("Gregorian") : 0,
+ _("Julian") : 1,
+ _("Hebrew") : 2,
+ _("French Republican"): 3 }
+
+#-------------------------------------------------------------------------
+#
+# Date class
#
#-------------------------------------------------------------------------
class Date:
@@ -59,11 +75,19 @@ class Date:
self.stop = None
self.range = source.range
self.text = source.text
+ self.calendar = source.calendar
else:
self.start = SingleDate()
self.stop = None
self.range = 0
self.text = ""
+ self.calendar = GREGORIAN
+
+ def get_calendar(self):
+ return self.calendar
+
+ def set_calendar(self,val):
+ self.calendar = val
def get_start_date(self):
return self.start
@@ -106,6 +130,9 @@ class Date:
self.stop = SingleDate()
return self.get_stop_date().getDay()
+ def getText(self):
+ return self.text
+
def greater_than(self,other):
return compare_dates(self,other) > 0
@@ -115,11 +142,6 @@ class Date:
def equal_to(self,other):
return compare_dates(self,other) == 0
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
def set(self,text):
match = Date.fmt.match(text)
try:
@@ -137,24 +159,19 @@ class Date:
self.range = -1
self.text = text
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
+ def set_range(self,val):
+ self.range = val
+
def getDate(self):
if self.range == 0:
return _func(self.start)
elif self.range == -1:
return self.text
else:
- return "%s %s %s %s" % ( _("from"),_func(self.start),_("to"), _func(self.stop))
+ d1 = _func(self.start)
+ d2 = _func(self.stop)
+ return "%s %s %s %s" % ( _("from"),d1,_("to"),d2 )
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
def getQuoteDate(self):
if self.range == 0:
return _func(self.start)
@@ -164,16 +181,15 @@ class Date:
else:
return ''
else:
- return "%s %s %s %s" % ( _("from"),_func(self.start),_("to"), _func(self.stop))
+ d1 = _func(self.start)
+ d2 = _func(self.stop)
+ return "%s %s %s %s" % ( _("from"),d1,_("to"), d2)
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
def getSaveDate(self):
if self.range == 1:
- return "FROM " + self.start.getSaveDate() + " TO " + self.stop.getSaveDate()
+ d1 = self.start.getSaveDate()
+ d2 = self.stop.getSaveDate()
+ return "FROM %s TO %s" % (d1,d2)
elif self.range == -1:
return self.text
else:
@@ -192,16 +208,11 @@ class Date:
return 1
def isRange(self):
- if self.range == -1:
- return 0
- else:
+ if self.range == 1:
return 1
+ else:
+ return 0
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
def quick_set(self,text):
try:
match = Date.efmt.match(text)
@@ -455,14 +466,27 @@ class SingleDate:
except KeyError:
self.month = -1
- #--------------------------------------------------------------------
- #
- #
- #
- #--------------------------------------------------------------------
def getMonthStr(self):
return SingleDate.mname[self.month]
+ def getIsoDate(self):
+ if self.year == -1:
+ y = "?"
+ else:
+ y = "%04d" % self.year
+ if self.month == -1:
+ if self.day == -1:
+ m = ""
+ else:
+ m = "-?"
+ else:
+ m = "-%02d" % (self.month+1)
+ if self.day == -1:
+ d = ''
+ else:
+ d = "-%02d" % self.day
+ return "%s%s%s" % (y,m,d)
+
#--------------------------------------------------------------------
#
#
@@ -493,9 +517,9 @@ class SingleDate:
retval = "ABT %s" % retval
if self.mode == SingleDate.before:
- retval = _("BEFORE") + " " + retval
+ retval = "BEFORE" + " " + retval
elif self.mode == SingleDate.after:
- retval = _("AFTER") + " " + retval
+ retval = "AFTER" + " " + retval
return retval
@@ -831,6 +855,33 @@ class SingleDate:
function = SingleDate.fmtFunc[Date.formatCode]
return function(self)
+ def setIsoDate(self,v):
+ data = string.split(v)
+ if len(data) > 1:
+ self.setMode(data[0])
+ v = data[1]
+
+ vals = string.split(v,'-')
+ if vals[0] == '?':
+ self.year = -1
+ else:
+ self.year = int(vals[0])
+ if len(vals) > 1 and vals[1] != '?':
+ self.month = int(vals[1])-1
+ else:
+ self.month = -1
+ if len(vals) > 2:
+ self.day = int(vals[2])
+ else:
+ self.day = -1
+
+
+ def getModeVal(self):
+ return self.mode
+
+ def setModeVal(self,val):
+ self.mode = val
+
#--------------------------------------------------------------------
#
#
@@ -839,12 +890,14 @@ class SingleDate:
def getMode(self,val):
if val == None:
self.mode = SingleDate.exact
- elif string.lower(val)[0:3] == "bef":
+ elif string.lower(val)[0:2] == "be":
self.mode = SingleDate.before
- elif string.lower(val)[0:3] == "aft":
+ elif string.lower(val)[0:2] == "af":
self.mode = SingleDate.after
- else:
+ elif string.lower(val)[0:2] == "ab":
self.mode = SingleDate.about
+ else:
+ self.mode = SingleDate.exact
#--------------------------------------------------------------------
#
diff --git a/gramps/src/EditPerson.glade b/gramps/src/EditPerson.glade
index 192e2dd7b..ae7df6548 100644
--- a/gramps/src/EditPerson.glade
+++ b/gramps/src/EditPerson.glade
@@ -233,31 +233,6 @@
-
- GtkEntry
- birthDate
- 250
- True
- True
- True
- 0
-
-
- 2
- 3
- 0
- 1
- 3
- 3
- True
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label25
@@ -380,6 +355,31 @@
+
+
+ GtkEntry
+ birthDate
+ 250
+ True
+ True
+ True
+ 0
+
+
+ 2
+ 3
+ 0
+ 1
+ 3
+ 3
+ True
+ False
+ False
+ False
+ True
+ False
+
+
@@ -4762,31 +4762,6 @@
-
- GtkEntry
- address_start
- True
- True
- True
- True
- 0
-
-
- 1
- 2
- 0
- 1
- 3
- 3
- True
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label215
@@ -4936,6 +4911,62 @@
False
+
+
+ GtkHBox
+ hbox36
+ False
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ True
+
+
+
+ GtkEntry
+ address_start
+ True
+ True
+ True
+ True
+ 0
+
+
+ 0
+ True
+ True
+
+
+
+
+ GtkOptionMenu
+ calendar
+ False
+ Selects the calendar format for display
+ True
+ Gregorian
+Julian
+Hebrew
+French
+
+ 0
+
+ 3
+ False
+ False
+
+
+
diff --git a/gramps/src/EventEdit.py b/gramps/src/EventEdit.py
index 28033ea0b..93e3af8be 100644
--- a/gramps/src/EventEdit.py
+++ b/gramps/src/EventEdit.py
@@ -35,6 +35,7 @@ import libglade
import Sources
import const
import utils
+import Config
from RelLib import *
#-------------------------------------------------------------------------
@@ -64,7 +65,13 @@ class EventEditor:
self.note_field = self.top.get_widget("eventNote")
self.event_menu = self.top.get_widget("personalEvents")
self.priv = self.top.get_widget("priv")
+ self.calendar = self.top.get_widget("calendar")
+ if Config.calendar:
+ self.calendar.show()
+ else:
+ self.calendar.hide()
+
self.top.get_widget("eventTitle").set_text(name)
self.event_menu.set_popdown_strings(list)
if read_only:
diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py
index d2da91e10..3a50a74da 100644
--- a/gramps/src/GrampsParser.py
+++ b/gramps/src/GrampsParser.py
@@ -19,6 +19,7 @@
#
from RelLib import *
+from Date import SingleDate
import string
import utils
@@ -51,12 +52,6 @@ def fix_spaces(text_list):
#-------------------------------------------------------------------------
class GrampsParser:
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
-
def __init__(self,database,callback,base):
self.stext_list = []
self.scomments_list = []
@@ -115,6 +110,7 @@ class GrampsParser:
p.EndElementHandler = self.endElement
p.CharacterDataHandler = self.characters
p.ParseFile(file)
+
self.db.setResearcher(self.owner)
if self.tempDefault != None:
id = self.tempDefault
@@ -151,22 +147,12 @@ class GrampsParser:
self.placeobj.set_main_location(loc)
self.locations = self.locations + 1
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_coord(self,attrs):
if attrs.has_key('lat'):
self.placeobj.set_latitude(u2l(attrs['lat']))
if attrs.has_key('long'):
self.placeobj.set_longitude(u2l(attrs['long']))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_event(self,attrs):
self.event = Event()
self.event_type = u2l(attrs["type"])
@@ -177,11 +163,6 @@ class GrampsParser:
if attrs.has_key("priv"):
self.event.private = int(attrs["priv"])
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_attribute(self,attrs):
self.attribute = Attribute()
if attrs.has_key("conf"):
@@ -205,11 +186,6 @@ class GrampsParser:
elif self.family:
self.family.addAttribute(self.attribute)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_address(self,attrs):
self.address = Address()
self.person.addAddress(self.address)
@@ -220,64 +196,29 @@ class GrampsParser:
if attrs.has_key("priv"):
self.address.private = int(attrs["priv"])
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_bmark(self,attrs):
person = self.db.findPersonNoMap(u2l(attrs["ref"]))
self.db.bookmarks.append(person)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_person(self,attrs):
if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1
self.person = self.db.findPersonNoMap(u2l(attrs["id"]))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_people(self,attrs):
if attrs.has_key("default"):
self.tempDefault = u2l(attrs["default"])
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_father(self,attrs):
self.family.Father = self.db.findPersonNoMap(u2l(attrs["ref"]))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_mother(self,attrs):
self.family.Mother = self.db.findPersonNoMap(u2l(attrs["ref"]))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_child(self,attrs):
self.family.Children.append(self.db.findPersonNoMap(u2l(attrs["ref"])))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_url(self,attrs):
if not attrs.has_key("href"):
@@ -300,11 +241,6 @@ class GrampsParser:
except KeyError:
return
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_family(self,attrs):
if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries))
@@ -315,11 +251,6 @@ class GrampsParser:
else:
self.family.setRelationship("")
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_childof(self,attrs):
family = self.db.findFamilyNoMap(u2l(attrs["ref"]))
if len(attrs) == 1:
@@ -340,19 +271,9 @@ class GrampsParser:
type = u2l(attrs["type"])
self.person.AltFamilyList.append((family,type,type))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_parentin(self,attrs):
self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"])))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_name(self,attrs):
self.name = Name()
if attrs.has_key("conf"):
@@ -362,19 +283,9 @@ class GrampsParser:
if attrs.has_key("priv"):
self.name.private = int(attrs["priv"])
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_note(self,attrs):
self.in_note = 1
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_sourceref(self,attrs):
self.source_ref = SourceRef()
source = self.db.findSourceNoMap(u2l(attrs["ref"]))
@@ -398,11 +309,6 @@ class GrampsParser:
elif self.placeobj:
self.placeobj.addSourceRef(self.source_ref)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_source(self,attrs):
self.source = self.db.findSourceNoMap(u2l(attrs["id"]))
@@ -438,11 +344,6 @@ class GrampsParser:
def stop_objref(self,tag):
self.objref = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_photo(self,attrs):
self.photo = Photo()
self.pref = ObjectRef()
@@ -477,51 +378,55 @@ class GrampsParser:
elif self.placeobj:
self.placeobj.addPhoto(self.pref)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
+ def start_daterange(self,attrs):
+ if self.address:
+ d = self.address.getDateObj()
+ else:
+ d = self.event.getDateObj()
+ d.get_start_date().setIsoDate(attrs['start'])
+ d.get_stop_date().setIsoDate(attrs['stop'])
+ if attrs.has_key("dpref"):
+ d.set_calendar(int(attrs['dpref']))
+
+ def start_dateval(self,attrs):
+ if self.address:
+ d = self.address.getDateObj()
+ else:
+ d = self.event.getDateObj()
+
+ d.get_start_date().setIsoDate(attrs['val'])
+
+ if attrs.has_key("type"):
+ d.get_start_date().getMode(attrs['type'])
+ else:
+ d.get_start_date().getMode(None)
+
+ if attrs.has_key("dpref"):
+ d.set_calendar(int(attrs['dpref']))
+
+ def start_datestr(self,attrs):
+ if self.address:
+ d = self.address.getDateObj()
+ else:
+ d = self.event.getDateObj()
+
+ d.set(attrs['val'])
+
def start_created(self,attrs):
self.entries = int(attrs["people"]) + int(attrs["families"])
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_pos(self,attrs):
self.person.position = (int(attrs["x"]), int(attrs["y"]))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_attribute(self,tag):
self.attribute = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_attr_type(self,tag):
self.attribute.setType(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_attr_value(self,tag):
self.attribute.setValue(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_address(self,tag):
self.address = None
@@ -537,11 +442,6 @@ class GrampsParser:
self.placeobj.set_title(build_place_title(loc))
self.palceobj = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_event(self,tag):
self.event.name = self.event_type
@@ -556,20 +456,10 @@ class GrampsParser:
self.person.EventList.append(self.event)
self.event = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_name(self,tag):
self.person.PrimaryName = self.name
self.name = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_place(self,tag):
if self.placeobj == None:
if self.place_map.has_key(u2l(tag)):
@@ -581,19 +471,9 @@ class GrampsParser:
self.place_map[u2l(tag)] = self.placeobj
self.event.place = self.placeobj
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_uid(self,tag):
self.person.setPafUid(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_date(self,tag):
if tag:
if self.address:
@@ -601,51 +481,21 @@ class GrampsParser:
else:
self.event.setDate(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_first(self,tag):
self.name.FirstName = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_families(self,tag):
self.family = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_people(self,tag):
self.person = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_description(self,tag):
self.event.setDescription(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_cause(self,tag):
self.event.setCause(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_gender(self,tag):
t = u2l(tag)
if t == "M":
@@ -655,43 +505,18 @@ class GrampsParser:
else:
self.person.gender = Person.unknown
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_stitle(self,tag):
self.source.setTitle(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_sourceref(self,tag):
self.source_ref = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_source(self,tag):
self.source = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_sauthor(self,tag):
self.source.setAuthor(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_sdate(self,tag):
date = Date()
date.quick_set(u2l(tag))
@@ -712,35 +537,15 @@ class GrampsParser:
def stop_postal(self,tag):
self.address.setPostal(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_spage(self,tag):
self.source_ref.setPage(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_spubinfo(self,tag):
self.source.setPubInfo(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_scallno(self,tag):
self.source.setCallNumber(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_stext(self,tag):
if self.use_p:
self.use_p = 0
@@ -749,11 +554,6 @@ class GrampsParser:
note = u2l(tag)
self.source_ref.setText(note)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_scomments(self,tag):
if self.use_p:
self.use_p = 0
@@ -762,47 +562,22 @@ class GrampsParser:
note = u2l(tag)
self.source_ref.setComments(note)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_last(self,tag):
if self.name:
self.name.Surname = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_suffix(self,tag):
if self.name:
self.name.Suffix = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_title(self,tag):
if self.name:
self.name.Title = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_nick(self,tag):
if self.person:
self.person.setNickName(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_note(self,tag):
self.in_note = 0
if self.use_p:
@@ -835,84 +610,34 @@ class GrampsParser:
self.placeobj.setNote(note)
self.note_list = []
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_research(self,tag):
self.owner.set(self.resname, self.resaddr, self.rescity, self.resstate,
self.rescon, self.respos, self.resphone, self.resemail)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_resname(self,tag):
self.resname = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_resaddr(self,tag):
self.resaddr = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_rescity(self,tag):
self.rescity = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_resstate(self,tag):
self.resstate = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_rescountry(self,tag):
self.rescon = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_respostal(self,tag):
self.respos = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_resphone(self,tag):
self.resphone = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_resemail(self,tag):
self.resemail = u2l(tag)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_ptag(self,tag):
self.use_p = 1
if self.in_note:
@@ -922,11 +647,6 @@ class GrampsParser:
elif self.in_scomments:
self.scomments_list.append(u2l(tag))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def stop_aka(self,tag):
self.person.addAlternateName(self.name)
self.name = None
@@ -970,6 +690,9 @@ class GrampsParser:
"objref" : (start_objref, stop_objref),
"object" : (start_object, stop_object),
"place" : (start_place, stop_place),
+ "dateval" : (start_dateval, None),
+ "daterange" : (start_daterange, None),
+ "datestr" : (start_datestr, None),
"places" : (None, stop_places),
"placeobj" : (start_placeobj,stop_placeobj),
"location" : (start_location,None),
@@ -1004,11 +727,6 @@ class GrampsParser:
"url" : (start_url, None)
}
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def startElement(self,tag,attrs):
self.func_list[self.func_index] = (self.func,self.tlist)
@@ -1023,12 +741,6 @@ class GrampsParser:
GrampsParser.func_map[tag] = (None,None)
self.func = None
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
-
def endElement(self,tag):
if self.func:
@@ -1047,58 +759,28 @@ class GrampsParser:
#-------------------------------------------------------------------------
class GrampsImportParser(GrampsParser):
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_bmark(self,attrs):
person = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.db.bookmarks.append(person)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_person(self,attrs):
if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1
self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_father(self,attrs):
father = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setFather(father)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_mother(self,attrs):
mother = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setMother(mother)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_child(self,attrs):
child = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.addChild(child)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_family(self,attrs):
if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries))
@@ -1107,11 +789,6 @@ class GrampsImportParser(GrampsParser):
if attrs.has_key("type"):
self.family.setRelationship(u2l(attrs["type"]))
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_childof(self,attrs):
family = self.db.findFamily(u2l(attrs["ref"]),self.fmap)
if attrs.has_key("type"):
@@ -1120,11 +797,6 @@ class GrampsImportParser(GrampsParser):
else:
self.person.setMainFamily(family)
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_sourceref(self,attrs):
self.source_ref = SourceRef()
self.source = self.db.findSource(u2l(attrs["ref"]),self.smap)
@@ -1142,11 +814,6 @@ class GrampsImportParser(GrampsParser):
else:
print "Sorry, I'm lost"
- #---------------------------------------------------------------------
- #
- #
- #
- #---------------------------------------------------------------------
def start_source(self,attrs):
self.source = self.db.findSource(u2l(attrs["id"]),self.smap)
diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py
index a8847062c..e9bafbcd3 100644
--- a/gramps/src/ReadXML.py
+++ b/gramps/src/ReadXML.py
@@ -40,6 +40,7 @@ from gnome.ui import GnomeErrorDialog
#-------------------------------------------------------------------------
from RelLib import *
from GrampsParser import GrampsParser, GrampsImportParser
+from xml.parsers.expat import ExpatError
from intl import gettext
_ = gettext
@@ -95,6 +96,9 @@ def importData(database, filename, callback):
try:
parser.parse(xml_file)
+ except ExpatError,msg:
+ errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
+ GnomeErrorDialog(errmsg)
except IOError,msg:
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
import traceback
@@ -152,6 +156,9 @@ def loadData(database, filename, callback=None):
try:
parser.parse(xml_file)
+ except ExpatError,msg:
+ errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
+ GnomeErrorDialog(errmsg)
except IOError,msg:
errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
GnomeErrorDialog(errmsg)
diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py
index a7f2404d5..fcaf6ce68 100644
--- a/gramps/src/WriteXML.py
+++ b/gramps/src/WriteXML.py
@@ -26,6 +26,7 @@ import Config
import time
import shutil
import os
+from Date import SingleDate
try:
import gzip
@@ -116,7 +117,7 @@ def dump_my_event(g,name,event,index=1):
sp = " " * index
g.write('%s\n' % (sp,fix(name),conf_priv(event)))
- write_line(g,"date",date,index+1)
+ write_date(g,event.getDateObj(),index+1)
write_ref(g,"place",place,index+1)
write_line(g,"cause",cause,index+1)
write_line(g,"description",description,index+1)
@@ -195,6 +196,53 @@ def write_line(g,label,value,indent=1):
if value:
g.write('%s<%s>%s%s>\n' % (' '*indent,label,fix(value),label))
+#-------------------------------------------------------------------------
+#
+#
+#
+#-------------------------------------------------------------------------
+def write_line(g,label,value,indent=1):
+ if value:
+ g.write('%s<%s>%s%s>\n' % (' '*indent,label,fix(value),label))
+
+#-------------------------------------------------------------------------
+#
+#
+#
+#-------------------------------------------------------------------------
+def write_date(g,date,indent=1):
+ sp = ' '*indent
+ if date.isEmpty():
+ return
+
+ cal = date.get_calendar()
+ if cal != 0:
+ calstr = 'dpref="%s"' % fix(str(cal))
+ else:
+ calstr = ''
+
+ if date.isRange():
+ d1 = date.get_start_date().getIsoDate()
+ d2 = date.get_stop_date().getIsoDate()
+ g.write('%s\n' % (sp,d1,d2,calstr))
+ elif date.isValid():
+ d1 = date.get_start_date()
+ mode = d1.getModeVal()
+ dstr = d1.getIsoDate()
+
+ if mode == SingleDate.before:
+ pref = ' type="before"'
+ elif mode == SingleDate.after:
+ pref = ' type="after"'
+ elif mode == SingleDate.about:
+ pref = ' type="about"'
+ else:
+ pref = ""
+
+ g.write('%s\n' % (sp,dstr,pref,calstr))
+ else:
+ g.write('%s\n' %(sp,date.getText()))
+
#-------------------------------------------------------------------------
#
#
@@ -318,23 +366,38 @@ def write_url_list(g, list):
g.write('/>\n')
def write_place_obj(g,place):
- title = place.get_title()
+ title = fix(place.get_title())
+ long = place.get_longitude()
+ lat = place.get_latitude()
+ id = place.getId()
+ main_loc = place.get_main_location()
+ llen = len(place.get_alternate_locations()) + len(place.getUrlList()) + \
+ len(place.getPhotoList()) + len(place.getSourceRefList())
+
+ ml_empty = main_loc.is_empty()
+ note = place.getNote()
if title == "":
- title = build_place_title(place.get_main_location())
+ title = fix(build_place_title(place.get_main_location()))
- g.write(' \n' % \
- (place.getId(),fix(title)))
- if place.get_longitude() != "" or place.get_latitude() != "":
- g.write(' \n' % \
- (fix(place.get_longitude()),fix(place.get_latitude())))
- dump_location(g,place.get_main_location())
+ g.write(' 0 or note:
+ g.write('>\n')
+ else:
+ g.write('/>\n')
+ return
+
+ if long or lat:
+ g.write(' \n' % (fix(long),fix(lat)))
+
+ dump_location(g,main_loc)
for loc in place.get_alternate_locations():
dump_location(g,loc)
write_photo_list(g,place.getPhotoList())
write_url_list(g, place.getUrlList())
- if place.getNote() != "":
- write_note(g,"note",place.getNote(),3)
+ if note != "":
+ write_note(g,"note",note,3)
for s in place.getSourceRefList():
dump_source_ref(g,s,3)
g.write(" \n")
@@ -472,7 +535,8 @@ def write_xml_data(database, g, callback, sp):
if len(person.getAddressList()) > 0:
for address in person.getAddressList():
g.write(' \n' % conf_priv(address))
- write_line(g,"date",address.getDateObj().getSaveDate(),4)
+ write_date(g,address.getDateObj(),4)
+# write_line(g,"date",address.getDateObj().getSaveDate(),4)
write_line(g,"street",address.getStreet(),4)
write_line(g,"city",address.getCity(),4)
write_line(g,"state",address.getState(),4)
diff --git a/gramps/src/config.glade b/gramps/src/config.glade
index 4709569fe..0207c5b1d 100644
--- a/gramps/src/config.glade
+++ b/gramps/src/config.glade
@@ -586,6 +586,66 @@
+
+ GtkFrame
+ frame10
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 5
+ True
+ True
+
+
+
+ GtkVBox
+ vbox28
+ False
+ 0
+
+
+ GtkCheckButton
+ calendar
+ True
+
+ toggled
+ on_object_toggled
+
+ Tue, 20 Nov 2001 16:35:48 GMT
+
+
+ False
+ True
+
+ 5
+ False
+ False
+
+
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label187
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkVBox
+ vbox27
+ False
+ 0
+
GtkFrame
frame9
@@ -601,8 +661,8 @@
GtkTable
table28
- 3
- 4
+ 5
+ 2
False
0
0
@@ -663,36 +723,6 @@
-
- GtkEntry
- sprefix
- True
-
- changed
- on_object_toggled
-
- Sat, 20 Oct 2001 14:00:46 GMT
-
- True
- True
- 0
- S
-
- 3
- 4
- 0
- 1
- 2
- 2
- True
- False
- False
- False
- True
- False
-
-
-
GtkEntry
fprefix
@@ -723,36 +753,6 @@
-
- GtkEntry
- oprefix
- True
-
- changed
- on_object_toggled
-
- Sat, 20 Oct 2001 14:01:09 GMT
-
- True
- True
- 0
- O
-
- 3
- 4
- 1
- 2
- 2
- 2
- True
- False
- False
- False
- True
- False
-
-
-
GtkEntry
pprefix
@@ -846,10 +846,10 @@
2
2
- 2
- 3
- 0
- 1
+ 0
+ 1
+ 3
+ 4
0
0
False
@@ -861,6 +861,36 @@
+
+ GtkEntry
+ sprefix
+ True
+
+ changed
+ on_object_toggled
+
+ Sat, 20 Oct 2001 14:00:46 GMT
+
+ True
+ True
+ 0
+ S
+
+ 1
+ 2
+ 3
+ 4
+ 0
+ 0
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
GtkLabel
label214
@@ -872,10 +902,10 @@
2
2
- 2
- 3
- 1
- 2
+ 0
+ 1
+ 4
+ 5
0
0
False
@@ -886,15 +916,53 @@
False
+
+
+ GtkEntry
+ oprefix
+ True
+
+ changed
+ on_object_toggled
+
+ Sat, 20 Oct 2001 14:01:09 GMT
+
+ True
+ True
+ 0
+ O
+
+ 1
+ 2
+ 4
+ 5
+ 0
+ 0
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ Placeholder
+
+
+
+ Placeholder
+
GtkLabel
Notebook:tab
- label187
-
+ label216
+
GTK_JUSTIFY_CENTER
False
0.5
diff --git a/gramps/src/dialog.glade b/gramps/src/dialog.glade
index 5badd36be..d2c368b1c 100644
--- a/gramps/src/dialog.glade
+++ b/gramps/src/dialog.glade
@@ -363,30 +363,6 @@
-
- GtkEntry
- eventDate
- True
- True
- True
- 0
-
-
- 1
- 2
- 1
- 2
- 3
- 3
- True
- False
- False
- False
- True
- False
-
-
-
GtkScrolledWindow
scrolledwindow21
@@ -551,6 +527,61 @@
False
+
+
+ GtkHBox
+ hbox27
+ False
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ True
+
+
+
+ GtkEntry
+ eventDate
+ True
+ True
+ True
+ 0
+
+
+ 0
+ True
+ True
+
+
+
+
+ GtkOptionMenu
+ calendar
+ False
+ Selects the calendar format for display
+ True
+ Gregorian
+Julian
+Hebrew
+French
+
+ 0
+
+ 0
+ False
+ False
+
+
+
diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py
index 078c75142..b3acd5138 100644
--- a/gramps/src/plugins/ReadGedcom.py
+++ b/gramps/src/plugins/ReadGedcom.py
@@ -166,6 +166,7 @@ class GedcomParser:
self.placemap = {}
self.broken_conc_list = [ 'FamilyOrigins', 'FTW' ]
self.broken_conc = 0
+ self.is_ftw = 0
self.f = open(file,"r")
self.index = 0