* 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 3714eb6ef0
commit a2c6076b4f
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>
* src/DateDisplay.py (display): Display text for text-only dates.
Closes # 1036846.

View File

@ -478,5 +478,5 @@ class Date:
date, and having year, month, and day all non-zero.
"""
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()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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