Cleanup
svn: r624
This commit is contained in:
parent
a81fd54c10
commit
050c213402
@ -17,14 +17,13 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
"""
|
||||||
|
Calendar conversion routines for GRAMPS.
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
The original algorithms for this module came from Scott E. Lee's
|
||||||
#
|
C implementation. The original C source can be found at Scott's
|
||||||
# The original algorithms for this module came from Scott E. Lee's
|
web site at http://www.scottlee.com
|
||||||
# C implementation. The original C source can be found at Scott's
|
"""
|
||||||
# web site at http://www.scottlee.com
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
_FR_SDN_OFFSET = 2375474
|
_FR_SDN_OFFSET = 2375474
|
||||||
_FR_DAYS_PER_4_YEARS = 1461
|
_FR_DAYS_PER_4_YEARS = 1461
|
||||||
@ -51,9 +50,9 @@ _SUNDAY = 0
|
|||||||
_MONDAY = 1
|
_MONDAY = 1
|
||||||
_TUESDAY = 2
|
_TUESDAY = 2
|
||||||
_WEDNESDAY= 3
|
_WEDNESDAY= 3
|
||||||
_THURSDAY = 4
|
#_THURSDAY = 4
|
||||||
_FRIDAY = 5
|
_FRIDAY = 5
|
||||||
_SATURDAY = 6
|
#_SATURDAY = 6
|
||||||
|
|
||||||
_NOON = (18 * _HALAKIM_PER_HOUR)
|
_NOON = (18 * _HALAKIM_PER_HOUR)
|
||||||
_AM3_11_20 = ((9 * _HALAKIM_PER_HOUR) + 204)
|
_AM3_11_20 = ((9 * _HALAKIM_PER_HOUR) + 204)
|
||||||
|
@ -94,6 +94,10 @@ UNDEF = -999999
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Date:
|
class Date:
|
||||||
|
"""
|
||||||
|
The core date handling class for GRAMPs. Supports partial dates,
|
||||||
|
date ranges, and alternate calendars.
|
||||||
|
"""
|
||||||
formatCode = 0
|
formatCode = 0
|
||||||
entryCode = 0
|
entryCode = 0
|
||||||
|
|
||||||
@ -480,7 +484,7 @@ class SingleDate:
|
|||||||
d = "-%02d" % self.day
|
d = "-%02d" % self.day
|
||||||
return "%s%s%s" % (y,m,d)
|
return "%s%s%s" % (y,m,d)
|
||||||
|
|
||||||
def get_fmt1(self):
|
def _format1(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -513,7 +517,7 @@ class SingleDate:
|
|||||||
retval = _("after") + ' ' + retval
|
retval = _("after") + ' ' + retval
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_fmt2(self):
|
def _format2(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.month != UNDEF and self.month != UNDEF:
|
elif self.month != UNDEF and self.month != UNDEF:
|
||||||
@ -543,7 +547,7 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_fmt3(self):
|
def _format3(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -572,7 +576,7 @@ class SingleDate:
|
|||||||
retval = "%s %s" % (_("AFTER"),retval)
|
retval = "%s %s" % (_("AFTER"),retval)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_fmt10(self):
|
def _format10(self):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -601,7 +605,7 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_mmddyyyy(self,sep):
|
def _get_mmddyyyy(self,sep):
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
return ""
|
return ""
|
||||||
elif self.day == UNDEF:
|
elif self.day == UNDEF:
|
||||||
@ -628,7 +632,7 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_yyyymmdd(self,sep):
|
def _get_yyyymmdd(self,sep):
|
||||||
retval = ""
|
retval = ""
|
||||||
|
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
@ -658,16 +662,16 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_fmt4(self):
|
def _format4(self):
|
||||||
return self.get_mmddyyyy("/")
|
return self._get_mmddyyyy("/")
|
||||||
|
|
||||||
def get_fmt5(self):
|
def _format5(self):
|
||||||
return self.get_mmddyyyy("-")
|
return self._get_mmddyyyy("-")
|
||||||
|
|
||||||
def get_fmt8(self):
|
def _format8(self):
|
||||||
return self.get_mmddyyyy(".")
|
return self._get_mmddyyyy(".")
|
||||||
|
|
||||||
def get_ddmmyyyy(self,sep):
|
def _get_ddmmyyyy(self,sep):
|
||||||
retval = ""
|
retval = ""
|
||||||
|
|
||||||
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF :
|
||||||
@ -696,32 +700,32 @@ class SingleDate:
|
|||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def get_fmt6(self):
|
def _format6(self):
|
||||||
return self.get_ddmmyyyy("/")
|
return self._get_ddmmyyyy("/")
|
||||||
|
|
||||||
def get_fmt7(self):
|
def _format7(self):
|
||||||
return self.get_ddmmyyyy("-")
|
return self._get_ddmmyyyy("-")
|
||||||
|
|
||||||
def get_fmt9(self):
|
def _format9(self):
|
||||||
return self.get_ddmmyyyy(".")
|
return self._get_ddmmyyyy(".")
|
||||||
|
|
||||||
def get_fmt11(self):
|
def _format11(self):
|
||||||
return self.get_yyyymmdd("/")
|
return self._get_yyyymmdd("/")
|
||||||
|
|
||||||
def get_fmt12(self):
|
def _format12(self):
|
||||||
return self.get_yyyymmdd("-")
|
return self._get_yyyymmdd("-")
|
||||||
|
|
||||||
def get_fmt13(self):
|
def _format13(self):
|
||||||
return self.get_yyyymmdd(".")
|
return self._get_yyyymmdd(".")
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
fmtFunc = [ get_fmt1, get_fmt2, get_fmt3, get_fmt4, get_fmt5, get_fmt6,
|
fmtFunc = [ _format1, _format2, _format3, _format4, _format5, _format6,
|
||||||
get_fmt7, get_fmt8, get_fmt9, get_fmt10, get_fmt11, get_fmt12,
|
_format7, _format8, _format9, _format10, _format11, _format12,
|
||||||
get_fmt13]
|
_format13]
|
||||||
|
|
||||||
def display_calendar(self,month_map):
|
def display_calendar(self,month_map):
|
||||||
if self.year==UNDEF:
|
if self.year==UNDEF:
|
||||||
|
@ -168,9 +168,9 @@ def on_merge_activate(obj):
|
|||||||
gnome.ui.GnomeErrorDialog(msg)
|
gnome.ui.GnomeErrorDialog(msg)
|
||||||
else:
|
else:
|
||||||
import MergeData
|
import MergeData
|
||||||
p1 = person_list.get_row_data(person_list.selection[0])
|
(p1,x) = person_list.get_row_data(person_list.selection[0])
|
||||||
p2 = person_list.get_row_data(person_list.selection[1])
|
(p2,x) = person_list.get_row_data(person_list.selection[1])
|
||||||
MergeData.MergePeople(database,p1[0],p2[0],merge_update)
|
MergeData.MergePeople(database,p1,p2,merge_update)
|
||||||
elif page == 4:
|
elif page == 4:
|
||||||
place_view.merge()
|
place_view.merge()
|
||||||
|
|
||||||
@ -604,8 +604,8 @@ def load_selected_people(obj):
|
|||||||
gnome.ui.GnomeErrorDialog(msg)
|
gnome.ui.GnomeErrorDialog(msg)
|
||||||
else:
|
else:
|
||||||
for p in person_list.selection:
|
for p in person_list.selection:
|
||||||
person = person_list.get_row_data(p)
|
(person,x) = person_list.get_row_data(p)
|
||||||
load_person(person[0])
|
load_person(person)
|
||||||
|
|
||||||
def load_active_person(obj):
|
def load_active_person(obj):
|
||||||
load_person(active_person)
|
load_person(active_person)
|
||||||
@ -695,7 +695,7 @@ def remove_from_person_list(person):
|
|||||||
del alt2col[person]
|
del alt2col[person]
|
||||||
|
|
||||||
if row > person_list.rows:
|
if row > person_list.rows:
|
||||||
(active_person,alt) = person_list.get_row_data(row)
|
(active_person,x) = person_list.get_row_data(row)
|
||||||
person_list.thaw()
|
person_list.thaw()
|
||||||
|
|
||||||
def merge_update(p1,p2):
|
def merge_update(p1,p2):
|
||||||
@ -724,7 +724,7 @@ def on_delete_parents_clicked(obj):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_person_list_select_row(obj,row,b,c):
|
def on_person_list_select_row(obj,row,b,c):
|
||||||
if row == obj.selection[0]:
|
if row == obj.selection[0]:
|
||||||
person,alt = obj.get_row_data(row)
|
(person,x) = obj.get_row_data(row)
|
||||||
change_active_person(person)
|
change_active_person(person)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -856,7 +856,7 @@ def goto_active_person():
|
|||||||
person_list.unselect_all()
|
person_list.unselect_all()
|
||||||
person_list.select_row(0,0)
|
person_list.select_row(0,0)
|
||||||
person_list.moveto(0)
|
person_list.moveto(0)
|
||||||
person,alt = person_list.get_row_data(0)
|
(person,x) = person_list.get_row_data(0)
|
||||||
change_active_person(person)
|
change_active_person(person)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1296,7 +1296,7 @@ def redisplay_person_list(person):
|
|||||||
|
|
||||||
if Config.hide_altnames == 0:
|
if Config.hide_altnames == 0:
|
||||||
for name in person.getAlternateNames():
|
for name in person.getAlternateNames():
|
||||||
pos2 = (person,1)
|
pos2 = (person,0)
|
||||||
alt2col[person].append(pos2)
|
alt2col[person].append(pos2)
|
||||||
person_list.insert(0,[gname(name,1),person.getId(),
|
person_list.insert(0,[gname(name,1),person.getId(),
|
||||||
gender,bday.getQuoteDate(),
|
gender,bday.getQuoteDate(),
|
||||||
@ -1694,7 +1694,7 @@ def displayError(msg):
|
|||||||
def apply_filter():
|
def apply_filter():
|
||||||
global id2col
|
global id2col
|
||||||
global alt2col
|
global alt2col
|
||||||
|
|
||||||
person_list.freeze()
|
person_list.freeze()
|
||||||
datacomp = DataFilter.compare
|
datacomp = DataFilter.compare
|
||||||
gname = utils.phonebook_from_name
|
gname = utils.phonebook_from_name
|
||||||
@ -1702,6 +1702,8 @@ def apply_filter():
|
|||||||
person_list.set_column_visibility(1,Config.id_visible)
|
person_list.set_column_visibility(1,Config.id_visible)
|
||||||
new_alt2col = {}
|
new_alt2col = {}
|
||||||
|
|
||||||
|
bsn = sort.build_sort_name
|
||||||
|
bsd = sort.build_sort_date
|
||||||
for person in database.getPersonMap().values():
|
for person in database.getPersonMap().values():
|
||||||
if datacomp(person):
|
if datacomp(person):
|
||||||
if id2col.has_key(person):
|
if id2col.has_key(person):
|
||||||
@ -1718,16 +1720,15 @@ def apply_filter():
|
|||||||
else:
|
else:
|
||||||
gender = const.unknown
|
gender = const.unknown
|
||||||
|
|
||||||
|
name = person.getPrimaryName()
|
||||||
bday = person.getBirth().getDateObj()
|
bday = person.getBirth().getDateObj()
|
||||||
dday = person.getDeath().getDateObj()
|
dday = person.getDeath().getDateObj()
|
||||||
sort_bday = sort.build_sort_date(bday)
|
sort_bday = bsd(bday)
|
||||||
sort_dday = sort.build_sort_date(dday)
|
sort_dday = bsd(dday)
|
||||||
qbday = bday.getQuoteDate()
|
qbday = bday.getQuoteDate()
|
||||||
qdday = dday.getQuoteDate()
|
qdday = dday.getQuoteDate()
|
||||||
pid = person.getId()
|
pid = person.getId()
|
||||||
bsn = sort.build_sort_name
|
|
||||||
|
|
||||||
name = person.getPrimaryName()
|
|
||||||
values = [gname(name,0), pid, gender, qbday, qdday,
|
values = [gname(name,0), pid, gender, qbday, qdday,
|
||||||
bsn(name), sort_bday, sort_dday ]
|
bsn(name), sort_bday, sort_dday ]
|
||||||
person_list.insert(0,values)
|
person_list.insert(0,values)
|
||||||
@ -1735,9 +1736,9 @@ def apply_filter():
|
|||||||
|
|
||||||
if Config.hide_altnames:
|
if Config.hide_altnames:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for name in person.getAlternateNames():
|
for name in person.getAlternateNames():
|
||||||
pos = (person,1)
|
pos = (person,0)
|
||||||
new_alt2col[person].append(pos)
|
new_alt2col[person].append(pos)
|
||||||
|
|
||||||
values = [gname(name,1), pid, gender, qbday, qdday,
|
values = [gname(name,1), pid, gender, qbday, qdday,
|
||||||
|
Loading…
Reference in New Issue
Block a user