pychecker fixes, GEDCOM import/export improvements, calendar improvements

svn: r1250
This commit is contained in:
Don Allingham 2003-01-10 05:21:32 +00:00
parent 7cbe8331e0
commit 141fec93ab
48 changed files with 489 additions and 480 deletions

Binary file not shown.

View File

@ -37,7 +37,6 @@ from intl import gettext as _
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk.glade import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -210,8 +209,6 @@ class AddSpouse:
else: else:
sgender = const.female sgender = const.female
index = 0
self.entries = [] self.entries = []
self.slist.clear() self.slist.clear()
for key in self.db.getPersonKeys(): for key in self.db.getPersonKeys():

View File

@ -41,8 +41,7 @@ import const
import Utils import Utils
import Sources import Sources
import AutoComp import AutoComp
import RelLib
from RelLib import Attribute
from intl import gettext as _ from intl import gettext as _
@ -125,7 +124,7 @@ class AttributeEditor:
priv = self.priv.get_active() priv = self.priv.get_active()
if self.attrib == None: if self.attrib == None:
self.attrib = Attribute() self.attrib = RelLib.Attribute()
self.parent.alist.append(self.attrib) self.parent.alist.append(self.attrib)
self.attrib.setSourceRefList(self.srcreflist) self.attrib.setSourceRefList(self.srcreflist)

View File

@ -29,7 +29,6 @@ __version__ = "$Revision$"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -28,7 +28,6 @@ web site at http://www.scottlee.com
__author__ = "Donald N. Allingham" __author__ = "Donald N. Allingham"
__version__ = "$Revision$" __version__ = "$Revision$"
import math
from intl import gettext as _ from intl import gettext as _
import re import re
@ -158,7 +157,7 @@ class Calendar:
return 1 return 1
def quote_display(self,year,month,day,mode): def quote_display(self,year,month,day,mode):
return "%s (%s)" % (text,Calendar.NAME) return "%04d-%02d-%02d (%s)" % (year,month,day,Calendar.NAME)
def display(self,year,month,day,mode): def display(self,year,month,day,mode):
return _FMT_FUNC[Calendar.FORMATCODE](self,year,month,day,mode) return _FMT_FUNC[Calendar.FORMATCODE](self,year,month,day,mode)
@ -168,8 +167,8 @@ class Calendar:
return "" return ""
elif day == UNDEF: elif day == UNDEF:
if month == UNDEF: if month == UNDEF:
retval = str(self.year) retval = str(year)
elif self.year == UNDEF: elif year == UNDEF:
retval = "????-%02d-??" % (month) retval = "????-%02d-??" % (month)
else: else:
retval = "%04d-%02d" % (year,month) retval = "%04d-%02d" % (year,month)
@ -270,7 +269,7 @@ class Calendar:
retval = str(year) retval = str(year)
else: else:
month_str = self.month(month).upper()[0:3] month_str = self.month(month).upper()[0:3]
if self.year == UNDEF: if year == UNDEF:
retval = "%d %s ????" % (day,month_str) retval = "%d %s ????" % (day,month_str)
else: else:
retval = "%d %s %d" % (day,month_str,year) retval = "%d %s %d" % (day,month_str,year)
@ -295,7 +294,7 @@ class Calendar:
retval = str(year) retval = str(year)
else: else:
month_str = self.month(month).upper()[0:3] month_str = self.month(month).upper()[0:3]
if self.year == UNDEF: if year == UNDEF:
retval = "%d. %s ????" % (day,month_str) retval = "%d. %s ????" % (day,month_str)
else: else:
retval = "%d. %s %d" % (day,month_str,year) retval = "%d. %s %d" % (day,month_str,year)
@ -356,7 +355,7 @@ class Calendar:
pass pass
elif day == UNDEF: elif day == UNDEF:
if month == UNDEF: if month == UNDEF:
retval = str(self.year) retval = str(year)
elif year == UNDEF: elif year == UNDEF:
retval = "????%s%02d%s??" % (sep,month+1,sep) retval = "????%s%02d%s??" % (sep,month+1,sep)
else: else:

View File

@ -48,7 +48,6 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import RelLib import RelLib
import const import const
import sort
import Utils import Utils
import GrampsCfg import GrampsCfg

View File

@ -333,7 +333,7 @@ class SingleDate:
self.calendar.set_month_string(text) self.calendar.set_month_string(text)
def getMonthStr(self): def getMonthStr(self):
return _mname[self.month] return self.calendar.month(self.month)
def getIsoDate(self): def getIsoDate(self):
if self.year == UNDEF: if self.year == UNDEF:

View File

@ -31,9 +31,7 @@ import pickle
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk import gtk
import gnome.ui
import gtk.glade import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
@ -47,13 +45,13 @@ import const
import Utils import Utils
import GrampsCfg import GrampsCfg
import Date import Date
from RelLib import *
import ImageSelect import ImageSelect
import sort import sort
import AutoComp import AutoComp
import ListModel import ListModel
import RelLib
from DateEdit import DateEdit from DateEdit import DateEdit
from QuestionDialog import QuestionDialog from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog
from intl import gettext as _ from intl import gettext as _
@ -168,9 +166,9 @@ class EditPerson:
self.name_source = self.get_widget("name_source") self.name_source = self.get_widget("name_source")
self.gid = self.get_widget("gid") self.gid = self.get_widget("gid")
self.death = Event(person.getDeath()) self.death = RelLib.Event(person.getDeath())
self.birth = Event(person.getBirth()) self.birth = RelLib.Event(person.getBirth())
self.pname = Name(person.getPrimaryName()) self.pname = RelLib.Name(person.getPrimaryName())
self.elist = person.getEventList()[:] self.elist = person.getEventList()[:]
self.nlist = person.getAlternateNames()[:] self.nlist = person.getAlternateNames()[:]
@ -218,9 +216,9 @@ class EditPerson:
self.gid.set_text(person.getId()) self.gid.set_text(person.getId())
self.gid.set_editable(GrampsCfg.id_edit) self.gid.set_editable(GrampsCfg.id_edit)
self.lds_baptism = LdsOrd(self.person.getLdsBaptism()) self.lds_baptism = RelLib.LdsOrd(self.person.getLdsBaptism())
self.lds_endowment = LdsOrd(self.person.getLdsEndowment()) self.lds_endowment = RelLib.LdsOrd(self.person.getLdsEndowment())
self.lds_sealing = LdsOrd(self.person.getLdsSeal()) self.lds_sealing = RelLib.LdsOrd(self.person.getLdsSeal())
if GrampsCfg.uselds or self.lds_baptism or self.lds_endowment or self.lds_sealing: if GrampsCfg.uselds or self.lds_baptism or self.lds_endowment or self.lds_sealing:
self.get_widget("lds_tab").show() self.get_widget("lds_tab").show()
@ -232,9 +230,9 @@ class EditPerson:
self.autotype = AutoComp.AutoEntry(self.ntype_field.entry,types) self.autotype = AutoComp.AutoEntry(self.ntype_field.entry,types)
self.write_primary_name() self.write_primary_name()
if person.getGender() == Person.male: if person.getGender() == RelLib.Person.male:
self.is_male.set_active(1) self.is_male.set_active(1)
elif person.getGender() == Person.female: elif person.getGender() == RelLib.Person.female:
self.is_female.set_active(1) self.is_female.set_active(1)
else: else:
self.is_unknown.set_active(1) self.is_unknown.set_active(1)
@ -250,32 +248,24 @@ class EditPerson:
self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.event_list.connect('drag_data_get', self.ev_drag_data_get) self.event_list.connect('drag_data_get', self.ev_drag_data_get)
self.event_list.connect('drag_begin', self.ev_drag_begin) self.event_list.connect('drag_begin', self.ev_drag_begin)
self.event_list.connect('drag_data_received', self.event_list.connect('drag_data_received',self.ev_drag_data_received)
self.ev_drag_data_received)
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY) self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY) self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.web_list.connect('drag_data_get', self.url_drag_data_get) self.web_list.connect('drag_data_get', self.url_drag_data_get)
self.web_list.connect('drag_begin', self.url_drag_begin) self.web_list.connect('drag_begin', self.url_drag_begin)
self.web_list.connect('drag_data_received', self.web_list.connect('drag_data_received',self.url_drag_data_received)
self.url_drag_data_received)
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts, self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
ACTION_COPY) self.attr_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.attr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,
ACTION_COPY)
self.attr_list.connect('drag_data_get', self.at_drag_data_get) self.attr_list.connect('drag_data_get', self.at_drag_data_get)
self.attr_list.connect('drag_data_received', self.attr_list.connect('drag_data_received',self.at_drag_data_received)
self.at_drag_data_received)
self.attr_list.connect('drag_begin', self.at_drag_begin) self.attr_list.connect('drag_begin', self.at_drag_begin)
self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
pycode_tgts,ACTION_COPY) self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,ACTION_COPY)
self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,
ACTION_COPY)
self.addr_list.connect('drag_data_get', self.ad_drag_data_get) self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
self.addr_list.connect('drag_data_received', self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
self.ad_drag_data_received)
self.addr_list.connect('drag_begin', self.ev_drag_begin) self.addr_list.connect('drag_begin', self.ev_drag_begin)
self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat")) self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat"))
@ -873,7 +863,7 @@ class EditPerson:
if self.pname.getNote() != name.getNote(): if self.pname.getNote() != name.getNote():
changed = 1 changed = 1
if self.lds_not_loaded == 0 and self.check_lds(): if self.lds_not_loaded == 0 and self.check_lds():
changed == 1 changed = 1
bplace = string.strip(self.bplace.get_text()) bplace = string.strip(self.bplace.get_text())
dplace = string.strip(self.dplace.get_text()) dplace = string.strip(self.dplace.get_text())
@ -898,11 +888,11 @@ class EditPerson:
changed = 1 changed = 1
if not self.death.are_equal(self.person.getDeath()): if not self.death.are_equal(self.person.getDeath()):
changed = 1 changed = 1
if male and self.person.getGender() != Person.male: if male and self.person.getGender() != RelLib.Person.male:
changed = 1 changed = 1
elif female and self.person.getGender() != Person.female: elif female and self.person.getGender() != RelLib.Person.female:
changed = 1 changed = 1
elif unknown and self.person.getGender() != Person.unknown: elif unknown and self.person.getGender() != RelLib.Person.unknown:
changed = 1 changed = 1
if text != self.person.getNote() or self.lists_changed: if text != self.person.getNote() or self.lists_changed:
changed = 1 changed = 1
@ -1200,7 +1190,7 @@ class EditPerson:
msg2 = _("%(grampsid)s is already used by %(person)s") % { msg2 = _("%(grampsid)s is already used by %(person)s") % {
'grampsid' : idval, 'grampsid' : idval,
'person' : n } 'person' : n }
GnomeWarningDialog("%s\n%s" % (msg1,msg2)) WarningDialog("%s\n%s" % (msg1,msg2))
if suffix != name.getSuffix(): if suffix != name.getSuffix():
name.setSuffix(suffix) name.setSuffix(suffix)
@ -1267,8 +1257,8 @@ class EditPerson:
female = self.is_female.get_active() female = self.is_female.get_active()
unknown = self.is_unknown.get_active() unknown = self.is_unknown.get_active()
error = 0 error = 0
if male and self.person.getGender() != Person.male: if male and self.person.getGender() != RelLib.Person.male:
self.person.setGender(Person.male) self.person.setGender(RelLib.Person.male)
for temp_family in self.person.getFamilyList(): for temp_family in self.person.getFamilyList():
if self.person == temp_family.getMother(): if self.person == temp_family.getMother():
if temp_family.getFather() != None: if temp_family.getFather() != None:
@ -1277,8 +1267,8 @@ class EditPerson:
temp_family.setMother(None) temp_family.setMother(None)
temp_family.setFather(self.person) temp_family.setFather(self.person)
Utils.modified() Utils.modified()
elif female and self.person.getGender() != Person.female: elif female and self.person.getGender() != RelLib.Person.female:
self.person.setGender(Person.female) self.person.setGender(RelLib.Person.female)
for temp_family in self.person.getFamilyList(): for temp_family in self.person.getFamilyList():
if self.person == temp_family.getFather(): if self.person == temp_family.getFather():
if temp_family.getMother() != None: if temp_family.getMother() != None:
@ -1287,8 +1277,8 @@ class EditPerson:
temp_family.setFather(None) temp_family.setFather(None)
temp_family.setMother(self.person) temp_family.setMother(self.person)
Utils.modified() Utils.modified()
elif unknown and self.person.getGender() != Person.unknown: elif unknown and self.person.getGender() != RelLib.Person.unknown:
self.person.setGender(Person.unknown) self.person.setGender(RelLib.Person.unknown)
for temp_family in self.person.getFamilyList(): for temp_family in self.person.getFamilyList():
if self.person == temp_family.getFather(): if self.person == temp_family.getFather():
if temp_family.getMother() != None: if temp_family.getMother() != None:
@ -1319,17 +1309,17 @@ class EditPerson:
if self.lds_not_loaded == 0: if self.lds_not_loaded == 0:
self.check_lds() self.check_lds()
ord = LdsOrd(self.person.getLdsBaptism()) ord = RelLib.LdsOrd(self.person.getLdsBaptism())
if not self.lds_baptism.are_equal(ord): if not self.lds_baptism.are_equal(ord):
self.person.setLdsBaptism(self.lds_baptism) self.person.setLdsBaptism(self.lds_baptism)
Utils.modified() Utils.modified()
ord = LdsOrd(self.person.getLdsEndowment()) ord = RelLib.LdsOrd(self.person.getLdsEndowment())
if not self.lds_endowment.are_equal(ord): if not self.lds_endowment.are_equal(ord):
self.person.setLdsEndowment(self.lds_endowment) self.person.setLdsEndowment(self.lds_endowment)
Utils.modified() Utils.modified()
ord = LdsOrd(self.person.getLdsSeal()) ord = RelLib.LdsOrd(self.person.getLdsSeal())
if not self.lds_sealing.are_equal(ord): if not self.lds_sealing.are_equal(ord):
self.person.setLdsSeal(self.lds_sealing) self.person.setLdsSeal(self.lds_sealing)
Utils.modified() Utils.modified()
@ -1346,7 +1336,7 @@ class EditPerson:
if self.pmap.has_key(text): if self.pmap.has_key(text):
return self.db.getPlaceMap()[self.pmap[text]] return self.db.getPlaceMap()[self.pmap[text]]
elif makenew: elif makenew:
place = Place() place = RelLib.Place()
place.set_title(text) place.set_title(text)
self.db.addPlace(place) self.db.addPlace(place)
self.pmap[text] = place.getId() self.pmap[text] = place.getId()
@ -1396,7 +1386,6 @@ class EditPerson:
def on_ldsseal_source_clicked(self,obj): def on_ldsseal_source_clicked(self,obj):
import Sources import Sources
ord = self.person.getLdsSeal()
Sources.SourceSelector(self.lds_sealing.getSourceRefList(),self,self.lds_seal_list) Sources.SourceSelector(self.lds_sealing.getSourceRefList(),self,self.lds_seal_list)
def lds_seal_list(self,list): def lds_seal_list(self,list):
@ -1450,7 +1439,7 @@ class EditPerson:
self.nlist.remove(new) self.nlist.remove(new)
self.nlist.append(old) self.nlist.append(old)
self.redraw_name_list() self.redraw_name_list()
self.pname = Name(new) self.pname = RelLib.Name(new)
self.lists_changed = 1 self.lists_changed = 1
self.write_primary_name() self.write_primary_name()

