New date format in XML files

svn: r575
This commit is contained in:
Don Allingham 2001-11-21 01:16:32 +00:00
parent 86c2e81ad1
commit ef85983963
10 changed files with 511 additions and 572 deletions

View File

@ -105,6 +105,7 @@ nameof = utils.normal_name
display_attr = 0 display_attr = 0
attr_name = "" attr_name = ""
status_bar = 0 status_bar = 0
calendar = 0
paper_preference = None paper_preference = None
output_preference = None output_preference = None
report_dir = "./" report_dir = "./"
@ -157,6 +158,7 @@ def loadConfig(call):
global autoload global autoload
global owner global owner
global usetabs global usetabs
global calendar
global usevc global usevc
global iprefix global iprefix
global fprefix global fprefix
@ -187,6 +189,7 @@ def loadConfig(call):
_callback = call _callback = call
lastfile = get_string("/gramps/data/LastFile") lastfile = get_string("/gramps/data/LastFile")
usetabs = get_bool("/gramps/config/UseTabs") usetabs = get_bool("/gramps/config/UseTabs")
calendar = get_bool("/gramps/config/ShowCalendar")
usevc = get_bool("/gramps/config/UseVersionControl") usevc = get_bool("/gramps/config/UseVersionControl")
vc_comment = get_bool("/gramps/config/UseComment") vc_comment = get_bool("/gramps/config/UseComment")
uncompress = get_bool("/gramps/config/DontCompressXML") uncompress = get_bool("/gramps/config/DontCompressXML")
@ -279,6 +282,8 @@ def loadConfig(call):
autoload = 1 autoload = 1
if usetabs == None: if usetabs == None:
usetabs = 0 usetabs = 0
if calendar == None:
calendar = 0
if usevc == None: if usevc == None:
usevc = 0 usevc = 0
if vc_comment == None: if vc_comment == None:
@ -390,6 +395,7 @@ def on_propertybox_apply(obj,page):
global nameof global nameof
global owner global owner
global usetabs global usetabs
global calendar
global usevc global usevc
global iprefix global iprefix
global fprefix global fprefix
@ -420,6 +426,7 @@ def on_propertybox_apply(obj,page):
display_attr = prefsTop.get_widget("attr_display").get_active() display_attr = prefsTop.get_widget("attr_display").get_active()
attr_name = string.strip(prefsTop.get_widget("attr_name").get_text()) attr_name = string.strip(prefsTop.get_widget("attr_name").get_text())
usetabs = prefsTop.get_widget("usetabs").get_active() usetabs = prefsTop.get_widget("usetabs").get_active()
calendar = prefsTop.get_widget("calendar").get_active()
usevc = prefsTop.get_widget("use_vc").get_active() usevc = prefsTop.get_widget("use_vc").get_active()
vc_comment = prefsTop.get_widget("vc_comment").get_active() vc_comment = prefsTop.get_widget("vc_comment").get_active()
uncompress = prefsTop.get_widget("uncompress").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) output_preference = output_obj.get_data(DATA)
set_bool("/gramps/config/UseTabs",usetabs) set_bool("/gramps/config/UseTabs",usetabs)
set_bool("/gramps/config/ShowCalendar",calendar)
set_bool("/gramps/config/UseVersionControl",usevc) set_bool("/gramps/config/UseVersionControl",usevc)
set_bool("/gramps/config/UseComment",vc_comment) set_bool("/gramps/config/UseComment",vc_comment)
set_bool("/gramps/config/DontCompressXML",uncompress) set_bool("/gramps/config/DontCompressXML",uncompress)
@ -631,6 +639,7 @@ def display_preferences_box(db):
idedit = prefsTop.get_widget("gid_edit") idedit = prefsTop.get_widget("gid_edit")
index_vis = prefsTop.get_widget("show_child_id") index_vis = prefsTop.get_widget("show_child_id")
tabs = prefsTop.get_widget("usetabs") tabs = prefsTop.get_widget("usetabs")
cal = prefsTop.get_widget("calendar")
vc = prefsTop.get_widget("use_vc") vc = prefsTop.get_widget("use_vc")
vcom = prefsTop.get_widget("vc_comment") vcom = prefsTop.get_widget("vc_comment")
compress = prefsTop.get_widget("uncompress") compress = prefsTop.get_widget("uncompress")
@ -640,6 +649,7 @@ def display_preferences_box(db):
auto.set_active(autoload) auto.set_active(autoload)
detail.set_active(show_detail) detail.set_active(show_detail)
tabs.set_active(usetabs) tabs.set_active(usetabs)
cal.set_active(calendar)
vc.set_active(usevc) vc.set_active(usevc)
vcom.set_active(vc_comment) vcom.set_active(vc_comment)
compress.set_active(uncompress) compress.set_active(uncompress)

