From 050c213402ed35b9e3ca2664be1de6ad1df1896d Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 16 Dec 2001 03:25:56 +0000 Subject: [PATCH] Cleanup svn: r624 --- gramps/src/Calendar.py | 17 ++++++----- gramps/src/Date.py | 60 +++++++++++++++++++++------------------ gramps/src/gramps_main.py | 33 ++++++++++----------- 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/gramps/src/Calendar.py b/gramps/src/Calendar.py index 0671bf155..659c743d8 100644 --- a/gramps/src/Calendar.py +++ b/gramps/src/Calendar.py @@ -17,14 +17,13 @@ # along with this program; if not, write to the Free Software # 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 -# web site at http://www.scottlee.com -# -#------------------------------------------------------------------- +The original algorithms for this module came from Scott E. Lee's +C implementation. The original C source can be found at Scott's +web site at http://www.scottlee.com +""" _FR_SDN_OFFSET = 2375474 _FR_DAYS_PER_4_YEARS = 1461 @@ -51,9 +50,9 @@ _SUNDAY = 0 _MONDAY = 1 _TUESDAY = 2 _WEDNESDAY= 3 -_THURSDAY = 4 +#_THURSDAY = 4 _FRIDAY = 5 -_SATURDAY = 6 +#_SATURDAY = 6 _NOON = (18 * _HALAKIM_PER_HOUR) _AM3_11_20 = ((9 * _HALAKIM_PER_HOUR) + 204) diff --git a/gramps/src/Date.py b/gramps/src/Date.py index c4b3adbf9..477ef5949 100644 --- a/gramps/src/Date.py +++ b/gramps/src/Date.py @@ -94,6 +94,10 @@ UNDEF = -999999 # #------------------------------------------------------------------------- class Date: + """ + The core date handling class for GRAMPs. Supports partial dates, + date ranges, and alternate calendars. + """ formatCode = 0 entryCode = 0 @@ -480,7 +484,7 @@ class SingleDate: d = "-%02d" % self.day 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 : return "" elif self.day == UNDEF: @@ -513,7 +517,7 @@ class SingleDate: retval = _("after") + ' ' + retval return retval - def get_fmt2(self): + def _format2(self): if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" elif self.month != UNDEF and self.month != UNDEF: @@ -543,7 +547,7 @@ class SingleDate: return retval - def get_fmt3(self): + def _format3(self): if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" elif self.day == UNDEF: @@ -572,7 +576,7 @@ class SingleDate: retval = "%s %s" % (_("AFTER"),retval) return retval - def get_fmt10(self): + def _format10(self): if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" elif self.day == UNDEF: @@ -601,7 +605,7 @@ class SingleDate: return retval - def get_mmddyyyy(self,sep): + def _get_mmddyyyy(self,sep): if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" elif self.day == UNDEF: @@ -628,7 +632,7 @@ class SingleDate: return retval - def get_yyyymmdd(self,sep): + def _get_yyyymmdd(self,sep): retval = "" if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : @@ -658,16 +662,16 @@ class SingleDate: return retval - def get_fmt4(self): - return self.get_mmddyyyy("/") + def _format4(self): + return self._get_mmddyyyy("/") - def get_fmt5(self): - return self.get_mmddyyyy("-") + def _format5(self): + return self._get_mmddyyyy("-") - def get_fmt8(self): - return self.get_mmddyyyy(".") + def _format8(self): + return self._get_mmddyyyy(".") - def get_ddmmyyyy(self,sep): + def _get_ddmmyyyy(self,sep): retval = "" if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : @@ -696,32 +700,32 @@ class SingleDate: return retval - def get_fmt6(self): - return self.get_ddmmyyyy("/") + def _format6(self): + return self._get_ddmmyyyy("/") - def get_fmt7(self): - return self.get_ddmmyyyy("-") + def _format7(self): + return self._get_ddmmyyyy("-") - def get_fmt9(self): - return self.get_ddmmyyyy(".") + def _format9(self): + return self._get_ddmmyyyy(".") - def get_fmt11(self): - return self.get_yyyymmdd("/") + def _format11(self): + return self._get_yyyymmdd("/") - def get_fmt12(self): - return self.get_yyyymmdd("-") + def _format12(self): + return self._get_yyyymmdd("-") - def get_fmt13(self): - return self.get_yyyymmdd(".") + def _format13(self): + return self._get_yyyymmdd(".") #-------------------------------------------------------------------- # # # #-------------------------------------------------------------------- - fmtFunc = [ get_fmt1, get_fmt2, get_fmt3, get_fmt4, get_fmt5, get_fmt6, - get_fmt7, get_fmt8, get_fmt9, get_fmt10, get_fmt11, get_fmt12, - get_fmt13] + fmtFunc = [ _format1, _format2, _format3, _format4, _format5, _format6, + _format7, _format8, _format9, _format10, _format11, _format12, + _format13] def display_calendar(self,month_map): if self.year==UNDEF: diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 4dde76636..b8f30dd89 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -168,9 +168,9 @@ def on_merge_activate(obj): gnome.ui.GnomeErrorDialog(msg) else: import MergeData - p1 = person_list.get_row_data(person_list.selection[0]) - p2 = person_list.get_row_data(person_list.selection[1]) - MergeData.MergePeople(database,p1[0],p2[0],merge_update) + (p1,x) = person_list.get_row_data(person_list.selection[0]) + (p2,x) = person_list.get_row_data(person_list.selection[1]) + MergeData.MergePeople(database,p1,p2,merge_update) elif page == 4: place_view.merge() @@ -604,8 +604,8 @@ def load_selected_people(obj): gnome.ui.GnomeErrorDialog(msg) else: for p in person_list.selection: - person = person_list.get_row_data(p) - load_person(person[0]) + (person,x) = person_list.get_row_data(p) + load_person(person) def load_active_person(obj): load_person(active_person) @@ -695,7 +695,7 @@ def remove_from_person_list(person): del alt2col[person] 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() 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): if row == obj.selection[0]: - person,alt = obj.get_row_data(row) + (person,x) = obj.get_row_data(row) change_active_person(person) #------------------------------------------------------------------------- @@ -856,7 +856,7 @@ def goto_active_person(): person_list.unselect_all() person_list.select_row(0,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) #------------------------------------------------------------------------- @@ -1296,7 +1296,7 @@ def redisplay_person_list(person): if Config.hide_altnames == 0: for name in person.getAlternateNames(): - pos2 = (person,1) + pos2 = (person,0) alt2col[person].append(pos2) person_list.insert(0,[gname(name,1),person.getId(), gender,bday.getQuoteDate(), @@ -1694,7 +1694,7 @@ def displayError(msg): def apply_filter(): global id2col global alt2col - + person_list.freeze() datacomp = DataFilter.compare gname = utils.phonebook_from_name @@ -1702,6 +1702,8 @@ def apply_filter(): person_list.set_column_visibility(1,Config.id_visible) new_alt2col = {} + bsn = sort.build_sort_name + bsd = sort.build_sort_date for person in database.getPersonMap().values(): if datacomp(person): if id2col.has_key(person): @@ -1718,16 +1720,15 @@ def apply_filter(): else: gender = const.unknown + name = person.getPrimaryName() bday = person.getBirth().getDateObj() dday = person.getDeath().getDateObj() - sort_bday = sort.build_sort_date(bday) - sort_dday = sort.build_sort_date(dday) + sort_bday = bsd(bday) + sort_dday = bsd(dday) qbday = bday.getQuoteDate() qdday = dday.getQuoteDate() pid = person.getId() - bsn = sort.build_sort_name - name = person.getPrimaryName() values = [gname(name,0), pid, gender, qbday, qdday, bsn(name), sort_bday, sort_dday ] person_list.insert(0,values) @@ -1735,9 +1736,9 @@ def apply_filter(): if Config.hide_altnames: continue - + for name in person.getAlternateNames(): - pos = (person,1) + pos = (person,0) new_alt2col[person].append(pos) values = [gname(name,1), pid, gender, qbday, qdday,