View File

@ -33,7 +33,6 @@ import pickle
import gobject import gobject
import gtk import gtk
import gtk.glade import gtk.glade
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -43,7 +42,6 @@ import gnome.ui
import const import const
import Utils import Utils
import GrampsCfg import GrampsCfg
from RelLib import *
import Sources import Sources
import ImageSelect import ImageSelect
@ -78,7 +76,6 @@ class EditPlace:
self.srcreflist = [] self.srcreflist = []
self.top_window = gtk.glade.XML(const.placesFile,"placeEditor") self.top_window = gtk.glade.XML(const.placesFile,"placeEditor")
adj = gtk.Adjustment()
self.iconlist = self.top_window.get_widget('iconlist') self.iconlist = self.top_window.get_widget('iconlist')
self.glry = ImageSelect.Gallery(place, self.path, self.iconlist, self.db, self) self.glry = ImageSelect.Gallery(place, self.path, self.iconlist, self.db, self)

View File

@ -34,7 +34,6 @@ import gtk.glade
import const import const
import Utils import Utils
import GrampsCfg import GrampsCfg
from RelLib import *
import ImageSelect import ImageSelect
from intl import gettext as _ from intl import gettext as _

View File

@ -39,10 +39,10 @@ import Utils
import GrampsCfg import GrampsCfg
import AutoComp import AutoComp
import Calendar import Calendar
import RelLib
import Date
from DateEdit import DateEdit from DateEdit import DateEdit
from Date import compare_dates
from RelLib import *
from intl import gettext as _ from intl import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -66,10 +66,10 @@ class EventEditor:
if event: if event:
self.srcreflist = self.event.getSourceRefList() self.srcreflist = self.event.getSourceRefList()
self.date = Date(self.event.getDateObj()) self.date = Date.Date(self.event.getDateObj())
else: else:
self.srcreflist = [] self.srcreflist = []
self.date = Date(None) self.date = Date.Date(None)
self.top = gtk.glade.XML(const.dialogFile, "event_edit") self.top = gtk.glade.XML(const.dialogFile, "event_edit")
self.window = self.top.get_widget("event_edit") self.window = self.top.get_widget("event_edit")
@ -165,7 +165,7 @@ class EventEditor:
if self.pmap.has_key(text): if self.pmap.has_key(text):
return self.parent.db.getPlaceMap()[self.pmap[text]] return self.parent.db.getPlaceMap()[self.pmap[text]]
elif makenew: elif makenew:
place = Place() place = RelLib.Place()
place.set_title(text) place.set_title(text)
self.parent.db.addPlace(place) self.parent.db.addPlace(place)
self.pmap[text] = place.getId() self.pmap[text] = place.getId()
@ -190,7 +190,7 @@ class EventEditor:
epriv = self.priv.get_active() epriv = self.priv.get_active()
if self.event == None: if self.event == None:
self.event = Event() self.event = RelLib.Event()
self.event.setSourceRefList(self.srcreflist) self.event.setSourceRefList(self.srcreflist)
self.parent.elist.append(self.event) self.parent.elist.append(self.event)
@ -220,7 +220,7 @@ class EventEditor:
self.event.setSourceRefList(self.srcreflist) self.event.setSourceRefList(self.srcreflist)
if compare_dates(dobj,date) != 0: if Date.compare_dates(dobj,date) != 0:
self.event.setDateObj(date) self.event.setDateObj(date)
self.parent.lists_changed = 1 self.parent.lists_changed = 1

View File