View File

@ -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: class Date:
@ -59,11 +75,19 @@ class Date:
self.stop = None self.stop = None
self.range = source.range self.range = source.range
self.text = source.text self.text = source.text
self.calendar = source.calendar
else: else:
self.start = SingleDate() self.start = SingleDate()
self.stop = None self.stop = None
self.range = 0 self.range = 0
self.text = "" 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): def get_start_date(self):
return self.start return self.start
@ -106,6 +130,9 @@ class Date:
self.stop = SingleDate() self.stop = SingleDate()
return self.get_stop_date().getDay() return self.get_stop_date().getDay()
def getText(self):
return self.text
def greater_than(self,other): def greater_than(self,other):
return compare_dates(self,other) > 0 return compare_dates(self,other) > 0
@ -115,11 +142,6 @@ class Date:
def equal_to(self,other): def equal_to(self,other):
return compare_dates(self,other) == 0 return compare_dates(self,other) == 0
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def set(self,text): def set(self,text):
match = Date.fmt.match(text) match = Date.fmt.match(text)
try: try:
@ -137,24 +159,19 @@ class Date:
self.range = -1 self.range = -1
self.text = text self.text = text
#-------------------------------------------------------------------- def set_range(self,val):
# self.range = val
#
#
#--------------------------------------------------------------------
def getDate(self): def getDate(self):
if self.range == 0: if self.range == 0:
return _func(self.start) return _func(self.start)
elif self.range == -1: elif self.range == -1:
return self.text return self.text
else: 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): def getQuoteDate(self):
if self.range == 0: if self.range == 0:
return _func(self.start) return _func(self.start)
@ -164,16 +181,15 @@ class Date:
else: else:
return '' return ''
else: 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): def getSaveDate(self):
if self.range == 1: 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: elif self.range == -1:
return self.text return self.text
else: else:
@ -192,16 +208,11 @@ class Date:
return 1 return 1
def isRange(self): def isRange(self):
if self.range == -1: if self.range == 1:
return 0
else:
return 1 return 1
else:
return 0
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def quick_set(self,text): def quick_set(self,text):
try: try:
match = Date.efmt.match(text) match = Date.efmt.match(text)
@ -455,14 +466,27 @@ class SingleDate:
except KeyError: except KeyError:
self.month = -1 self.month = -1
#--------------------------------------------------------------------
#
#
#
#--------------------------------------------------------------------
def getMonthStr(self): def getMonthStr(self):
return SingleDate.mname[self.month] 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 retval = "ABT %s" % retval
if self.mode == SingleDate.before: if self.mode == SingleDate.before:
retval = _("BEFORE") + " " + retval retval = "BEFORE" + " " + retval
elif self.mode == SingleDate.after: elif self.mode == SingleDate.after:
retval = _("AFTER") + " " + retval retval = "AFTER" + " " + retval
return retval return retval
@ -831,6 +855,33 @@ class SingleDate:
function = SingleDate.fmtFunc[Date.formatCode] function = SingleDate.fmtFunc[Date.formatCode]
return function(self) 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): def getMode(self,val):
if val == None: if val == None:
self.mode = SingleDate.exact self.mode = SingleDate.exact
elif string.lower(val)[0:3] == "bef": elif string.lower(val)[0:2] == "be":
self.mode = SingleDate.before self.mode = SingleDate.before
elif string.lower(val)[0:3] == "aft": elif string.lower(val)[0:2] == "af":
self.mode = SingleDate.after self.mode = SingleDate.after
else: elif string.lower(val)[0:2] == "ab":
self.mode = SingleDate.about self.mode = SingleDate.about
else:
self.mode = SingleDate.exact
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #

View File

@ -233,31 +233,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>birthDate</name>
<width>250</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label25</name> <name>label25</name>
@ -380,6 +355,31 @@
<text></text> <text></text>
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>birthDate</name>
<width>250</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget> </widget>
</widget> </widget>
@ -4762,31 +4762,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>address_start</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label215</name> <name>label215</name>
@ -4936,6 +4911,62 @@
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkHBox</class>
<name>hbox36</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkEntry</class>
<name>address_start</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>calendar</name>
<visible>False</visible>
<tooltip>Selects the calendar format for display</tooltip>
<can_focus>True</can_focus>
<items>Gregorian
Julian
Hebrew
French
</items>
<initial_choice>0</initial_choice>
<child>
<padding>3</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>

