* src/Date.py: fix get_month_valid call

* src/DateDisplay.py: pychecker fixes
* src/EditPerson.py: pychecker fixes
* src/GrampDbBase.py: pychecker fixes
* src/Marriage.py: bring up to date with the DateParser
* src/PeopleView.py: pychecker fixes
* src/RelLib.py: pychecker fixes


svn: r3594
This commit is contained in:
Don Allingham 2004-10-03 21:04:54 +00:00
parent 690a7e126a
commit 825828690e
8 changed files with 52 additions and 52 deletions

View File

@ -1,3 +1,12 @@
2004-10-03 Don Allingham <dallingham@users.sourceforge.net>
* src/Date.py: fix get_month_valid call
* src/DateDisplay.py: pychecker fixes
* src/EditPerson.py: pychecker fixes
* src/GrampDbBase.py: pychecker fixes
* src/Marriage.py: bring up to date with the DateParser
* src/PeopleView.py: pychecker fixes
* src/RelLib.py: pychecker fixes
2004-10-02 Alex Roitman <shura@alex.neuro.umn.edu> 2004-10-02 Alex Roitman <shura@alex.neuro.umn.edu>
* src/DateDisplay.py (display): Display text for text-only dates. * src/DateDisplay.py (display): Display text for text-only dates.
Closes # 1036846. Closes # 1036846.

View File

@ -478,5 +478,5 @@ class Date:
date, and having year, month, and day all non-zero. date, and having year, month, and day all non-zero.
""" """
return self.modifier == MOD_NONE and self.quality == QUAL_NONE\ return self.modifier == MOD_NONE and self.quality == QUAL_NONE\
and self.get_year_valid() and self.get_month_valid\ and self.get_year_valid() and self.get_month_valid()\
and self.get_day_valid() and self.get_day_valid()

View File

@ -30,7 +30,6 @@ __version__ = "$Revision$"
import Date import Date
import locale import locale
import time
class DateDisplay: class DateDisplay:
""" """
@ -206,54 +205,55 @@ class DateDisplay:
# YYYY-MM-DD (ISO) # YYYY-MM-DD (ISO)
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
return year value = year
else: else:
return "%s-%d" % (year,date_val[1]) value = "%s-%d" % (year,date_val[1])
else: else:
return "%s-%d-%d" % (year,date_val[1],date_val[0]) value = "%s-%d-%d" % (year,date_val[1],date_val[0])
elif self.format == 1: elif self.format == 1:
if date_val[0] == 0 and date_val[1] == 0: if date_val[0] == 0 and date_val[1] == 0:
return str(date_val[2]) value = str(date_val[2])
else: else:
val = self._tformat.replace('%m',str(date_val[1])) value = self._tformat.replace('%m',str(date_val[1]))
val = val.replace('%d',str(date_val[0])) value = value.replace('%d',str(date_val[0]))
return val.replace('%Y',str(date_val[2])) value = value.replace('%Y',str(date_val[2]))
elif self.format == 2: elif self.format == 2:
# Month Day, Year # Month Day, Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
return year value = year
else: else:
return "%s %s" % (self._months[date_val[1]],year) value = "%s %s" % (self._months[date_val[1]],year)
else: else:
return "%s %d, %s" % (self._months[date_val[1]],date_val[0],year) value = "%s %d, %s" % (self._months[date_val[1]],date_val[0],year)
elif self.format == 3: elif self.format == 3:
# MON Day, Year # MON Day, Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
return year value = year
else: else:
return "%s %s" % (self._MONS[date_val[1]].upper(),year) value = "%s %s" % (self._MONS[date_val[1]],year)
else: else:
return "%s %d, %s" % (self._MONS[date_val[1]].upper(),date_val[0],year) value = "%s %d, %s" % (self._MONS[date_val[1]],date_val[0],year)
elif self.format == 4: elif self.format == 4:
# Day Month Year # Day Month Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
return year value = year
else: else:
return "%s %s" % (self._months[date_val[1]],year) value = "%s %s" % (self._months[date_val[1]],year)
else: else:
return "%d %s %s" % (date_val[0],self._months[date_val[1]],year) value = "%d %s %s" % (date_val[0],self._months[date_val[1]],year)
else: else:
# Day MON Year # Day MON Year
if date_val[0] == 0: if date_val[0] == 0:
if date_val[1] == 0: if date_val[1] == 0:
return year value = year
else: else:
return "%s %s" % (self._MONS[date_val[1]].upper(),year) value = "%s %s" % (self._MONS[date_val[1]],year)
else: else:
return "%d %s %s" % (date_val[0],self._MONS[date_val[1]].upper(),year) value = "%d %s %s" % (date_val[0],self._MONS[date_val[1]],year)
return value
def _display_julian(self,date_val): def _display_julian(self,date_val):
# Julian date display is the same as Gregorian # Julian date display is the same as Gregorian