@ -18,6 +18,13 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
#-------------------------------------------------------------------------
#
# standard python modules
#
#-------------------------------------------------------------------------
import pickle
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
@ -26,6 +33,7 @@
import gobject import gobject
import gtk import gtk
import gtk.glade import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -34,17 +42,19 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import sort import sort
from intl import gettext as _
import Utils import Utils
import GrampsCfg import GrampsCfg
from RelLib import Person
from QuestionDialog import QuestionDialog
import AddSpouse import AddSpouse
import SelectChild import SelectChild
import DisplayTrace import DisplayTrace
import Marriage import Marriage
import ChooseParents import ChooseParents
import RelLib
from intl import gettext as _
from QuestionDialog import QuestionDialog,WarningDialog
pycode_tgts = [('child', 0, 0)]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -98,11 +108,18 @@ class FamilyView:
self.selected_spouse = None self.selected_spouse = None
self.child_list = self.top.get_widget('chlist') self.child_list = self.top.get_widget('chlist')
self.child_list.set_reorderable(gtk.TRUE)
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.child_list.connect('drag_data_get', self.drag_data_get)
self.child_list.connect('drag_begin', self.drag_begin)
self.child_list.connect('drag_data_received',self.drag_data_received)
self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING, self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
gobject.TYPE_STRING,gobject.TYPE_STRING, gobject.TYPE_STRING,gobject.TYPE_STRING,
gobject.TYPE_STRING,gobject.TYPE_STRING, gobject.TYPE_STRING,gobject.TYPE_STRING,
gobject.TYPE_STRING) gobject.TYPE_STRING)
self.child_selection = self.child_list.get_selection() self.child_selection = self.child_list.get_selection()
self.child_list.connect('button-press-event',self.on_child_list_button_press) self.child_list.connect('button-press-event',self.on_child_list_button_press)
@ -351,7 +368,7 @@ class FamilyView:
def delete_family_from(self,person): def delete_family_from(self,person):
person.removeFamily(self.family) person.removeFamily(self.family)
self.db.deleteFamily(self.family) self.parent.db.deleteFamily(self.family)
flist = self.person.getFamilyList() flist = self.person.getFamilyList()
if len(flist) > 0: if len(flist) > 0:
self.family = flist[0][0] self.family = flist[0][0]
@ -385,9 +402,9 @@ class FamilyView:
attr = "" attr = ""
for child in child_list: for child in child_list:
status = _("Unknown") status = _("Unknown")
if child.getGender() == Person.male: if child.getGender() == RelLib.Person.male:
gender = const.male gender = const.male
elif child.getGender() == Person.female: elif child.getGender() == RelLib.Person.female:
gender = const.female gender = const.female
else: else:
gender = const.unknown gender = const.unknown
@ -507,5 +524,94 @@ class FamilyView:
Utils.modified() Utils.modified()
self.load_family() self.load_family()
def child_list_reordered(self,path,iter):
print path,iter
def on_child_list_row_move(self,clist,fm,to):
"""Validate whether or not this child can be moved within the clist.
This routine is called in the middle of the clist's callbacks, so
the state can be confusing. If the code is being debugged, the
display at this point shows that the list has been reordered when in
actuality it hasn't. All accesses to the clist data structure
reference the state just prior to the move.
This routine must keep/compute its own list indices as the functions
list.remove(), list.insert(), list.reverse() etc. do not affect the
values returned from the list.index() routine."""
family = clist.get_data("f")
# Create a list based upon the current order of the clist
clist_order = []
for i in range(clist.rows):
clist_order = clist_order + [clist.get_row_data(i)]
child = clist_order[fm]
# This function deals with ascending order lists. Convert if
# necessary.
if (self.child_sort.sort_direction() == GTK.SORT_DESCENDING):
clist_order.reverse()
max_index = len(clist_order) - 1
fm = max_index - fm
to = max_index - to
# Create a new list to match the requested order
desired_order = clist_order[:fm] + clist_order[fm+1:]
desired_order = desired_order[:to] + [child] + desired_order[to:]
# Check birth date order in the new list
if (EditPerson.birth_dates_in_order(desired_order) == 0):
clist.emit_stop_by_name("row_move")
msg = _("Invalid move. Children must be ordered by birth date.")
WarningDialog(msg)
return
# OK, this birth order works too. Update the family data structures.
family.setChildList(desired_order)
# Build a mapping of child item to list position. This would not
# be necessary if indices worked properly
i = 0
new_order = {}
for tmp in desired_order:
new_order[tmp] = i
i = i + 1
# Convert the original list back to whatever ordering is being
# used by the clist itself.
if self.child_sort.sort_direction() == GTK.SORT_DESCENDING:
clist_order.reverse()
# Update the clist indices so any change of sorting works
i = 0
for tmp in clist_order:
clist.set_text(i,0,"%2d"%(new_order[tmp]+1))
i = i + 1
# Need to save the changed order
Utils.modified()
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
row = self.child_list.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'child':
return
elif person == self.person.getId():
print row
# self.move_element(self.elist,self.etree.get_selected_row(),row)
def drag_data_get(self,widget, context, sel_data, info, time):
ev = self.child_list.get_selected_objects()
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str(('child',self.person.getId(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def drag_begin(self, context, a):
return

View File

@ -85,7 +85,7 @@ class FrenchRepublic(Calendar.Calendar):
try: try:
return FrenchRepublic.M2NUM[val] return FrenchRepublic.M2NUM[val]
except KeyError: except KeyError:
return UNDEF return Calendar.UNDEF
def get_sdn(self,y,m,d): def get_sdn(self,y,m,d):
"""Converts a French Republican Calendar date to an SDN number""" """Converts a French Republican Calendar date to an SDN number"""

View File

@ -48,9 +48,10 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
from RelLib import * import RelLib
import Date import Date
from intl import gettext as _ from intl import gettext as _
from Utils import for_each_ancestor
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -151,7 +152,7 @@ class IsFemale(Rule):
return 'Is a female' return 'Is a female'
def apply(self,db,p): def apply(self,db,p):
return p.getGender() == Person.female return p.getGender() == RelLib.Person.female
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -296,7 +297,7 @@ class IsMale(Rule):
return 'Is a male' return 'Is a male'
def apply(self,db,p): def apply(self,db,p):
return p.getGender() == Person.male return p.getGender() == Person.Person.male
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -24,7 +24,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import string
import os import os
import PaperMenu import PaperMenu
@ -40,14 +39,15 @@ import gobject
import gconf import gconf
import gtk import gtk
import gtk.glade import gtk.glade
import gnome
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
from Date import * #from Date import *
import const import const
import Utils import Utils
@ -285,7 +285,7 @@ def loadConfig(call):
autocomp = not ac autocomp = not ac
Calendar.set_format_code(dateFormat) Calendar.set_format_code(dateFormat)
Calendar.ENTRYCODE = dateEntry Calendar.Calendar.ENTRYCODE = dateEntry
if _name_format == 0: if _name_format == 0:
nameof = Utils.normal_name nameof = Utils.normal_name
@ -354,7 +354,7 @@ def get_researcher():
ph = get_string("/apps/gramps/researcher-phone") ph = get_string("/apps/gramps/researcher-phone")
e = get_string("/apps/gramps/researcher-email") e = get_string("/apps/gramps/researcher-email")
owner = Researcher() owner = RelLib.Researcher()
owner.set(n,a,c,s,ct,p,ph,e) owner.set(n,a,c,s,ct,p,ph,e)
return owner return owner
@ -555,7 +555,6 @@ class GrampsPreferences:
vc = self.top.get_widget("use_vc") vc = self.top.get_widget("use_vc")
vcom = self.top.get_widget("vc_comment") vcom = self.top.get_widget("vc_comment")
compress = self.top.get_widget("uncompress") compress = self.top.get_widget("uncompress")
detail = self.top.get_widget("showdetail")
auto.set_active(autoload) auto.set_active(autoload)
asave_int.set_value(int(autosave_int)) asave_int.set_value(int(autosave_int))
@ -671,7 +670,7 @@ class GrampsPreferences:
item.connect("activate", self.on_format_toggled) item.connect("activate", self.on_format_toggled)
item.show() item.show()
date_menu.append(item) date_menu.append(item)
date_menu.set_active(Calendar.ENTRYCODE) date_menu.set_active(Calendar.Calendar.ENTRYCODE)
date_entry.set_menu(date_menu) date_entry.set_menu(date_menu)
name_option = self.top.get_widget("name_format") name_option = self.top.get_widget("name_format")
@ -912,7 +911,7 @@ class GrampsPreferences:
format_menu = self.top.get_widget("date_entry_format").get_menu() format_menu = self.top.get_widget("date_entry_format").get_menu()
entry_active = format_menu.get_active().get_data(INDEX) entry_active = format_menu.get_active().get_data(INDEX)
Calendar.ENTRYCODE = entry_active Calendar.Calendar.ENTRYCODE = entry_active
set_int("/apps/gramps/date-entry",entry_active) set_int("/apps/gramps/date-entry",entry_active)
# get the name format # get the name format

View File

@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
from RelLib import * import RelLib
from Date import SingleDate import Date
import string import string
import Calendar import Calendar
@ -93,7 +93,7 @@ class GrampsParser:
self.event = None self.event = None
self.name = None self.name = None
self.tempDefault = None self.tempDefault = None
self.owner = Researcher() self.owner = RelLib.Researcher()
self.func_list = [None]*50 self.func_list = [None]*50
self.func_index = 0 self.func_index = 0
self.func = None self.func = None
@ -114,7 +114,7 @@ class GrampsParser:
def start_lds_ord(self,attrs): def start_lds_ord(self,attrs):
type = attrs['type'] type = attrs['type']
self.ord = LdsOrd() self.ord = RelLib.LdsOrd()
if self.person: if self.person:
if type == "baptism": if type == "baptism":
self.person.setLdsBaptism(self.ord) self.person.setLdsBaptism(self.ord)
@ -158,7 +158,7 @@ class GrampsParser:
"""Bypass the function calls for this one, since it appears to """Bypass the function calls for this one, since it appears to
take up quite a bit of time""" take up quite a bit of time"""
loc = Location() loc = RelLib.Location()
if attrs.has_key('city'): if attrs.has_key('city'):
loc.city = attrs['city'] loc.city = attrs['city']
if attrs.has_key('parish'): if attrs.has_key('parish'):
@ -182,7 +182,7 @@ class GrampsParser:
self.placeobj.set_longitude(attrs['long']) self.placeobj.set_longitude(attrs['long'])
def start_event(self,attrs): def start_event(self,attrs):
self.event = Event() self.event = RelLib.Event()
self.event_type = attrs["type"] self.event_type = attrs["type"]
if attrs.has_key("conf"): if attrs.has_key("conf"):
self.event.conf = int(attrs["conf"]) self.event.conf = int(attrs["conf"])
@ -192,7 +192,7 @@ class GrampsParser:
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 = RelLib.Attribute()
if attrs.has_key("conf"): if attrs.has_key("conf"):
self.attribute.conf = int(attrs["conf"]) self.attribute.conf = int(attrs["conf"])
else: else:
@ -215,7 +215,7 @@ class GrampsParser:
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 = RelLib.Address()
self.person.addAddress(self.address) self.person.addAddress(self.address)
if attrs.has_key("conf"): if attrs.has_key("conf"):
self.address.conf = int(attrs["conf"]) self.address.conf = int(attrs["conf"])
@ -257,7 +257,7 @@ class GrampsParser:
desc = "" desc = ""
try: try:
url = Url() url = RelLib.Url()
url.set_path(attrs["href"]) url.set_path(attrs["href"])
url.set_description(desc) url.set_description(desc)
if attrs.has_key("priv"): if attrs.has_key("priv"):
@ -295,7 +295,7 @@ class GrampsParser:
self.person.FamilyList.append(self.db.findFamilyNoMap(attrs["ref"])) self.person.FamilyList.append(self.db.findFamilyNoMap(attrs["ref"]))
def start_name(self,attrs): def start_name(self,attrs):
self.name = Name() self.name = RelLib.Name()
if attrs.has_key("type"): if attrs.has_key("type"):
self.name.setType(attrs["type"]) self.name.setType(attrs["type"])
if attrs.has_key("conf"): if attrs.has_key("conf"):
@ -313,7 +313,7 @@ class GrampsParser:
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 = RelLib.SourceRef()
source = self.db.findSourceNoMap(attrs["ref"]) source = self.db.findSourceNoMap(attrs["ref"])
if attrs.has_key("conf"): if attrs.has_key("conf"):
self.source_ref.confidence = int(attrs["conf"]) self.source_ref.confidence = int(attrs["conf"])
@ -345,7 +345,7 @@ class GrampsParser:
self.source = self.db.findSourceNoMap(attrs["id"]) self.source = self.db.findSourceNoMap(attrs["id"])
def start_objref(self,attrs): def start_objref(self,attrs):
self.objref = ObjectRef() self.objref = RelLib.ObjectRef()
self.objref.setReference(self.db.findObjectNoMap(attrs['ref'])) self.objref.setReference(self.db.findObjectNoMap(attrs['ref']))
if attrs.has_key('priv'): if attrs.has_key('priv'):
self.objref.setPrivacy(int(attrs['priv'])) self.objref.setPrivacy(int(attrs['priv']))
@ -378,8 +378,8 @@ class GrampsParser:
self.objref = None self.objref = None
def start_photo(self,attrs): def start_photo(self,attrs):
self.photo = Photo() self.photo = RelLib.Photo()
self.pref = ObjectRef() self.pref = RelLib.ObjectRef()
self.pref.setReference(self.photo) self.pref.setReference(self.photo)
for key in attrs.keys(): for key in attrs.keys():
@ -396,7 +396,7 @@ class GrampsParser:
self.photo.setPath(src) self.photo.setPath(src)
self.photo.setLocal(0) self.photo.setLocal(0)
else: else:
a = Attribute() a = RelLib.Attribute()
a.setType(key) a.setType(key)
a.setValue(attrs[key]) a.setValue(attrs[key])
self.photo.addAttribute(a) self.photo.addAttribute(a)
@ -531,7 +531,7 @@ class GrampsParser:
if self.place_map.has_key(tag): if self.place_map.has_key(tag):
self.placeobj = self.place_map[tag] self.placeobj = self.place_map[tag]
else: else:
self.placeobj = Place() self.placeobj = RelLib.Place()
self.placeobj.set_title(tag) self.placeobj.set_title(tag)
self.db.addPlace(self.placeobj) self.db.addPlace(self.placeobj)
self.place_map[tag] = self.placeobj self.place_map[tag] = self.placeobj
@ -571,11 +571,11 @@ class GrampsParser:
def stop_gender(self,tag): def stop_gender(self,tag):
t = tag t = tag
if t == "M": if t == "M":
self.person.gender = Person.male self.person.gender = RelLib.Person.male
elif t == "F": elif t == "F":
self.person.gender = Person.female self.person.gender = RelLib.Person.female
else: else:
self.person.gender = Person.unknown self.person.gender = RelLib.Person.unknown
def stop_stitle(self,tag): def stop_stitle(self,tag):
self.source.setTitle(tag) self.source.setTitle(tag)
@ -591,7 +591,7 @@ class GrampsParser:
self.source.setAuthor(tag) self.source.setAuthor(tag)
def stop_sdate(self,tag): def stop_sdate(self,tag):
date = Date() date = Date.Date()
date.set(tag) date.set(tag)
self.source_ref.setDate(date) self.source_ref.setDate(date)
@ -874,7 +874,7 @@ class GrampsImportParser(GrampsParser):
self.family.setRelationship(attrs["type"]) self.family.setRelationship(attrs["type"])
def start_sourceref(self,attrs): def start_sourceref(self,attrs):
self.source_ref = SourceRef() self.source_ref = RelLib.SourceRef()
self.source = self.db.findSource(attrs["ref"],self.smap) self.source = self.db.findSource(attrs["ref"],self.smap)
self.source_ref.setBase(self.source) self.source_ref.setBase(self.source)
if self.address: if self.address:

View File

@ -18,12 +18,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
from RelLib import GrampsDB import RelLib
import WriteXML import WriteXML
import ReadXML import ReadXML
import const import const
class GrampsXML(GrampsDB): class GrampsXML(RelLib.GrampsDB):
def get_base(self): def get_base(self):
return const.xmlFile return const.xmlFile
@ -32,7 +32,7 @@ class GrampsXML(GrampsDB):
return 'GrampsXML' return 'GrampsXML'
def new(self): def new(self):
GrampsDB.new(self) RelLib.GrampsDB.new(self)
def save(self,name,callback): def save(self,name,callback):
WriteXML.exportData(self,name,callback) WriteXML.exportData(self,name,callback)

View File

@ -101,7 +101,7 @@ class Hebrew(Calendar.Calendar):
try: try:
return Hebrew.M2NUM[unicode(text.lower())] return Hebrew.M2NUM[unicode(text.lower())]
except KeyError: except KeyError:
return UNDEF return Calendar.UNDEF
def Tishri1(self,metonicYear, moladDay, moladHalakim): def Tishri1(self,metonicYear, moladDay, moladHalakim):

View File

@ -26,13 +26,11 @@
import os import os
import string import string
import urlparse import urlparse
import gc
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk import gtk
import gnome.ui import gnome.ui
import gnome.canvas import gnome.canvas
@ -47,13 +45,8 @@ import const
import Utils import Utils
import GrampsCfg import GrampsCfg
import Plugins import Plugins
from RelLib import * import RelLib
import RelImage import RelImage
import EditPerson
import Marriage
import EditPlace
import EditSource
import ListModel import ListModel
import grampslib import grampslib
@ -157,13 +150,13 @@ class ImageSelect:
break break
if (already_imported): if (already_imported):
oref = ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(already_imported) oref.setReference(already_imported)
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
else: else:
type = Utils.get_mime_type(filename) type = Utils.get_mime_type(filename)
mobj = Photo() mobj = RelLib.Photo()
if description == "": if description == "":
description = os.path.basename(filename) description = os.path.basename(filename)
mobj.setDescription(description) mobj.setDescription(description)
@ -229,7 +222,6 @@ class Gallery(ImageSelect):
self.root = self.iconlist.root() self.root = self.iconlist.root()
# Local object variables # Local object variables
x = 0
self.y = 0 self.y = 0
self.remember_x = -1 self.remember_x = -1
self.remember_y = -1 self.remember_y = -1
@ -260,7 +252,7 @@ class Gallery(ImageSelect):
self.drag_item = widget.get_item_at(self.remember_x, self.drag_item = widget.get_item_at(self.remember_x,
self.remember_y) self.remember_y)
if self.drag_item: if self.drag_item:
context = widget.drag_begin(_drag_targets, widget.drag_begin(_drag_targets,
gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE, gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE,
self.button, event) self.button, event)
return gtk.TRUE return gtk.TRUE
@ -321,7 +313,7 @@ class Gallery(ImageSelect):
def savephoto(self, photo): def savephoto(self, photo):
"""Save the photo in the dataobj object. (Required function)""" """Save the photo in the dataobj object. (Required function)"""
self.db.addObject(photo) self.db.addObject(photo)
oref = ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(photo) oref.setReference(photo)
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
@ -408,7 +400,7 @@ class Gallery(ImageSelect):
if protocol == "file": if protocol == "file":
name = file name = file
mime = Utils.get_mime_type(name) mime = Utils.get_mime_type(name)
photo = Photo() photo = RelLib.Photo()
photo.setPath(name) photo.setPath(name)
photo.setMimeType(mime) photo.setMimeType(mime)
basename = os.path.basename(name) basename = os.path.basename(name)
@ -434,13 +426,13 @@ class Gallery(ImageSelect):
ErrorDialog("%s\n%s %d" % (t,msg[0],msg[1])) ErrorDialog("%s\n%s %d" % (t,msg[0],msg[1]))
return return
mime = Utils.get_mime_type(tfile) mime = Utils.get_mime_type(tfile)
photo = Photo() photo = RelLib.Photo()
photo.setMimeType(mime) photo.setMimeType(mime)
photo.setDescription(d) photo.setDescription(d)
photo.setLocal(1) photo.setLocal(1)
photo.setPath(tfile) photo.setPath(tfile)
self.db.addObject(photo) self.db.addObject(photo)
oref = ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(photo) oref.setReference(photo)
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
try: try:
@ -482,7 +474,7 @@ class Gallery(ImageSelect):
self.load_images() self.load_images()
return return
index = index + 1 index = index + 1
oref = ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(self.db.findObjectNoMap(data.data)) oref.setReference(self.db.findObjectNoMap(data.data))
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)

View File

@ -20,7 +20,6 @@
import os import os
import const import const
import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,8 +43,8 @@ class ImgManip:
if no_pil: if no_pil:
def size(self): def size(self):
img = GdkImlib.Image(self.src) img = gtk.gdk.pixbuf_new_from_file(self.src)
return (img.rgb_width,img.rgb_height) return (img.get_width(),img.get_height())
def fmt_thumbnail(self,dest,width,height,cnv): def fmt_thumbnail(self,dest,width,height,cnv):
w = int(width) w = int(width)

View File

@ -182,3 +182,4 @@ class ListModel:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.double_click(obj) self.double_click(obj)
return 1 return 1
return 0

View File

@ -32,7 +32,7 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import Utils import Utils
from RelLib import * import RelLib
from intl import gettext as _ from intl import gettext as _
@ -84,7 +84,7 @@ class LocationEditor:
parish = self.parish.get_text() parish = self.parish.get_text()
if self.location == None: if self.location == None:
self.location = Location() self.location = RelLib.Location()
self.parent.llist.append(self.location) self.parent.llist.append(self.location)
self.update_location(city,parish,county,state,country) self.update_location(city,parish,county,state,country)

View File

@ -25,10 +25,8 @@ import pickle
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk import gtk
import gtk.glade import gtk.glade
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -41,11 +39,18 @@ import GrampsCfg
import Utils import Utils
import AutoComp import AutoComp
import ListModel import ListModel
from QuestionDialog import QuestionDialog import RelLib
from RelLib import *
import ImageSelect import ImageSelect
import Date
from QuestionDialog import QuestionDialog, WarningDialog
from intl import gettext as _ from intl import gettext as _
#-------------------------------------------------------------------------
#
# Globals
#
#-------------------------------------------------------------------------
_temple_names = const.lds_temple_codes.keys() _temple_names = const.lds_temple_codes.keys()
_temple_names.sort() _temple_names.sort()
_temple_names = [""] + _temple_names _temple_names = [""] + _temple_names
@ -210,7 +215,7 @@ class Marriage:
import Sources import Sources
ord = self.family.getLdsSeal() ord = self.family.getLdsSeal()
if ord == None: if ord == None:
ord = LdsOrd() ord = RelLib.LdsOrd()
self.family.setLdsSeal(ord) self.family.setLdsSeal(ord)
Sources.SourceSelector(ord.getSourceRefList(),self) Sources.SourceSelector(ord.getSourceRefList(),self)
@ -218,7 +223,7 @@ class Marriage:
import NoteEdit import NoteEdit
ord = self.family.getLdsSeal() ord = self.family.getLdsSeal()
if ord == None: if ord == None:
ord = LdsOrd() ord = RelLib.LdsOrd()
self.family.setLdsSeal(ord) self.family.setLdsSeal(ord)
NoteEdit.NoteEditor(ord) NoteEdit.NoteEditor(ord)
@ -360,9 +365,9 @@ class Marriage:
if date or temple or place or self.seal_stat: if date or temple or place or self.seal_stat:
changed = 1 changed = 1
else: else:
d = Date() d = Date.Date()
d.set(date) d.set(date)
if compare_dates(d,ord.getDateObj()) != 0 or \ if Date.compare_dates(d,ord.getDateObj()) != 0 or \
ord.getTemple() != temple or \ ord.getTemple() != temple or \
ord.getPlace() != place or \ ord.getPlace() != place or \
ord.getStatus() != self.seal_stat: ord.getStatus() != self.seal_stat:
@ -401,7 +406,7 @@ class Marriage:
Utils.modified() Utils.modified()
else: else:
msg1 = _("GRAMPS ID value was not changed.") msg1 = _("GRAMPS ID value was not changed.")
GnomeWarningDialog("%s" % msg1) WarningDialog("%s" % msg1)
relation = self.type_field.entry.get_text() relation = self.type_field.entry.get_text()
father = self.family.getFather() father = self.family.getFather()
@ -414,8 +419,8 @@ class Marriage:
val = const.save_frel(relation) val = const.save_frel(relation)
if val == "Partners": if val == "Partners":
val = "Unknown" val = "Unknown"
if father.getGender() == Person.female or \ if father.getGender() == RelLib.Person.female or \
mother.getGender() == Person.male: mother.getGender() == RelLib.Person.male:
self.family.setFather(mother) self.family.setFather(mother)
self.family.setMother(father) self.family.setMother(father)
self.family.setRelationship(val) self.family.setRelationship(val)
@ -438,7 +443,7 @@ class Marriage:
ord = self.family.getLdsSeal() ord = self.family.getLdsSeal()
if not ord: if not ord:
if date or temple or place or self.seal_stat: if date or temple or place or self.seal_stat:
ord = LdsOrd() ord = RelLib.LdsOrd()
ord.setDate(date) ord.setDate(date)
ord.setTemple(temple) ord.setTemple(temple)
ord.setStatus(self.seal_stat) ord.setStatus(self.seal_stat)
@ -446,9 +451,9 @@ class Marriage:
self.family.setLdsSeal(ord) self.family.setLdsSeal(ord)
Utils.modified() Utils.modified()
else: else:
d = Date() d = Date.Date()
d.set(date) d.set(date)
if compare_dates(d,ord.getDateObj()) != 0: if Date.compare_dates(d,ord.getDateObj()) != 0:
ord.setDateObj(d) ord.setDateObj(d)
Utils.modified() Utils.modified()
if ord.getTemple() != temple: if ord.getTemple() != temple:

View File

@ -24,6 +24,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import string import string
import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -34,21 +35,20 @@ import gobject
import gtk import gtk
import gtk.gdk import gtk.gdk
import ImageSelect
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
from QuestionDialog import QuestionDialog, ErrorDialog
import Utils import Utils
import os
import GrampsCfg import GrampsCfg
import const import const
import ImageSelect
import RelImage import RelImage
from QuestionDialog import QuestionDialog, ErrorDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# internationalization # internationalization
@ -187,7 +187,7 @@ class MediaView:
def popup_convert_to_private(self, obj): def popup_convert_to_private(self, obj):
path = self.db.getSavePath() path = self.db.getSavePath()
id = self.obj.getId() id = self.obj.getId()
name = RelImage.import_object(self.obj.getPath(),path,id) name = RelImage.import_media_object(self.obj.getPath(),path,id)
if name: if name:
self.obj.setPath(name) self.obj.setPath(name)
self.obj.setLocal(1) self.obj.setLocal(1)
@ -302,7 +302,7 @@ class MediaView:
if protocol == "file": if protocol == "file":
name = file name = file
mime = Utils.get_mime_type(name) mime = Utils.get_mime_type(name)
photo = Photo() photo = RelLib.Photo()
photo.setPath(name) photo.setPath(name)
photo.setMimeType(mime) photo.setMimeType(mime)
description = os.path.basename(name) description = os.path.basename(name)
@ -332,13 +332,13 @@ class MediaView:
ErrorDialog("%s\n%s %d" % (t,msg[0],msg[1])) ErrorDialog("%s\n%s %d" % (t,msg[0],msg[1]))
return return
mime = Utils.get_mime_type(tfile) mime = Utils.get_mime_type(tfile)
photo = Photo() photo = RelLib.Photo()
photo.setMimeType(mime) photo.setMimeType(mime)
photo.setDescription(d) photo.setDescription(d)
photo.setLocal(1) photo.setLocal(1)
photo.setPath(tfile) photo.setPath(tfile)
self.db.addObject(photo) self.db.addObject(photo)
oref = ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(photo) oref.setReference(photo)
try: try:
id = photo.getId() id = photo.getId()

View File

@ -34,7 +34,7 @@ import const
import Utils import Utils
import AutoComp import AutoComp
import Sources import Sources
from RelLib import * import RelLib
from intl import gettext as _ from intl import gettext as _
@ -114,7 +114,7 @@ class NameEditor:
type = "Also Known As" type = "Also Known As"
if self.name == None: if self.name == None:
self.name = Name() self.name = RelLib.Name()
self.parent.nlist.append(self.name) self.parent.nlist.append(self.name)
self.name.setSourceRefList(self.srcreflist) self.name.setSourceRefList(self.srcreflist)

View File

@ -24,7 +24,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -348,100 +348,6 @@ class PedigreeView:
y*19.0, y*21.0, y*23.0, y*25.0, y*27.0, y*29.0, y*31.0 ] y*19.0, y*21.0, y*23.0, y*25.0, y*27.0, y*29.0, y*31.0 ]
return map(lambda coord, top_pad=top_pad: coord + top_pad, res) return map(lambda coord, top_pad=top_pad: coord + top_pad, res)
def add_box(self, x, y, bwidth, bheight, person, style):
"""Draw a box of the specified size at the specified location.
The box consists of a shadow box for effect, the real box
that contains the information, and the basic text
information. For convience, the all the subelements are
grouped into a GNOME canvas group."""
shadow = _PAD
xpad = _PAD
name = person.getPrimaryName().getName()
group = self.root.add(gnome.canvas.CanvasGroup,x=x,y=y)
self.canvas_items.append(group)
# draw the shadow box
item = group.add(gnome.canvas.CanvasRect, x1=shadow, y1=shadow,
x2=bwidth+shadow, y2=bheight+shadow,
outline_color_gdk=style.dark[gtk.STATE_NORMAL],
fill_color_gdk=style.dark[gtk.STATE_NORMAL])
self.canvas_items.append(item)
# draw the real box
item = group.add(gnome.canvas.CanvasRect, x1=0, y1=0, x2=bwidth, y2=bheight,
outline_color_gdk=style.bg[gtk.STATE_NORMAL],
fill_color_gdk=style.white)
self.canvas_items.append(item)
# Write the text
font = gtk.gdk.font_from_description(style.font_desc)
item = group.add(gnome.canvas.CanvasText, x=xpad, y=bheight/2.0, text=name,
fill_color_gdk=style.text[gtk.STATE_NORMAL],
font=font, anchor=gtk.ANCHOR_WEST)
self.canvas_items.append(item)
group.connect('event',self.box_event)
group.set_data('p',person)
def box_event(self,obj,event):
"""Handle events over a drawn box. Doubleclick would edit,
shift doubleclick would change the active person, entering
the box expands it to display more information, leaving a
box returns it to the original size and information"""
if event.type == gtk.gdk._2BUTTON_PRESS:
# if event.button == 1:
# person = obj.get_data(_PERSON)
# if (event.state & gtk.gdk.SHIFT_MASK) or (event.state & gtk.gdk.CONTROL_MASK):
# self.change_active_person(person)
# del self.presel_descendants[:]
# self.load_canvas(person)
# else:
# self.load_person(person)
return 1
elif event.type == gtk.gdk.ENTER_NOTIFY:
self.expand_box(obj)
return 0
elif event.type == gtk.gdk.LEAVE_NOTIFY:
self.shrink_box(obj)
return 0
return 0
def shrink_box(self,obj):
"""Shrink an exanded box back down to normal size"""
box = self.group_map[obj][1]
x,y,w,h = box.get_bounds()
box.set(x1=x,y1=y,x2=w,y2=h/3)
box2 = self.group_map[obj][2]
x,y,w,h1 = box2.get_bounds()
person = obj.get_data('p')
n = person.getPrimaryName().getName()
box2.set(text=n)
self.update()
self.canvas.update_now()
def expand_box(self,obj):
"""Expand a box to include additional information"""
obj.raise_to_top()
x,y,w,h = box.get_bounds()
box.set(x1=x,y1=y,x2=w,y2=h*3)
box2 = self.group_map[obj][0]
x,y,w,h1 = box2.get_bounds()
box2.set(x1=x,y1=y,x2=w,y2=(3*h)+_PAD)
person = obj.get_data('p')
color = self.canvas.get_style().text[gtk.STATE_NORMAL]
n = "%s\nb. %s.\nd. %s" % (person.getPrimaryName().getName(),
person.getBirth().getDate(),
person.getDeath().getDate())
box2 = self.group_map[obj][2]
box2.set(text=n)
box2.show()
msg = _("Doubleclick to edit, Shift-Doubleclick to make the active person")
self.sb.set_status(msg)
def line_event(self,obj,event): def line_event(self,obj,event):
"""Catch X events over a line and respond to the ones we care about""" """Catch X events over a line and respond to the ones we care about"""
@ -461,18 +367,6 @@ class PedigreeView:
obj.set(fill_color_gdk=style.black, width_pixels=2) obj.set(fill_color_gdk=style.black, width_pixels=2)
self.update() self.update()
def on_canvas1_event(self,obj,event):
"""Handle resize events over the canvas, redrawing if the size changes"""
if event.type == gtk.gdk.EXPOSE:
x1,y1,x2,y2 = self.canvas.get_allocation()
if self.x1 != x1 or self.x2 != x2 or \
self.y1 != y1 or self.y2 != y2:
self.x1 = x1; self.x2 = x2
self.y1 = y1; self.y2 = y2
self.load_canvas(self.active_person)
return 0
def find_tree(self,person,index,depth,list,val=0): def find_tree(self,person,index,depth,list,val=0):
"""Recursively build a list of ancestors""" """Recursively build a list of ancestors"""
@ -492,3 +386,14 @@ class PedigreeView:
if mother != None: if mother != None:
self.find_tree(mother,(2*index)+2,depth+1,list,mrel) self.find_tree(mother,(2*index)+2,depth+1,list,mrel)
def on_canvas1_event(self,obj,event):
"""Handle resize events over the canvas, redrawing if the size changes"""
if event.type == gtk.gdk.EXPOSE:
x1,y1,x2,y2 = self.canvas.get_allocation()
if self.x1 != x1 or self.x2 != x2 or \
self.y1 != y1 or self.y2 != y2:
self.x1 = x1; self.x2 = x2
self.y1 = y1; self.y2 = y2
self.load_canvas(self.active_person)
return 0