View File

@ -35,6 +35,7 @@ import libglade
import Sources import Sources
import const import const
import utils import utils
import Config
from RelLib import * from RelLib import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -64,6 +65,12 @@ class EventEditor:
self.note_field = self.top.get_widget("eventNote") self.note_field = self.top.get_widget("eventNote")
self.event_menu = self.top.get_widget("personalEvents") self.event_menu = self.top.get_widget("personalEvents")
self.priv = self.top.get_widget("priv") 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.top.get_widget("eventTitle").set_text(name)
self.event_menu.set_popdown_strings(list) self.event_menu.set_popdown_strings(list)

View File

@ -19,6 +19,7 @@
# #
from RelLib import * from RelLib import *
from Date import SingleDate
import string import string
import utils import utils
@ -51,12 +52,6 @@ def fix_spaces(text_list):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class GrampsParser: class GrampsParser:
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def __init__(self,database,callback,base): def __init__(self,database,callback,base):
self.stext_list = [] self.stext_list = []
self.scomments_list = [] self.scomments_list = []
@ -115,6 +110,7 @@ class GrampsParser:
p.EndElementHandler = self.endElement p.EndElementHandler = self.endElement
p.CharacterDataHandler = self.characters p.CharacterDataHandler = self.characters
p.ParseFile(file) p.ParseFile(file)
self.db.setResearcher(self.owner) self.db.setResearcher(self.owner)
if self.tempDefault != None: if self.tempDefault != None:
id = self.tempDefault id = self.tempDefault
@ -151,22 +147,12 @@ class GrampsParser:
self.placeobj.set_main_location(loc) self.placeobj.set_main_location(loc)
self.locations = self.locations + 1 self.locations = self.locations + 1
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_coord(self,attrs): def start_coord(self,attrs):
if attrs.has_key('lat'): if attrs.has_key('lat'):
self.placeobj.set_latitude(u2l(attrs['lat'])) self.placeobj.set_latitude(u2l(attrs['lat']))
if attrs.has_key('long'): if attrs.has_key('long'):
self.placeobj.set_longitude(u2l(attrs['long'])) self.placeobj.set_longitude(u2l(attrs['long']))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_event(self,attrs): def start_event(self,attrs):
self.event = Event() self.event = Event()
self.event_type = u2l(attrs["type"]) self.event_type = u2l(attrs["type"])
@ -177,11 +163,6 @@ class GrampsParser:
if attrs.has_key("priv"): if attrs.has_key("priv"):
self.event.private = int(attrs["priv"]) self.event.private = int(attrs["priv"])
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_attribute(self,attrs): def start_attribute(self,attrs):
self.attribute = Attribute() self.attribute = Attribute()
if attrs.has_key("conf"): if attrs.has_key("conf"):
@ -205,11 +186,6 @@ class GrampsParser:
elif self.family: elif self.family:
self.family.addAttribute(self.attribute) self.family.addAttribute(self.attribute)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_address(self,attrs): def start_address(self,attrs):
self.address = Address() self.address = Address()
self.person.addAddress(self.address) self.person.addAddress(self.address)
@ -220,64 +196,29 @@ class GrampsParser:
if attrs.has_key("priv"): if attrs.has_key("priv"):
self.address.private = int(attrs["priv"]) self.address.private = int(attrs["priv"])
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_bmark(self,attrs): def start_bmark(self,attrs):
person = self.db.findPersonNoMap(u2l(attrs["ref"])) person = self.db.findPersonNoMap(u2l(attrs["ref"]))
self.db.bookmarks.append(person) self.db.bookmarks.append(person)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_person(self,attrs): def start_person(self,attrs):
if self.callback != None and self.count % self.increment == 0: if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.person = self.db.findPersonNoMap(u2l(attrs["id"])) self.person = self.db.findPersonNoMap(u2l(attrs["id"]))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_people(self,attrs): def start_people(self,attrs):
if attrs.has_key("default"): if attrs.has_key("default"):
self.tempDefault = u2l(attrs["default"]) self.tempDefault = u2l(attrs["default"])
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_father(self,attrs): def start_father(self,attrs):
self.family.Father = self.db.findPersonNoMap(u2l(attrs["ref"])) self.family.Father = self.db.findPersonNoMap(u2l(attrs["ref"]))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_mother(self,attrs): def start_mother(self,attrs):
self.family.Mother = self.db.findPersonNoMap(u2l(attrs["ref"])) self.family.Mother = self.db.findPersonNoMap(u2l(attrs["ref"]))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_child(self,attrs): def start_child(self,attrs):
self.family.Children.append(self.db.findPersonNoMap(u2l(attrs["ref"]))) self.family.Children.append(self.db.findPersonNoMap(u2l(attrs["ref"])))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_url(self,attrs): def start_url(self,attrs):
if not attrs.has_key("href"): if not attrs.has_key("href"):
@ -300,11 +241,6 @@ class GrampsParser:
except KeyError: except KeyError:
return return
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_family(self,attrs): def start_family(self,attrs):
if self.callback != None and self.count % self.increment == 0: if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
@ -315,11 +251,6 @@ class GrampsParser:
else: else:
self.family.setRelationship("") self.family.setRelationship("")
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_childof(self,attrs): def start_childof(self,attrs):
family = self.db.findFamilyNoMap(u2l(attrs["ref"])) family = self.db.findFamilyNoMap(u2l(attrs["ref"]))
if len(attrs) == 1: if len(attrs) == 1:
@ -340,19 +271,9 @@ class GrampsParser:
type = u2l(attrs["type"]) type = u2l(attrs["type"])
self.person.AltFamilyList.append((family,type,type)) self.person.AltFamilyList.append((family,type,type))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_parentin(self,attrs): def start_parentin(self,attrs):
self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"]))) self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"])))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_name(self,attrs): def start_name(self,attrs):
self.name = Name() self.name = Name()
if attrs.has_key("conf"): if attrs.has_key("conf"):
@ -362,19 +283,9 @@ class GrampsParser:
if attrs.has_key("priv"): if attrs.has_key("priv"):
self.name.private = int(attrs["priv"]) self.name.private = int(attrs["priv"])
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_note(self,attrs): def start_note(self,attrs):
self.in_note = 1 self.in_note = 1
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_sourceref(self,attrs): def start_sourceref(self,attrs):
self.source_ref = SourceRef() self.source_ref = SourceRef()
source = self.db.findSourceNoMap(u2l(attrs["ref"])) source = self.db.findSourceNoMap(u2l(attrs["ref"]))
@ -398,11 +309,6 @@ class GrampsParser:
elif self.placeobj: elif self.placeobj:
self.placeobj.addSourceRef(self.source_ref) self.placeobj.addSourceRef(self.source_ref)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_source(self,attrs): def start_source(self,attrs):
self.source = self.db.findSourceNoMap(u2l(attrs["id"])) self.source = self.db.findSourceNoMap(u2l(attrs["id"]))
@ -438,11 +344,6 @@ class GrampsParser:
def stop_objref(self,tag): def stop_objref(self,tag):
self.objref = None self.objref = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_photo(self,attrs): def start_photo(self,attrs):
self.photo = Photo() self.photo = Photo()
self.pref = ObjectRef() self.pref = ObjectRef()
@ -477,51 +378,55 @@ class GrampsParser:
elif self.placeobj: elif self.placeobj:
self.placeobj.addPhoto(self.pref) 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): def start_created(self,attrs):
self.entries = int(attrs["people"]) + int(attrs["families"]) self.entries = int(attrs["people"]) + int(attrs["families"])
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_pos(self,attrs): def start_pos(self,attrs):
self.person.position = (int(attrs["x"]), int(attrs["y"])) self.person.position = (int(attrs["x"]), int(attrs["y"]))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_attribute(self,tag): def stop_attribute(self,tag):
self.attribute = None self.attribute = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_attr_type(self,tag): def stop_attr_type(self,tag):
self.attribute.setType(u2l(tag)) self.attribute.setType(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_attr_value(self,tag): def stop_attr_value(self,tag):
self.attribute.setValue(u2l(tag)) self.attribute.setValue(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_address(self,tag): def stop_address(self,tag):
self.address = None self.address = None
@ -537,11 +442,6 @@ class GrampsParser:
self.placeobj.set_title(build_place_title(loc)) self.placeobj.set_title(build_place_title(loc))
self.palceobj = None self.palceobj = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_event(self,tag): def stop_event(self,tag):
self.event.name = self.event_type self.event.name = self.event_type
@ -556,20 +456,10 @@ class GrampsParser:
self.person.EventList.append(self.event) self.person.EventList.append(self.event)
self.event = None self.event = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_name(self,tag): def stop_name(self,tag):
self.person.PrimaryName = self.name self.person.PrimaryName = self.name
self.name = None self.name = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_place(self,tag): def stop_place(self,tag):
if self.placeobj == None: if self.placeobj == None:
if self.place_map.has_key(u2l(tag)): if self.place_map.has_key(u2l(tag)):
@ -581,19 +471,9 @@ class GrampsParser:
self.place_map[u2l(tag)] = self.placeobj self.place_map[u2l(tag)] = self.placeobj
self.event.place = self.placeobj self.event.place = self.placeobj
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_uid(self,tag): def stop_uid(self,tag):
self.person.setPafUid(u2l(tag)) self.person.setPafUid(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_date(self,tag): def stop_date(self,tag):
if tag: if tag:
if self.address: if self.address:
@ -601,51 +481,21 @@ class GrampsParser:
else: else:
self.event.setDate(u2l(tag)) self.event.setDate(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_first(self,tag): def stop_first(self,tag):
self.name.FirstName = u2l(tag) self.name.FirstName = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_families(self,tag): def stop_families(self,tag):
self.family = None self.family = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_people(self,tag): def stop_people(self,tag):
self.person = None self.person = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_description(self,tag): def stop_description(self,tag):
self.event.setDescription(u2l(tag)) self.event.setDescription(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_cause(self,tag): def stop_cause(self,tag):
self.event.setCause(u2l(tag)) self.event.setCause(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_gender(self,tag): def stop_gender(self,tag):
t = u2l(tag) t = u2l(tag)
if t == "M": if t == "M":
@ -655,43 +505,18 @@ class GrampsParser:
else: else:
self.person.gender = Person.unknown self.person.gender = Person.unknown
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_stitle(self,tag): def stop_stitle(self,tag):
self.source.setTitle(u2l(tag)) self.source.setTitle(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_sourceref(self,tag): def stop_sourceref(self,tag):
self.source_ref = None self.source_ref = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_source(self,tag): def stop_source(self,tag):
self.source = None self.source = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_sauthor(self,tag): def stop_sauthor(self,tag):
self.source.setAuthor(u2l(tag)) self.source.setAuthor(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_sdate(self,tag): def stop_sdate(self,tag):
date = Date() date = Date()
date.quick_set(u2l(tag)) date.quick_set(u2l(tag))
@ -712,35 +537,15 @@ class GrampsParser:
def stop_postal(self,tag): def stop_postal(self,tag):
self.address.setPostal(u2l(tag)) self.address.setPostal(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_spage(self,tag): def stop_spage(self,tag):
self.source_ref.setPage(u2l(tag)) self.source_ref.setPage(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_spubinfo(self,tag): def stop_spubinfo(self,tag):
self.source.setPubInfo(u2l(tag)) self.source.setPubInfo(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_scallno(self,tag): def stop_scallno(self,tag):
self.source.setCallNumber(u2l(tag)) self.source.setCallNumber(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_stext(self,tag): def stop_stext(self,tag):
if self.use_p: if self.use_p:
self.use_p = 0 self.use_p = 0
@ -749,11 +554,6 @@ class GrampsParser:
note = u2l(tag) note = u2l(tag)
self.source_ref.setText(note) self.source_ref.setText(note)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_scomments(self,tag): def stop_scomments(self,tag):
if self.use_p: if self.use_p:
self.use_p = 0 self.use_p = 0
@ -762,47 +562,22 @@ class GrampsParser:
note = u2l(tag) note = u2l(tag)
self.source_ref.setComments(note) self.source_ref.setComments(note)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_last(self,tag): def stop_last(self,tag):
if self.name: if self.name:
self.name.Surname = u2l(tag) self.name.Surname = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_suffix(self,tag): def stop_suffix(self,tag):
if self.name: if self.name:
self.name.Suffix = u2l(tag) self.name.Suffix = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_title(self,tag): def stop_title(self,tag):
if self.name: if self.name:
self.name.Title = u2l(tag) self.name.Title = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_nick(self,tag): def stop_nick(self,tag):
if self.person: if self.person:
self.person.setNickName(u2l(tag)) self.person.setNickName(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_note(self,tag): def stop_note(self,tag):
self.in_note = 0 self.in_note = 0
if self.use_p: if self.use_p:
@ -835,84 +610,34 @@ class GrampsParser:
self.placeobj.setNote(note) self.placeobj.setNote(note)
self.note_list = [] self.note_list = []
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_research(self,tag): def stop_research(self,tag):
self.owner.set(self.resname, self.resaddr, self.rescity, self.resstate, self.owner.set(self.resname, self.resaddr, self.rescity, self.resstate,
self.rescon, self.respos, self.resphone, self.resemail) self.rescon, self.respos, self.resphone, self.resemail)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_resname(self,tag): def stop_resname(self,tag):
self.resname = u2l(tag) self.resname = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_resaddr(self,tag): def stop_resaddr(self,tag):
self.resaddr = u2l(tag) self.resaddr = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_rescity(self,tag): def stop_rescity(self,tag):
self.rescity = u2l(tag) self.rescity = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_resstate(self,tag): def stop_resstate(self,tag):
self.resstate = u2l(tag) self.resstate = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_rescountry(self,tag): def stop_rescountry(self,tag):
self.rescon = u2l(tag) self.rescon = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_respostal(self,tag): def stop_respostal(self,tag):
self.respos = u2l(tag) self.respos = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_resphone(self,tag): def stop_resphone(self,tag):
self.resphone = u2l(tag) self.resphone = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_resemail(self,tag): def stop_resemail(self,tag):
self.resemail = u2l(tag) self.resemail = u2l(tag)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_ptag(self,tag): def stop_ptag(self,tag):
self.use_p = 1 self.use_p = 1
if self.in_note: if self.in_note:
@ -922,11 +647,6 @@ class GrampsParser:
elif self.in_scomments: elif self.in_scomments:
self.scomments_list.append(u2l(tag)) self.scomments_list.append(u2l(tag))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def stop_aka(self,tag): def stop_aka(self,tag):
self.person.addAlternateName(self.name) self.person.addAlternateName(self.name)
self.name = None self.name = None
@ -970,6 +690,9 @@ class GrampsParser:
"objref" : (start_objref, stop_objref), "objref" : (start_objref, stop_objref),
"object" : (start_object, stop_object), "object" : (start_object, stop_object),
"place" : (start_place, stop_place), "place" : (start_place, stop_place),
"dateval" : (start_dateval, None),
"daterange" : (start_daterange, None),
"datestr" : (start_datestr, None),
"places" : (None, stop_places), "places" : (None, stop_places),
"placeobj" : (start_placeobj,stop_placeobj), "placeobj" : (start_placeobj,stop_placeobj),
"location" : (start_location,None), "location" : (start_location,None),
@ -1004,11 +727,6 @@ class GrampsParser:
"url" : (start_url, None) "url" : (start_url, None)
} }
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def startElement(self,tag,attrs): def startElement(self,tag,attrs):
self.func_list[self.func_index] = (self.func,self.tlist) self.func_list[self.func_index] = (self.func,self.tlist)
@ -1023,12 +741,6 @@ class GrampsParser:
GrampsParser.func_map[tag] = (None,None) GrampsParser.func_map[tag] = (None,None)
self.func = None self.func = None
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def endElement(self,tag): def endElement(self,tag):
if self.func: if self.func:
@ -1047,58 +759,28 @@ class GrampsParser:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class GrampsImportParser(GrampsParser): class GrampsImportParser(GrampsParser):
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_bmark(self,attrs): def start_bmark(self,attrs):
person = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap) person = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.db.bookmarks.append(person) self.db.bookmarks.append(person)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_person(self,attrs): def start_person(self,attrs):
if self.callback != None and self.count % self.increment == 0: if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap) self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_father(self,attrs): def start_father(self,attrs):
father = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap) father = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setFather(father) self.family.setFather(father)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_mother(self,attrs): def start_mother(self,attrs):
mother = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap) mother = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setMother(mother) self.family.setMother(mother)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_child(self,attrs): def start_child(self,attrs):
child = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap) child = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.addChild(child) self.family.addChild(child)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_family(self,attrs): def start_family(self,attrs):
if self.callback != None and self.count % self.increment == 0: if self.callback != None and self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
@ -1107,11 +789,6 @@ class GrampsImportParser(GrampsParser):
if attrs.has_key("type"): if attrs.has_key("type"):
self.family.setRelationship(u2l(attrs["type"])) self.family.setRelationship(u2l(attrs["type"]))
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_childof(self,attrs): def start_childof(self,attrs):
family = self.db.findFamily(u2l(attrs["ref"]),self.fmap) family = self.db.findFamily(u2l(attrs["ref"]),self.fmap)
if attrs.has_key("type"): if attrs.has_key("type"):
@ -1120,11 +797,6 @@ class GrampsImportParser(GrampsParser):
else: else:
self.person.setMainFamily(family) self.person.setMainFamily(family)
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_sourceref(self,attrs): def start_sourceref(self,attrs):
self.source_ref = SourceRef() self.source_ref = SourceRef()
self.source = self.db.findSource(u2l(attrs["ref"]),self.smap) self.source = self.db.findSource(u2l(attrs["ref"]),self.smap)
@ -1142,11 +814,6 @@ class GrampsImportParser(GrampsParser):
else: else:
print "Sorry, I'm lost" print "Sorry, I'm lost"
#---------------------------------------------------------------------
#
#
#
#---------------------------------------------------------------------
def start_source(self,attrs): def start_source(self,attrs):
self.source = self.db.findSource(u2l(attrs["id"]),self.smap) self.source = self.db.findSource(u2l(attrs["id"]),self.smap)

View File

@ -40,6 +40,7 @@ from gnome.ui import GnomeErrorDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * from RelLib import *
from GrampsParser import GrampsParser, GrampsImportParser from GrampsParser import GrampsParser, GrampsImportParser
from xml.parsers.expat import ExpatError
from intl import gettext from intl import gettext
_ = gettext _ = gettext
@ -95,6 +96,9 @@ def importData(database, filename, callback):
try: try:
parser.parse(xml_file) parser.parse(xml_file)
except ExpatError,msg:
errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
GnomeErrorDialog(errmsg)
except IOError,msg: except IOError,msg:
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg)) GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
import traceback import traceback
@ -152,6 +156,9 @@ def loadData(database, filename, callback=None):
try: try:
parser.parse(xml_file) parser.parse(xml_file)
except ExpatError,msg:
errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
GnomeErrorDialog(errmsg)
except IOError,msg: except IOError,msg:
errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg)) errmsg = "%s\n%s" % (_("Error reading %s") % filename,str(msg))
GnomeErrorDialog(errmsg) GnomeErrorDialog(errmsg)

View File

@ -26,6 +26,7 @@ import Config
import time import time
import shutil import shutil
import os import os
from Date import SingleDate
try: try:
import gzip import gzip
@ -116,7 +117,7 @@ def dump_my_event(g,name,event,index=1):
sp = " " * index sp = " " * index
g.write('%s<event type="%s"%s>\n' % (sp,fix(name),conf_priv(event))) g.write('%s<event type="%s"%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_ref(g,"place",place,index+1)
write_line(g,"cause",cause,index+1) write_line(g,"cause",cause,index+1)
write_line(g,"description",description,index+1) write_line(g,"description",description,index+1)
@ -195,6 +196,53 @@ def write_line(g,label,value,indent=1):
if value: if value:
g.write('%s<%s>%s</%s>\n' % (' '*indent,label,fix(value),label)) 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<daterange start="%s" stop="%s"%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<dateval val="%s"%s%s/>\n' % (sp,dstr,pref,calstr))
else:
g.write('%s<datestr val="%s"/>\n' %(sp,date.getText()))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #
@ -318,23 +366,38 @@ def write_url_list(g, list):
g.write('/>\n') g.write('/>\n')
def write_place_obj(g,place): 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 == "": if title == "":
title = build_place_title(place.get_main_location()) title = fix(build_place_title(place.get_main_location()))
g.write(' <placeobj id="%s" title="%s">\n' % \ g.write(' <placeobj id="%s" title="%s"' % (id,title))
(place.getId(),fix(title)))
if place.get_longitude() != "" or place.get_latitude() != "": if long or lat or not ml_empty or llen > 0 or note:
g.write(' <coord long="%s" lat=%s"/>\n' % \ g.write('>\n')
(fix(place.get_longitude()),fix(place.get_latitude()))) else:
dump_location(g,place.get_main_location()) g.write('/>\n')
return
if long or lat:
g.write(' <coord long="%s" lat=%s"/>\n' % (fix(long),fix(lat)))
dump_location(g,main_loc)
for loc in place.get_alternate_locations(): for loc in place.get_alternate_locations():
dump_location(g,loc) dump_location(g,loc)
write_photo_list(g,place.getPhotoList()) write_photo_list(g,place.getPhotoList())
write_url_list(g, place.getUrlList()) write_url_list(g, place.getUrlList())
if place.getNote() != "": if note != "":
write_note(g,"note",place.getNote(),3) write_note(g,"note",note,3)
for s in place.getSourceRefList(): for s in place.getSourceRefList():
dump_source_ref(g,s,3) dump_source_ref(g,s,3)
g.write(" </placeobj>\n") g.write(" </placeobj>\n")
@ -472,7 +535,8 @@ def write_xml_data(database, g, callback, sp):
if len(person.getAddressList()) > 0: if len(person.getAddressList()) > 0:
for address in person.getAddressList(): for address in person.getAddressList():
g.write(' <address%s>\n' % conf_priv(address)) g.write(' <address%s>\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,"street",address.getStreet(),4)
write_line(g,"city",address.getCity(),4) write_line(g,"city",address.getCity(),4)
write_line(g,"state",address.getState(),4) write_line(g,"state",address.getState(),4)

View File

@ -586,6 +586,66 @@
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkFrame</class>
<name>frame10</name>
<label>Calendars</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>5</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox28</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkCheckButton</class>
<name>calendar</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Tue, 20 Nov 2001 16:35:48 GMT</last_modification_time>
</signal>
<label>Show calendar format selection menu</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label187</name>
<label>Dates</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox27</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>frame9</name> <name>frame9</name>
@ -601,8 +661,8 @@
<widget> <widget>
<class>GtkTable</class> <class>GtkTable</class>
<name>table28</name> <name>table28</name>
<rows>3</rows> <rows>5</rows>
<columns>4</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>0</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>0</column_spacing>
@ -663,36 +723,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>sprefix</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Sat, 20 Oct 2001 14:00:46 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>S</text>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>2</xpad>
<ypad>2</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkEntry</class> <class>GtkEntry</class>
<name>fprefix</name> <name>fprefix</name>
@ -723,36 +753,6 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>oprefix</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Sat, 20 Oct 2001 14:01:09 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>O</text>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>2</xpad>
<ypad>2</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkEntry</class> <class>GtkEntry</class>
<name>pprefix</name> <name>pprefix</name>
@ -846,10 +846,10 @@
<xpad>2</xpad> <xpad>2</xpad>
<ypad>2</ypad> <ypad>2</ypad>
<child> <child>
<left_attach>2</left_attach> <left_attach>0</left_attach>
<right_attach>3</right_attach> <right_attach>1</right_attach>
<top_attach>0</top_attach> <top_attach>3</top_attach>
<bottom_attach>1</bottom_attach> <bottom_attach>4</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
@ -861,6 +861,36 @@
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>sprefix</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Sat, 20 Oct 2001 14:00:46 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>S</text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label214</name> <name>label214</name>
@ -872,10 +902,10 @@
<xpad>2</xpad> <xpad>2</xpad>
<ypad>2</ypad> <ypad>2</ypad>
<child> <child>
<left_attach>2</left_attach> <left_attach>0</left_attach>
<right_attach>3</right_attach> <right_attach>1</right_attach>
<top_attach>1</top_attach> <top_attach>4</top_attach>
<bottom_attach>2</bottom_attach> <bottom_attach>5</bottom_attach>
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<xexpand>False</xexpand> <xexpand>False</xexpand>
@ -886,15 +916,53 @@
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>oprefix</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Sat, 20 Oct 2001 14:01:09 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>O</text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget> </widget>
</widget> </widget>
</widget> </widget>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<child_name>Notebook:tab</child_name> <child_name>Notebook:tab</child_name>
<name>label187</name> <name>label216</name>
<label>Formats</label> <label>GRAMPS ID</label>
<justify>GTK_JUSTIFY_CENTER</justify> <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap> <wrap>False</wrap>
<xalign>0.5</xalign> <xalign>0.5</xalign>

View File

@ -363,30 +363,6 @@
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkEntry</class>
<name>eventDate</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget> <widget>
<class>GtkScrolledWindow</class> <class>GtkScrolledWindow</class>
<name>scrolledwindow21</name> <name>scrolledwindow21</name>
@ -551,6 +527,61 @@
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkHBox</class>
<name>hbox27</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>3</xpad>
<ypad>3</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkEntry</class>
<name>eventDate</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>calendar</name>
<visible>False</visible>
<tooltip>Selects the calendar format for display</tooltip>
<can_focus>True</can_focus>
<items>Gregorian
Julian
Hebrew
French
</items>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>

View File

@ -166,6 +166,7 @@ class GedcomParser:
self.placemap = {} self.placemap = {}
self.broken_conc_list = [ 'FamilyOrigins', 'FTW' ] self.broken_conc_list = [ 'FamilyOrigins', 'FTW' ]
self.broken_conc = 0 self.broken_conc = 0
self.is_ftw = 0
self.f = open(file,"r") self.f = open(file,"r")
self.index = 0 self.index = 0