View File

@ -26,7 +26,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import pickle import pickle
import time
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1133,7 +1132,7 @@ class EditPerson:
changed = True changed = True
if self.pname.get_note() != name.get_note(): if self.pname.get_note() != name.get_note():
changed = True changed = True
if self.lds_not_loaded == False and self.check_lds(): if not self.lds_not_loaded and self.check_lds():
changed = True changed = True
bplace = unicode(self.bplace.get_text().strip()) bplace = unicode(self.bplace.get_text().strip())
@ -1142,7 +1141,6 @@ class EditPerson:
if self.pdmap.has_key(bplace): if self.pdmap.has_key(bplace):
self.birth.set_place_handle(self.pdmap[bplace]) self.birth.set_place_handle(self.pdmap[bplace])
else: else:
p1 = None
if bplace != "": if bplace != "":
changed = True changed = True
self.birth.set_place_handle('') self.birth.set_place_handle('')
@ -1150,7 +1148,6 @@ class EditPerson:
if self.pdmap.has_key(dplace): if self.pdmap.has_key(dplace):
self.death.set_place_handle(self.pdmap[dplace]) self.death.set_place_handle(self.pdmap[dplace])
else: else:
p1 = None
if dplace != "": if dplace != "":
changed = True changed = True
self.death.set_place_handle('') self.death.set_place_handle('')
@ -1170,7 +1167,7 @@ class EditPerson:
if format != self.person.get_note_format(): if format != self.person.get_note_format():
changed = True changed = True
if self.lds_not_loaded == False: if not self.lds_not_loaded:
if not self.lds_baptism.are_equal(self.person.get_lds_baptism()): if not self.lds_baptism.are_equal(self.person.get_lds_baptism()):
changed= True changed= True
@ -1580,7 +1577,7 @@ class EditPerson:
temp_family.set_mother_handle(None) temp_family.set_mother_handle(None)
temp_family.set_father_handle(self.person) temp_family.set_father_handle(self.person)
if error == True: if error:
msg2 = _("Problem changing the gender") msg2 = _("Problem changing the gender")
msg = _("Changing the gender caused problems " msg = _("Changing the gender caused problems "
"with marriage information.\nPlease check " "with marriage information.\nPlease check "
@ -1600,7 +1597,7 @@ class EditPerson:
if self.complete.get_active() != self.person.get_complete_flag(): if self.complete.get_active() != self.person.get_complete_flag():
self.person.set_complete_flag(self.complete.get_active()) self.person.set_complete_flag(self.complete.get_active())
if self.lds_not_loaded == False: if not self.lds_not_loaded:
self.check_lds() self.check_lds()
lds_ord = RelLib.LdsOrd(self.person.get_lds_baptism()) lds_ord = RelLib.LdsOrd(self.person.get_lds_baptism())
if not self.lds_baptism.are_equal(lds_ord): if not self.lds_baptism.are_equal(lds_ord):
@ -1744,7 +1741,7 @@ class EditPerson:
else: else:
Utils.unbold_label(self.notes_label) Utils.unbold_label(self.notes_label)
if self.lds_not_loaded == False: if not self.lds_not_loaded:
self.check_lds() self.check_lds()
if self.lds_baptism.is_empty() \ if self.lds_baptism.is_empty() \
and self.lds_endowment.is_empty() \ and self.lds_endowment.is_empty() \

View File

@ -34,9 +34,11 @@ from RelLib import *
import cPickle import cPickle
import time import time
import locale import locale
import re
from gettext import gettext as _ from gettext import gettext as _
import GrampsGconfKeys import GrampsGconfKeys
import Utils
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,7 +46,7 @@ import GrampsGconfKeys
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_UNDO_SIZE = 1000 _UNDO_SIZE = 1000
_id_reg = compile("%\d+d") _id_reg = re.compile("%\d+d")
PERSON_KEY = 0 PERSON_KEY = 0
FAMILY_KEY = 1 FAMILY_KEY = 1

View File

@ -32,7 +32,6 @@ import gtk
import gtk.gdk import gtk.gdk
import gtk.glade import gtk.glade
import gnome import gnome
import gobject
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -47,7 +46,7 @@ import AutoComp
import ListModel import ListModel
import RelLib import RelLib
import ImageSelect import ImageSelect
import Date import DateHandler
import Sources import Sources
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
@ -84,6 +83,7 @@ class Marriage:
self.cb = callback self.cb = callback
self.update_fv = update self.update_fv = update
self.pmap = {} self.pmap = {}
self.dp = DateHandler.create_parser()
if family: if family:
self.srcreflist = family.get_source_references() self.srcreflist = family.get_source_references()
@ -542,9 +542,8 @@ 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.Date() d = self.dp.parse(date)
d.set(date) if d.is_equal(lds_ord.get_date_object()) or \
if Date.compare_dates(d,lds_ord.get_date_object()) != 0 or \
lds_ord.get_temple() != temple or \ lds_ord.get_temple() != temple or \
(place and lds_ord.get_place_handle() != place.get_handle()) or \ (place and lds_ord.get_place_handle() != place.get_handle()) or \
lds_ord.get_status() != self.seal_stat: lds_ord.get_status() != self.seal_stat:
@ -624,9 +623,8 @@ class Marriage:
lds_ord.set_place_handle(place) lds_ord.set_place_handle(place)
self.family.set_lds_sealing(lds_ord) self.family.set_lds_sealing(lds_ord)
else: else:
d = Date.Date() d = self.dp.parse(date)
d.set(date) if d.is_equal(lds_ord.get_date_object()):
if Date.compare_dates(d,lds_ord.get_date_object()) != 0:
lds_ord.set_date_object(d) lds_ord.set_date_object(d)
if lds_ord.get_temple() != temple: if lds_ord.get_temple() != temple:
lds_ord.set_temple(temple) lds_ord.set_temple(temple)

View File

@ -115,15 +115,14 @@ class PeopleView:
index += 1 index += 1
def build_tree(self): def build_tree(self):
import time
t = time.time()
self.person_model = PeopleModel.PeopleModel(self.parent.db) self.person_model = PeopleModel.PeopleModel(self.parent.db)
#self.sort_model = self.person_model.filter_new() #self.sort_model = self.person_model.filter_new()
self.sort_model = self.person_model self.sort_model = self.person_model
self.person_tree.set_model(self.sort_model) self.person_tree.set_model(self.sort_model)
def blist(self, store, path, iter, id_list): def blist(self, store, path, node, id_list):
id_list.append(self.sort_model.get_value(iter,PeopleModel.COLUMN_INT_ID)) id_list.append(self.sort_model.get_value(node,
PeopleModel.COLUMN_INT_ID))
def get_selected_objects(self): def get_selected_objects(self):
mlist = [] mlist = []
@ -146,7 +145,6 @@ class PeopleView:
def change_db(self,db): def change_db(self,db):
self.build_columns() self.build_columns()
maps = db.get_people_view_maps()
self.person_model = PeopleModel.PeopleModel(db) self.person_model = PeopleModel.PeopleModel(db)
#self.sort_model = self.person_model.filter_new() #self.sort_model = self.person_model.filter_new()
self.sort_model = self.person_model self.sort_model = self.person_model
@ -266,11 +264,11 @@ class PeopleView:
top = person.get_primary_name().get_group_name() top = person.get_primary_name().get_group_name()
if len(self.person_model.sname_sub[top]) == 1: if len(self.person_model.sname_sub[top]) == 1:
path = self.person_model.on_get_path(top) path = self.person_model.on_get_path(top)
iter = self.person_model.get_iter(path) node = self.person_model.get_iter(path)
self.person_model.row_inserted(path,iter) self.person_model.row_inserted(path,node)
path = self.person_model.on_get_path(node) path = self.person_model.on_get_path(node)
iter = self.person_model.get_iter(path) node = self.person_model.get_iter(path)
self.person_model.row_inserted(path,iter) self.person_model.row_inserted(path,node)
def delete_person(self,person): def delete_person(self,person):
node = person.get_handle() node = person.get_handle()

View File

@ -31,12 +31,10 @@ __version__ = "$Revision$"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gettext import gettext as _ from gettext import gettext as _
from re import compile
import os import os
import os.path import os.path
import time import time
import types
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,11 +42,9 @@ import types
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Date import Date
import DateParser
import DateHandler import DateHandler
import GrampsCfg import GrampsCfg
import const import const
import Utils
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -226,7 +222,7 @@ class Person(PrimaryObject,SourceNote):
male = 1 male = 1
female = 0 female = 0
def __init__(self,handle=""): def __init__(self):
"""creates a new Person instance""" """creates a new Person instance"""
PrimaryObject.__init__(self) PrimaryObject.__init__(self)
SourceNote.__init__(self) SourceNote.__init__(self)