View File

@ -36,13 +36,11 @@ import gtk.gdk
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
from QuestionDialog import QuestionDialog, ErrorDialog
import EditPlace import EditPlace
import Utils import Utils
import GrampsCfg
from QuestionDialog import QuestionDialog, ErrorDialog
from intl import gettext as _ from intl import gettext as _
_column_headers = [ _column_headers = [
@ -147,6 +145,7 @@ class PlaceView:
if mlist: if mlist:
EditPlace.EditPlace(self,mlist[0],self.update_display) EditPlace.EditPlace(self,mlist[0],self.update_display)
return 1 return 1
return 0
def new_place_after_edit(self,place): def new_place_after_edit(self,place):
self.db.addPlace(place) self.db.addPlace(place)
@ -158,7 +157,7 @@ class PlaceView:
self.update(0) self.update(0)
def on_add_place_clicked(self,obj): def on_add_place_clicked(self,obj):
EditPlace.EditPlace(self,Place(),self.new_place_after_edit) EditPlace.EditPlace(self,RelLib.Place(),self.new_place_after_edit)
def on_delete_clicked(self,obj): def on_delete_clicked(self,obj):
mlist = [] mlist = []

View File

@ -167,12 +167,12 @@ class PluginDialog:
xpm = data[3] xpm = data[3]
status = data[4] status = data[4]
st = string.join(xpm,'\n') #st = string.join(xpm,'\n')
# image = gtk.gdk.pixbuf_new_from_inline(len(st),st,0) #image = gtk.gdk.pixbuf_new_from_inline(len(st),st,0)
self.description.set_text(doc) self.description.set_text(doc)
self.status.set_text(": %s" % status) self.status.set_text(": %s" % status)
self.label.show() self.label.show()
# self.img.set_from_pixbuf(image) #self.img.set_from_pixbuf(image)
self.title.set_text(title) self.title.set_text(title)
self.dialog.get_widget("title").set_text(title) self.dialog.get_widget("title").set_text(title)

View File

@ -19,7 +19,6 @@
# #
import gtk import gtk
import gnome.ui
from intl import gettext as _ from intl import gettext as _
class QuestionDialog: class QuestionDialog:

View File

@ -26,19 +26,12 @@
import string import string
import os import os
#-------------------------------------------------------------------------
#
# Gnome/GTK
#
#-------------------------------------------------------------------------
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Gramps Modules # Gramps Modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
from GrampsParser import GrampsParser, GrampsImportParser from GrampsParser import GrampsParser, GrampsImportParser
from QuestionDialog import ErrorDialog, WarningDialog from QuestionDialog import ErrorDialog, WarningDialog
from intl import gettext as _ from intl import gettext as _

View File

@ -32,7 +32,7 @@ import string
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog, WarningDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -105,7 +105,7 @@ def scale_image(path,size):
try: try:
image1 = gtk.gdk.pixbuf_new_from_file(path) image1 = gtk.gdk.pixbuf_new_from_file(path)
except: except:
GnomeWarningDialog(_("Could not load image file %s") % path) WarningDialog(_("Could not load image file %s") % path)
return gtk.gdk.pixbuf_new_from_file(const.icon) return gtk.gdk.pixbuf_new_from_file(const.icon)
width = image1.get_width() width = image1.get_width()
@ -116,7 +116,7 @@ def scale_image(path,size):
image1.scale_simple(int(scale*width), int(scale*height), gtk.gdk.INTERP_BILINEAR) image1.scale_simple(int(scale*width), int(scale*height), gtk.gdk.INTERP_BILINEAR)
return image1 return image1
except: except:
GnomeWarningDialog(_("Could not load image file %s") % path) WarningDialog(_("Could not load image file %s") % path)
return gtk.gdk.pixbuf_new_from_file(const.icon) return gtk.gdk.pixbuf_new_from_file(const.icon)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -30,7 +30,6 @@ from intl import gettext as _
# standard python modules # standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,13 +43,9 @@ import gtk.glade
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
import const import const
import sort
import Utils import Utils
import GrampsCfg
import AutoComp
import ListModel import ListModel
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -96,7 +91,7 @@ class SelectChild:
fname = self.person.getPrimaryName().getName() fname = self.person.getPrimaryName().getName()
label = _("Relationship to %s") % fname label = _("Relationship to %s") % fname
if self.person.getGender() == Person.male: if self.person.getGender() == RelLib.Person.male:
self.xml.get_widget("flabel").set_text(label) self.xml.get_widget("flabel").set_text(label)
self.xml.get_widget("mrel_combo").set_sensitive(0) self.xml.get_widget("mrel_combo").set_sensitive(0)
else: else:
@ -118,8 +113,6 @@ class SelectChild:
def redraw_child_list(self,filter): def redraw_child_list(self,filter):
self.refmodel.clear() self.refmodel.clear()
index = 0
bday = self.person.getBirth().getDateObj() bday = self.person.getBirth().getDateObj()
dday = self.person.getDeath().getDateObj() dday = self.person.getDeath().getDateObj()
@ -187,7 +180,7 @@ class SelectChild:
if self.family == None: if self.family == None:
self.family = self.db.newFamily() self.family = self.db.newFamily()
self.person.addFamily(self.family) self.person.addFamily(self.family)
if self.person.getGender() == Person.male: if self.person.getGender() == RelLib.Person.male:
self.family.setFather(self.person) self.family.setFather(self.person)
else: else:
self.family.setMother(self.person) self.family.setMother(self.person)
@ -196,13 +189,13 @@ class SelectChild:
mrel = const.childRelations[self.mrel.get_text()] mrel = const.childRelations[self.mrel.get_text()]
mother = self.family.getMother() mother = self.family.getMother()
if mother and mother.getGender() != Person.female: if mother and mother.getGender() != RelLib.Person.female:
if mrel == "Birth": if mrel == "Birth":
mrel = "Unknown" mrel = "Unknown"
frel = const.childRelations[self.frel.get_text()] frel = const.childRelations[self.frel.get_text()]
father = self.family.getFather() father = self.family.getFather()
if father and father.getGender() != Person.male: if father and father.getGender() !=RelLib. Person.male:
if frel == "Birth": if frel == "Birth":
frel = "Unknown" frel = "Unknown"

View File

@ -38,12 +38,11 @@ import gtk.gdk
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * import RelLib
from QuestionDialog import QuestionDialog
import EditSource import EditSource
import Utils import Utils
import GrampsCfg
from QuestionDialog import QuestionDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -109,9 +108,10 @@ class SourceView:
source = self.db.getSource(id) source = self.db.getSource(id)
EditSource.EditSource(source,self.db,self.update_display) EditSource.EditSource(source,self.db,self.update_display)
return 1 return 1
return 0
def on_add_clicked(self,obj): def on_add_clicked(self,obj):
EditSource.EditSource(Source(),self.db,self.new_after_edit) EditSource.EditSource(RelLib.Source(),self.db,self.new_after_edit)
def on_delete_clicked(self,obj): def on_delete_clicked(self,obj):

View File

@ -34,7 +34,7 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import Utils import Utils
from RelLib import * import RelLib
from intl import gettext as _ from intl import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -50,7 +50,7 @@ class SourceSelector:
self.orig = srclist self.orig = srclist
self.list = [] self.list = []
for s in self.orig: for s in self.orig:
self.list.append(SourceRef(s)) self.list.append(RelLib.SourceRef(s))
self.update=update self.update=update
self.top = gtk.glade.XML(const.srcselFile,"sourcesel") self.top = gtk.glade.XML(const.srcselFile,"sourcesel")
self.top.signal_autoconnect({ self.top.signal_autoconnect({
@ -106,7 +106,7 @@ class SourceSelector:
inst.redraw() inst.redraw()
def add_src_clicked(self,obj): def add_src_clicked(self,obj):
src = SourceRef() src = RelLib.SourceRef()
SourceEditor(src,self.db,self.add_ref,self) SourceEditor(src,self.db,self.add_ref,self)
def del_src_clicked(self,obj): def del_src_clicked(self,obj):
@ -177,7 +177,7 @@ class SourceTab:
SourceEditor(src,self.db,self.update_clist,self) SourceEditor(src,self.db,self.update_clist,self)
def add_src_clicked(self,obj): def add_src_clicked(self,obj):
src = SourceRef() src = RelLib.SourceRef()
SourceEditor(src,self.db,self.add_ref,self) SourceEditor(src,self.db,self.add_ref,self)
def add_ref(self,inst,ref): def add_ref(self,inst,ref):

View File

@ -20,7 +20,6 @@
import const import const
import gtk.glade import gtk.glade
import gnome
import gconf import gconf
import Utils import Utils
@ -75,18 +74,18 @@ class StartupDialog:
dateFormat = 1 dateFormat = 1
else: else:
dateFormat = 2 dateFormat = 2
self.client_set_int("/gramps/config/dateEntry",dateFormat) self.client.set_int("/gramps/config/dateEntry",dateFormat)
showcal = self.druid.get_widget("altcal").get_active() showcal = self.druid.get_widget("altcal").get_active()
self.client_set_int("/gramps/config/ShowCalendar",showcal) self.client.set_int("/gramps/config/ShowCalendar",showcal)
lds = self.druid.get_widget("enable_lds").get_active() lds = self.druid.get_widget("enable_lds").get_active()
self.client_set_int("/gramps/config/UseLDS",lds) self.client.set_int("/gramps/config/UseLDS",lds)
self.client_set_int(_StartupEntry,const.startup) self.client.set_int(_StartupEntry,const.startup)
self.client_sync() self.client.sync()
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)
def on_cancel_clicked(self,obj): def on_cancel_clicked(self,obj):
self.client_set_int(_StartupEntry,const.startup) self.client.set_int(_StartupEntry,const.startup)
self.client_sync() self.client.sync()
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)

View File

@ -30,7 +30,6 @@ __version__ = "$Revision$"
# GNOME/GTK modules # GNOME/GTK modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import gtk.glade
import gtk import gtk
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -70,7 +69,7 @@ class StyleListDisplay:
"on_edit_clicked" : self.on_edit_clicked "on_edit_clicked" : self.on_edit_clicked
}) })
self.list = ListModel.ListModel(self.top.get_widget("list"),[('Style',10,10)]) self.list = ListModel.ListModel(self.top.get_widget("list"),[('Style',-1,10)])
self.redraw() self.redraw()
def redraw(self): def redraw(self):
@ -151,14 +150,15 @@ class StyleEditor:
self.top.signal_autoconnect({ self.top.signal_autoconnect({
"on_save_style_clicked" : self.on_save_style_clicked, "on_save_style_clicked" : self.on_save_style_clicked,
"fg_color_set":self.fg_color_set,
"bg_color_set":self.bg_color_set,
"destroy_passed_object" : Utils.destroy_passed_object "destroy_passed_object" : Utils.destroy_passed_object
}) })
self.window = self.top.get_widget("editor") self.window = self.top.get_widget("editor")
self.pnames = self.top.get_widget("name") self.pnames = self.top.get_widget("name")
self.top.get_widget('color').connect('color-set',self.fg_color_set)
self.top.get_widget('bgcolor').connect('color-set',self.bg_color_set)
self.top.get_widget("style_name").set_text(name) self.top.get_widget("style_name").set_text(name)
myMenu = gtk.Menu() myMenu = gtk.Menu()
first = 0 first = 0
@ -202,16 +202,16 @@ class StyleEditor:
self.top.get_widget("lborder").set_active(p.get_left_border()) self.top.get_widget("lborder").set_active(p.get_left_border())
self.top.get_widget("rborder").set_active(p.get_right_border()) self.top.get_widget("rborder").set_active(p.get_right_border())
self.top.get_widget("bborder").set_active(p.get_bottom_border()) self.top.get_widget("bborder").set_active(p.get_bottom_border())
c = font.get_color() self.fg_color = font.get_color()
self.top.get_widget("color").set_i8(c[0],c[1],c[2],0) self.top.get_widget("color").set_i8(self.fg_color[0],self.fg_color[1],self.fg_color[2],0)
c = p.get_background_color() self.bg_color = p.get_background_color()
self.top.get_widget("bgcolor").set_i8(c[0],c[1],c[2],0) self.top.get_widget("bgcolor").set_i8(self.bg_color[0],self.bg_color[1],self.bg_color[2],0)
def bg_color_set(self,obj,r,g,b,a): def bg_color_set(self,x,r,g,b,a):
print r,g,b,a self.bg_color = (r >> 8, g >> 8, b >> 8)
def fg_color_set(self,obj,r,g,b,a): def fg_color_set(self,x,r,g,b,a):
print r,g,b,ax self.fg_color = (r >> 8, g >> 8, b >> 8)
def save_paragraph(self,p): def save_paragraph(self,p):
"""Saves the current paragraph displayed on the dialog""" """Saves the current paragraph displayed on the dialog"""
@ -244,10 +244,8 @@ class StyleEditor:
p.set_right_border(self.top.get_widget("rborder").get_active()) p.set_right_border(self.top.get_widget("rborder").get_active())
p.set_bottom_border(self.top.get_widget("bborder").get_active()) p.set_bottom_border(self.top.get_widget("bborder").get_active())
c = fg.get_i8() font.set_color(self.fg_color)
font.set_color((c[0],c[1],c[2])) p.set_background_color(self.bg_color)
c = bg.get_i8()
p.set_background_color((c[0],c[1],c[2]))
def on_save_style_clicked(self,obj): def on_save_style_clicked(self,obj):
""" """

