From 24946bfd7f9fa1c28978efbde1ffafeffe7ae4a9 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 29 Oct 2004 00:49:40 +0000 Subject: [PATCH] * src/Date.py: Added "set_year" function * src/Utils.py: qualifiy Date calls, eliminate string module usage * src/edit_sm.png: new image * src/Makefile.am: install edit_sm.png * src/gramps_main.py: update relationship calculator on database change * src/Ancestors.py: initialize born_info svn: r3687 --- ChangeLog | 10 ++++++++ src/AutoComp.py | 52 +++++++++++++++++++-------------------- src/Date.py | 5 ++++ src/Makefile.am | 3 ++- src/Utils.py | 24 +++++++++--------- src/edit_sm.png | Bin 0 -> 1029 bytes src/gramps_main.py | 2 ++ src/plugins/Ancestors.py | 1 + 8 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 src/edit_sm.png diff --git a/ChangeLog b/ChangeLog index b25abdf8c..72fe88383 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-10-28 Don Allingham + * src/Date.py: Added "set_year" function + * src/Utils.py: qualifiy Date calls, eliminate string + module usage + * src/edit_sm.png: new image + * src/Makefile.am: install edit_sm.png + * src/gramps_main.py: update relationship calculator + on database change + * src/Ancestors.py: initialize born_info + 2004-10-28 Alex Roitman * src/plugins/DetDescendantReport.py: New Date usage. diff --git a/src/AutoComp.py b/src/AutoComp.py index c89ebda05..0540c1501 100644 --- a/src/AutoComp.py +++ b/src/AutoComp.py @@ -29,37 +29,37 @@ import gtk import gobject def fill_combo(combo,data_list): - store = gtk.ListStore(gobject.TYPE_STRING) + store = gtk.ListStore(gobject.TYPE_STRING) - for data in data_list: - store.append(row=[data]) - - combo.set_model(store) - combo.set_text_column(0) - completion = gtk.EntryCompletion() - completion.set_model(store) - completion.set_minimum_key_length(1) - completion.set_text_column(0) - combo.child.set_completion(completion) + for data in data_list: + store.append(row=[data]) + + combo.set_model(store) + combo.set_text_column(0) + completion = gtk.EntryCompletion() + completion.set_model(store) + completion.set_minimum_key_length(1) + completion.set_text_column(0) + combo.child.set_completion(completion) def fill_entry(entry,data_list): - store = gtk.ListStore(gobject.TYPE_STRING) - for data in data_list: - store.append(row=[data]) + store = gtk.ListStore(gobject.TYPE_STRING) + for data in data_list: + store.append(row=[data]) - completion = gtk.EntryCompletion() - completion.set_model(store) - completion.set_minimum_key_length(1) - completion.set_text_column(0) - entry.set_completion(completion) + completion = gtk.EntryCompletion() + completion.set_model(store) + completion.set_minimum_key_length(1) + completion.set_text_column(0) + entry.set_completion(completion) def fill_option_text(combobox,data): - store = gtk.ListStore(gobject.TYPE_STRING) - for item in data: - store.append(row=[item]) - combobox.set_model(store) - combobox.set_active(0) + store = gtk.ListStore(gobject.TYPE_STRING) + for item in data: + store.append(row=[item]) + combobox.set_model(store) + combobox.set_active(0) def get_option(combobox): - store = combobox.get_model() - return store.get_value(combobox.get_active_iter(),0) + store = combobox.get_model() + return store.get_value(combobox.get_active_iter(),0) diff --git a/src/Date.py b/src/Date.py index c609ea6b3..784a15508 100644 --- a/src/Date.py +++ b/src/Date.py @@ -317,6 +317,11 @@ class Date: """ return self._get_low_item(_POS_YR) + def set_year(self,year): + """ + """ + self.dateval = self.dateval[0:2] + (year,) + self.dateval[3:] + def get_year_valid(self): return self._get_low_item_valid(_POS_YR) diff --git a/src/Makefile.am b/src/Makefile.am index dcc1a4d86..105041c4c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -122,6 +122,7 @@ GRAPHICS = \ bad.png\ caution.png\ edit.png\ + edit_sm.png \ family48.png\ good.png\ home.png\ @@ -154,4 +155,4 @@ pycheck: docs: epydoc -o doc --url http://gramps.sourceforge.net --name GRAMPS --html $(docfiles) - epydoc --pdf $(docfiles) \ No newline at end of file + epydoc --pdf $(docfiles) diff --git a/src/Utils.py b/src/Utils.py index 77c6c2582..5625eaf3a 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -25,7 +25,6 @@ # Standard python modules # #------------------------------------------------------------------------- -import string import os import locale @@ -43,7 +42,6 @@ import gnome # #------------------------------------------------------------------------- import const -import RelImage import GrampsMime import Date @@ -257,7 +255,7 @@ def view_photo(photo): except: return - args = string.split(prog) + args = prog.split() args.append(photo.get_path()) if os.fork() == 0: @@ -269,10 +267,10 @@ def view_photo(photo): # #------------------------------------------------------------------------- def strip_id(text): - index = string.rfind(text,'[') + index = text.rfind('[') if (index > 0): text = text[:index] - text = string.rstrip(text) + text = text.rstrip() return text def nautilus_icon(icon,mime_type): @@ -502,8 +500,8 @@ def bold_label(label): def unbold_label(label): text = unicode(label.get_text()) - text = string.replace(text,'','') - text = string.replace(text,'','') + text = text.replace('','') + text = text.replace('','') label.set_text(text) label.set_use_markup(0) @@ -564,15 +562,17 @@ def probably_alive(person,db): child_birth = db.get_event_from_handle(child.birth_handle) dobj = child_birth.get_date_object() if dobj.get_start_date() != Date.EMPTY: - d = Date(dobj) - d.set_year(d.get_year() - years) + d = Date.Date(dobj) + val = d.get_start_date() + val = (val[0],val[1],d.get_year() - years,val[3]) + d.set_year(val) if not not_too_old (d): return True if child.death_handle: child_death = db.get_event_from_handle(child.death_handle) dobj = child_death.get_date_object() - if dobj.get_start_date != Date.EMPTY: + if dobj.get_start_date() != Date.EMPTY: if not not_too_old (dobj): return True @@ -627,7 +627,7 @@ def probably_alive(person,db): if sp_birth_handle: spouse_birth = db.get_event_from_handle(sp_birth_handle) if not spouse_birth.get_date().is_empty(): - d = Date(spouse_birth.get_date_object()) + d = Date.Date(spouse_birth.get_date_object()) d.set_year(d.get_year() + max_age_difference) if not not_too_old (d): return False @@ -635,7 +635,7 @@ def probably_alive(person,db): if sp_death_handle: spouse_death = db.get_event_from_handle(sp_death_handle) if spouse_death.get_date() != "": - d = Date(spouse_death.get_date_object()) + d = Date.Date(spouse_death.get_date_object()) d.set_year (d.get_year() - min_generation) if not not_too_old (d): return False diff --git a/src/edit_sm.png b/src/edit_sm.png new file mode 100644 index 0000000000000000000000000000000000000000..1cc0a2313d74a2685f87c9466999c3166d050e8a GIT binary patch literal 1029 zcmV+g1p51lP)L*_zs!D6#v^Q?ER#k;MuXU_(6 zb8{arEG%4e9LMHA!nSQwE|)jg*Vlizb?eq+pa9J1!Q$d#eQ9awt2mC0l+s8kO;Hpk z&-2k;Ydw~&R!iQzdGqHRH*S1%>eQ(Tz#0`)N?F5`BuPlqlqiabqKG(-$+8S%jszHE z&{`veaAs#`uPiJqe0kx*g|`9s80Ze^mg6`mr5FqbXsxjf3|lrMpfMWX_o-AWR6VEm^=H?wh7>#Zo14G8 zCuigPK0)Ao1;q4}V(D*LMH@ zU`(Ob8qf2n)h6lp`*@y*F$N(7T1zkzOK14j0eaBHO}b8N=c#k&&fR={qq+TCZ!md6 zp+ak$q9};t0dYJaNm5Fs097Q&G{v)GT=|Un@CmzH4|ufp(EReJI9&ZJd$hH8_`<>t_SuPI}!v znxA5)v(4@AzUAP>Hq#XiCTDYho>yPL#I=hTId|?HGc(haN+le}Mr$+nCyW85lthCF z%MDQ8Bt6SxI(&ssK0HsO(O_z7iXaHEZF|fF#(*(;92iBBYPB{G!f>YV`GGz4ayWFs z1ijt?ah#k0F;ZoWq1|pD?(V*bPfE3FwOXmsXuJ`I;hREa6=RHLSvIz9k3jzxQ4}TZ zcKczs+g$@9KwCpomw@Wf