View File

@ -32,7 +32,7 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import Utils import Utils
from RelLib import * import RelLib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -68,7 +68,7 @@ class UrlEditor:
priv = self.priv.get_active() priv = self.priv.get_active()
if self.url == None: if self.url == None:
self.url = Url() self.url = RelLib.Url()
self.parent.ulist.append(self.url) self.parent.ulist.append(self.url)
self.update_url(des,addr,priv) self.update_url(des,addr,priv)

View File

@ -554,3 +554,36 @@ def build_columns(tree,list):
column.set_visible(gtk.FALSE) column.set_visible(gtk.FALSE)
cnum = cnum + 1 cnum = cnum + 1
tree.append_column(column) tree.append_column(column)
#-------------------------------------------------------------------------
#
# Iterate over ancestors.
#
#-------------------------------------------------------------------------
def for_each_ancestor(start, func, data):
"""
Recursively iterate (breadth-first) over ancestors of
people listed in start.
Call func(data,pid) for the Id of each person encountered.
Exit and return 1, as soon as func returns true.
Return 0 otherwise.
"""
todo = start
doneIds = {}
while len(todo):
p = todo.pop()
pid = p.getId()
# Don't process the same Id twice. This can happen
# if there is a cycle in the database, or if the
# initial list contains X and some of X's ancestors.
if doneIds.has_key(pid):
continue
doneIds[pid] = 1
if func(data,pid):
return 1
for fam, mrel, frel in p.getParentList():
f = fam.getFather()
m = fam.getMother()
if f: todo.append(f)
if m: todo.append(m)
return 0

View File

@ -40,6 +40,7 @@ import os
import const import const
import GrampsCfg import GrampsCfg
import Calendar import Calendar
import Gregorian
from RelLib import * from RelLib import *
from intl import gettext as _ from intl import gettext as _
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
@ -455,7 +456,7 @@ class XmlWriter:
return return
name = date.get_calendar().NAME name = date.get_calendar().NAME
if name != Calendar.Gregorian.NAME: if name != Gregorian.Gregorian.NAME:
calstr = ' cformat="%s"' % name calstr = ' cformat="%s"' % name
else: else:
calstr = '' calstr = ''

View File

@ -1,5 +1,6 @@
import cStringIO
s0 = { _s0 = {
0xA1 : u'\x01\x41', 0xA2 : u'\xD8', 0xA3 : u'\x01\x10', 0xA1 : u'\x01\x41', 0xA2 : u'\xD8', 0xA3 : u'\x01\x10',
0xA4 : u'\xDE', 0xA5 : u'\xC6', 0xA6 : u'\x01\x52', 0xA4 : u'\xDE', 0xA5 : u'\xC6', 0xA6 : u'\x01\x52',
0xA7 : u'\x02\xB9', 0xA8 : u'\xB7', 0xA9 : u'\x26\x6D', 0xA7 : u'\x02\xB9', 0xA8 : u'\xB7', 0xA9 : u'\x26\x6D',

View File

@ -28,6 +28,13 @@ web site at http://www.scottlee.com
__author__ = "Donald N. Allingham" __author__ = "Donald N. Allingham"
__version__ = "$Revision$" __version__ = "$Revision$"
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import math
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Gramps Modules # Gramps Modules
@ -69,7 +76,7 @@ class Islamic(Calendar.Calendar):
try: try:
return Islamic.M2NUM[unicode(text.lower())] return Islamic.M2NUM[unicode(text.lower())]
except KeyError: except KeyError:
return UNDEF return Calendar.UNDEF
def month(self,val): def month(self,val):
try: try:

View File

@ -28,6 +28,13 @@ web site at http://www.scottlee.com
__author__ = "Donald N. Allingham" __author__ = "Donald N. Allingham"
__version__ = "$Revision$" __version__ = "$Revision$"
#-------------------------------------------------------------------------
#
# python modules
#
#-------------------------------------------------------------------------
import math
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Gramps Modules # Gramps Modules
@ -67,7 +74,7 @@ class Persian(Calendar.Calendar):
try: try:
return Persian.M2NUM[unicode(text.lower())] return Persian.M2NUM[unicode(text.lower())]
except KeyError: except KeyError:
return UNDEF return Calendar.UNDEF
def month(self,val): def month(self,val):
try: try:

View File

@ -922,70 +922,6 @@ class Gramps:
self.status_text(name) self.status_text(name)
return 0 return 0
def on_child_list_row_move(self,clist,fm,to):
"""Validate whether or not this child can be moved within the clist.
This routine is called in the middle of the clist's callbacks, so
the state can be confusing. If the code is being debugged, the
display at this point shows that the list has been reordered when in
actuality it hasn't. All accesses to the clist data structure
reference the state just prior to the move.
This routine must keep/compute its own list indices as the functions
list.remove(), list.insert(), list.reverse() etc. do not affect the
values returned from the list.index() routine."""
family = clist.get_data("f")
# Create a list based upon the current order of the clist
clist_order = []
for i in range(clist.rows):
clist_order = clist_order + [clist.get_row_data(i)]
child = clist_order[fm]
# This function deals with ascending order lists. Convert if
# necessary.
if (self.child_sort.sort_direction() == GTK.SORT_DESCENDING):
clist_order.reverse()
max_index = len(clist_order) - 1
fm = max_index - fm
to = max_index - to
# Create a new list to match the requested order
desired_order = clist_order[:fm] + clist_order[fm+1:]
desired_order = desired_order[:to] + [child] + desired_order[to:]
# Check birth date order in the new list
if (EditPerson.birth_dates_in_order(desired_order) == 0):
clist.emit_stop_by_name("row_move")
msg = _("Invalid move. Children must be ordered by birth date.")
WarningDialog(msg)
return
# OK, this birth order works too. Update the family data structures.
family.setChildList(desired_order)
# Build a mapping of child item to list position. This would not
# be necessary if indices worked properly
i = 0
new_order = {}
for tmp in desired_order:
new_order[tmp] = i
i = i + 1
# Convert the original list back to whatever ordering is being
# used by the clist itself.
if self.child_sort.sort_direction() == GTK.SORT_DESCENDING:
clist_order.reverse()
# Update the clist indices so any change of sorting works
i = 0
for tmp in clist_order:
clist.set_text(i,0,"%2d"%(new_order[tmp]+1))
i = i + 1
# Need to save the changed order
Utils.modified()
def on_open_activate(self,obj): def on_open_activate(self,obj):
wFs = gtk.glade.XML(const.revisionFile, "dbopen") wFs = gtk.glade.XML(const.revisionFile, "dbopen")
wFs.signal_autoconnect({ wFs.signal_autoconnect({

View File

@ -90,7 +90,11 @@ class GraphVizDialog(ReportDialog):
ans.set_name(_("Ancestors of %s") % name) ans.set_name(_("Ancestors of %s") % name)
ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()])) ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()]))
return [all,des,ans] com = GenericFilter.GenericFilter()
com.set_name(_("People with common ancestor with %s") % name)
com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.getId()]))
return [all,des,ans,com]
def add_user_options(self): def add_user_options(self):
self.arrowstyle_optionmenu = gtk.OptionMenu() self.arrowstyle_optionmenu = gtk.OptionMenu()
@ -162,13 +166,21 @@ class GraphVizDialog(ReportDialog):
_("Non-birth relationships will show up " _("Non-birth relationships will show up "
"as dashed lines in the graph.")) "as dashed lines in the graph."))
self.show_families_cb = gtk.CheckButton(_("Show family nodes"))
self.show_families_cb.set_active(0)
self.add_frame_option(_("GraphViz Options"),
'',
self.show_families_cb,
_("Families will show up as circles, linked "
"to parents and children."))
tb_margin_adj = gtk.Adjustment(value=0.5, lower=0.25, tb_margin_adj = gtk.Adjustment(value=0.5, lower=0.25,
upper=100.0, step_incr=0.25) upper=100.0, step_incr=0.25)
lr_margin_adj = gtk.Adjustment(value=0.5, lower=0.25, lr_margin_adj = gtk.Adjustment(value=0.5, lower=0.25,
upper=100.0, step_incr=0.25) upper=100.0, step_incr=0.25)
self.tb_margin_sb = gtk.SpinButton(adj=tb_margin_adj, digits=2) self.tb_margin_sb = gtk.SpinButton(adjustment=tb_margin_adj, digits=2)
self.lr_margin_sb = gtk.SpinButton(adj=lr_margin_adj, digits=2) self.lr_margin_sb = gtk.SpinButton(adjustment=lr_margin_adj, digits=2)
self.add_frame_option(_("GraphViz Options"), self.add_frame_option(_("GraphViz Options"),
_("Top & Bottom Margins"), _("Top & Bottom Margins"),
@ -180,8 +192,8 @@ class GraphVizDialog(ReportDialog):
hpages_adj = gtk.Adjustment(value=1, lower=1, upper=25, step_incr=1) hpages_adj = gtk.Adjustment(value=1, lower=1, upper=25, step_incr=1)
vpages_adj = gtk.Adjustment(value=1, lower=1, upper=25, step_incr=1) vpages_adj = gtk.Adjustment(value=1, lower=1, upper=25, step_incr=1)
self.hpages_sb = gtk.SpinButton(adj=hpages_adj, digits=0) self.hpages_sb = gtk.SpinButton(adjustment=hpages_adj, digits=0)
self.vpages_sb = gtk.SpinButton(adj=vpages_adj, digits=0) self.vpages_sb = gtk.SpinButton(adjustment=vpages_adj, digits=0)
self.add_frame_option(_("GraphViz Options"), self.add_frame_option(_("GraphViz Options"),
_("Number of Horizontal Pages"), _("Number of Horizontal Pages"),
@ -239,12 +251,13 @@ class GraphVizDialog(ReportDialog):
self.arrowheadstyle, self.arrowtailstyle = menu.get_active().get_data('t') self.arrowheadstyle, self.arrowtailstyle = menu.get_active().get_data('t')
self.includedates = self.includedates_cb.get_active() self.includedates = self.includedates_cb.get_active()
self.includeurl = self.includeurl_cb.get_active() self.includeurl = self.includeurl_cb.get_active()
self.tb_margin = self.tb_margin_sb.get_value_as_float() self.tb_margin = self.tb_margin_sb.get_value()
self.lr_margin = self.lr_margin_sb.get_value_as_float() self.lr_margin = self.lr_margin_sb.get_value()
self.colorize = self.colorize_cb.get_active() self.colorize = self.colorize_cb.get_active()
self.adoptionsdashed = self.adoptionsdashed_cb.get_active() self.adoptionsdashed = self.adoptionsdashed_cb.get_active()
self.hpages = self.hpages_sb.get_value_as_int() self.hpages = self.hpages_sb.get_value_as_int()
self.vpages = self.vpages_sb.get_value_as_int() self.vpages = self.vpages_sb.get_value_as_int()
self.show_families = self.show_families_cb.get_active()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -258,12 +271,13 @@ class GraphVizDialog(ReportDialog):
file = open(self.target_path,"w") file = open(self.target_path,"w")
ind_list = self.filter.apply(self.db.getPersonMap().values()) ind_list = self.filter.apply(self.db, self.db.getPersonMap().values())
write_dot(file, ind_list, self.orien, width, height, write_dot(file, ind_list, self.orien, width, height,
self.tb_margin, self.lr_margin, self.hpages, self.tb_margin, self.lr_margin, self.hpages,
self.vpages, self.includedates, self.includeurl, self.vpages, self.includedates, self.includeurl,
self.colorize, self.adoptionsdashed, self.arrowheadstyle, self.arrowtailstyle) self.colorize, self.adoptionsdashed, self.arrowheadstyle,
self.arrowtailstyle, self.show_families)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -280,23 +294,26 @@ def report(database,person):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def write_dot(file, ind_list, orien, width, height, tb_margin, def write_dot(file, ind_list, orien, width, height, tb_margin,
lr_margin, hpages, vpages, includedates, includeurl, lr_margin, hpages, vpages, includedates, includeurl,
colorize, adoptionsdashed, arrowheadstyle, arrowtailstyle): colorize, adoptionsdashed, arrowheadstyle, arrowtailstyle,
show_families):
file.write("digraph g {\n") file.write("digraph g {\n")
file.write("bgcolor=white;\n") file.write("bgcolor=white;\n")
file.write("rankdir=LR;\n") file.write("rankdir=LR;\n")
file.write("center=1;\n") file.write("center=1;\n")
file.write("margin=0.5;\n") file.write("margin=0.5;\n")
file.write("ratio=fill;\n") file.write("ratio=fill;\n")
file.write("size=\"%3.1fin,%3.1fin\";\n" % ((width*hpages)-(lr_margin*2)-((hpages-1)*1.0), file.write("size=\"%3.1f,%3.1f\";\n" % ((width*hpages)-(lr_margin*2)-((hpages-1)*1.0),
(height*vpages)-(tb_margin*2)-((vpages-1)*1.0))) (height*vpages)-(tb_margin*2)-((vpages-1)*1.0)))
file.write("page=\"%3.1fin,%3.1fin\";\n" % (width,height)) file.write("page=\"%3.1f,%3.1f\";\n" % (width,height))
if orien == PAPER_LANDSCAPE: if orien == PAPER_LANDSCAPE:
file.write("rotate=90;\n") file.write("rotate=90;\n")
if len(ind_list) > 1: if len(ind_list) > 1:
dump_index(ind_list,file,includedates,includeurl,colorize) dump_index(ind_list,file,includedates,includeurl,colorize,
dump_person(ind_list,file,adoptionsdashed,arrowheadstyle,arrowtailstyle) arrowheadstyle,arrowtailstyle,show_families)
dump_person(ind_list,file,adoptionsdashed,arrowheadstyle,
arrowtailstyle,show_families)
file.write("}\n") file.write("}\n")
file.close() file.close()
@ -306,28 +323,50 @@ def write_dot(file, ind_list, orien, width, height, tb_margin,
# #
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,arrowtailstyle): def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,
arrowtailstyle,show_families):
# Hash people in a dictionary for faster inclusion checking.
person_dict = {}
for p in person_list:
person_dict[p] = 1
for person in person_list: for person in person_list:
pid = string.replace(person.getId(),'-','_') pid = string.replace(person.getId(),'-','_')
family, mrel, frel = person.getMainParentsRel() for family, mrel, frel in person.getParentList():
if family == None:
continue
father = family.getFather() father = family.getFather()
if father and father in person_list: mother = family.getMother()
fid = string.replace(father.getId(),'-','_') fadopted = frel != _("Birth")
file.write('p%s -> p%s [' % (pid, fid)) madopted = mrel != _("Birth")
file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) if show_families and (person_dict.has_key(father) or
if adoptionsdashed and frel != _("Birth"): person_dict.has_key(mother)):
# Link to the family node.
famid = string.replace(family.getId(),'-','_')
file.write('p%s -> f%s [' % (pid, famid))
file.write('arrowhead=%s, arrowtail=%s, ' %
(arrowheadstyle, arrowtailstyle))
if adoptionsdashed and (fadopted or madopted):
file.write('style=dashed') file.write('style=dashed')
else: else:
file.write('style=solid') file.write('style=solid')
file.write('];\n') file.write('];\n')
mother = family.getMother() else:
if mother and mother in person_list: # Link to the parents' nodes directly.
if father and person_dict.has_key(father):
fid = string.replace(father.getId(),'-','_')
file.write('p%s -> p%s [' % (pid, fid))
file.write('arrowhead=%s, arrowtail=%s, ' %
(arrowheadstyle, arrowtailstyle))
if adoptionsdashed and fadopted:
file.write('style=dashed')
else:
file.write('style=solid')
file.write('];\n')
if mother and person_dict.has_key(mother):
mid = string.replace(mother.getId(),'-','_') mid = string.replace(mother.getId(),'-','_')
file.write('p%s -> p%s [' % (pid, mid)) file.write('p%s -> p%s [' % (pid, mid))
file.write('arrowhead=%s, arrowtail=%s, ' % (arrowheadstyle, arrowtailstyle)) file.write('arrowhead=%s, arrowtail=%s, ' %
if adoptionsdashed and mrel != _("Birth"): (arrowheadstyle, arrowtailstyle))
if adoptionsdashed and madopted:
file.write('style=dashed') file.write('style=dashed')
else: else:
file.write('style=solid') file.write('style=solid')
@ -338,8 +377,13 @@ def dump_person(person_list,file,adoptionsdashed,arrowheadstyle,arrowtailstyle):
# #
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def dump_index(person_list,file,includedates,includeurl,colorize): def dump_index(person_list,file,includedates,includeurl,colorize,
arrowheadstyle,arrowtailstyle,show_families):
# The list of families for which we have output the node, so we
# don't do it twice.
families_done = []
for person in person_list: for person in person_list:
# Output the person's node.
label = person.getPrimaryName().getName() label = person.getPrimaryName().getName()
id = string.replace(person.getId(),'-','_') id = string.replace(person.getId(),'-','_')
if includedates: if includedates:
@ -364,6 +408,21 @@ def dump_index(person_list,file,includedates,includeurl,colorize):
else: else:
file.write('color=black, ') file.write('color=black, ')
file.write('fontname="Arial", label="%s"];\n' % label) file.write('fontname="Arial", label="%s"];\n' % label)
# Output families's nodes.
if show_families:
family_list = person.getFamilyList()
for fam in family_list:
fid = string.replace(fam.getId(),'-','_')
if fam not in families_done:
file.write('f%s [shape=circle, label="", ' % fid)
file.write('weight=8, height=.3];\n')
# Link this person to all his/her families.
file.write('f%s -> p%s [' % (fid, id))
file.write('arrowhead=%s, arrowtail=%s, ' %
(arrowheadstyle, arrowtailstyle))
file.write('style=solid];\n')
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -38,7 +38,6 @@ import time
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gtk.glade import gtk.glade
import gnome.ui
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -46,9 +45,12 @@ import gnome.ui
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * from RelLib import *
import Julian
import FrenchRepublic
import Hebrew
import Date import Date
from ansel_utf8 import ansel_to_utf8 from ansel_utf8 import ansel_to_utf8
import latin_utf8 import latin_utf8
import Utils import Utils
from GedcomInfo import * from GedcomInfo import *
@ -1569,11 +1571,11 @@ class GedcomParser:
pass pass
if cal1 == "FRENCH R": if cal1 == "FRENCH R":
dateobj.set_calendar(Date.FRENCH) dateobj.set_calendar(FrenchRepublic.FrenchRepublic)
elif cal1 == "JULIAN": elif cal1 == "JULIAN":
dateobj.set_calendar(Date.JULIAN) dateobj.set_calendar(Julian.Julian)
elif cal1 == "HEBREW": elif cal1 == "HEBREW":
dateobj.set_calendar(Date.HEBREW) dateobj.set_calendar(Hebrew.Hebrew)
dateobj.get_start_date().set(data1) dateobj.get_start_date().set(data1)
dateobj.get_stop_date().set(data2) dateobj.get_stop_date().set(data2)
dateobj.set_range(1) dateobj.set_range(1)
@ -1583,11 +1585,11 @@ class GedcomParser:
if match: if match:
(abt,cal,data) = match.groups() (abt,cal,data) = match.groups()
if cal == "FRENCH R": if cal == "FRENCH R":
dateobj.set_calendar(Date.FRENCH) dateobj.set_calendar(FrenchRepublic.FrenchRepublic)
elif cal == "JULIAN": elif cal == "JULIAN":
dateobj.set_calendar(Date.JULIAN) dateobj.set_calendar(Julian.Julian)
elif cal == "HEBREW": elif cal == "HEBREW":
dateobj.set_calendar(Date.HEBREW) dateobj.set_calendar(Hebrew.Hebrew)
dateobj.set(data) dateobj.set(data)
if abt: if abt:
dateobj.get_start_date().setMode(abt) dateobj.get_start_date().setMode(abt)
@ -1615,7 +1617,6 @@ class GedcomParser:
def resolve_refns(self): def resolve_refns(self):
prefix = self.db.iprefix prefix = self.db.iprefix
renamed = []
index = 0 index = 0
new_pmax = self.db.pmapIndex new_pmax = self.db.pmapIndex
pmap = self.db.getPersonMap() pmap = self.db.getPersonMap()

View File

@ -50,6 +50,10 @@ import const
import Utils import Utils
import Date import Date
import Calendar import Calendar
import Julian
import Hebrew
import FrenchRepublic
from intl import gettext as _ from intl import gettext as _
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
from GedcomInfo import * from GedcomInfo import *
@ -66,7 +70,7 @@ except:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_hmonth = [ _hmonth = [
"", "ELUL", "TSH", "CSH", "KSL", "TVT", "SHV", "ADR",
"ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ] "ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ]
_fmonth = [ _fmonth = [
@ -78,9 +82,9 @@ _month = [
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]
_calmap = { _calmap = {
Calendar.Hebrew : (_hmonth, '@#HEBREW@'), Hebrew.Hebrew.NAME : (_hmonth, '@#HEBREW@'),
Calendar.FrenchRepublic : (_fmonth, '@#FRENCH R@'), FrenchRepublic.FrenchRepublic.NAME : (_fmonth, '@#FRENCH R@'),
Calendar.Julian : (_month, '@#JULIAN@'), Julian.Julian.NAME : (_month, '@#JULIAN@'),
} }
_caldef = { _caldef = {
@ -201,14 +205,8 @@ def make_date(subdate):
mon_valid = subdate.getMonthValid() mon_valid = subdate.getMonthValid()
year_valid = subdate.getYearValid() year_valid = subdate.getYearValid()
# Adjust `mon' so it can be used as index in our _Xmonth arrays. if _calmap.has_key(subdate.calendar.NAME):
if mon_valid: (mmap,prefix) = _calmap[subdate.calendar.NAME]
mon += 1
else:
mon = 0
if _calmap.has_key(subdate.calendar):
(mmap,prefix) = _calmap[subdate.calendar]
else: else:
mmap = _month mmap = _month
prefix = "" prefix = ""
@ -780,7 +778,7 @@ class GedcomWriter:
text = addr_append(text,addr.getPostal()) text = addr_append(text,addr.getPostal())
text = addr_append(text,addr.getCountry()) text = addr_append(text,addr.getCountry())
if text: if text:
self.g.write("2 PLAC %s\n" % string.replace(self.cnvtxt(text)),'\r',' ') self.g.write("2 PLAC %s\n" % string.replace(self.cnvtxt(text),'\r',' '))
if addr.getNote(): if addr.getNote():
self.write_long_text("NOTE",3,self.cnvtxt(addr.getNote())) self.write_long_text("NOTE",3,self.cnvtxt(addr.getNote()))
for srcref in addr.getSourceRefList(): for srcref in addr.getSourceRefList():