diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 318fefbb7..0cb6435b1 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -134,6 +134,7 @@ ODDFGCOLOR = "oddForeground" ODDBGCOLOR = "oddBackground" EVENFGCOLOR = "evenForeground" EVENBGCOLOR = "evenBackground" +ANCESTORFGCOLOR = "ancestorForeground" INDEX = "i" OBJECT = "o" DATA = "d" @@ -251,6 +252,7 @@ def loadConfig(call): ListColors.oddbg = get_config_color(ODDBGCOLOR,(0xffff,0xffff,0xffff)) ListColors.evenfg = get_config_color(EVENFGCOLOR,(0,0,0)) ListColors.evenbg = get_config_color(EVENBGCOLOR,(0xffff,0xffff,0xffff)) + ListColors.ancestorfg = get_config_color(ANCESTORFGCOLOR,(0,0,0)) if paper_preference == None: paper_preference = "Letter" @@ -531,11 +533,13 @@ def on_propertybox_apply(obj,page): ListColors.oddbg = prefsTop.get_widget(ODDBGCOLOR).get_i16() ListColors.evenfg = prefsTop.get_widget(EVENFGCOLOR).get_i16() ListColors.evenbg = prefsTop.get_widget(EVENBGCOLOR).get_i16() + ListColors.ancestorfg = prefsTop.get_widget(ANCESTORFGCOLOR).get_i16() save_config_color(ODDFGCOLOR,ListColors.oddfg) save_config_color(ODDBGCOLOR,ListColors.oddbg) save_config_color(EVENFGCOLOR,ListColors.evenfg) save_config_color(EVENBGCOLOR,ListColors.evenbg) + save_config_color(ANCESTORFGCOLOR,ListColors.ancestorfg) owner.set(name,addr,city,state,country,postal,phone,email) store_researcher(owner) @@ -592,6 +596,7 @@ def on_color_toggled(obj): prefsTop.get_widget(ODDBGCOLOR).set_sensitive(active) prefsTop.get_widget(EVENFGCOLOR).set_sensitive(active) prefsTop.get_widget(EVENBGCOLOR).set_sensitive(active) + prefsTop.get_widget(ANCESTORFGCOLOR).set_sensitive(active) obj.changed() #------------------------------------------------------------------------- @@ -759,11 +764,16 @@ def display_preferences_box(db): cwidget.set_i16(ListColors.evenbg[0],ListColors.evenbg[1],\ ListColors.evenbg[2],0xffff) + cwidget = prefsTop.get_widget(ANCESTORFGCOLOR) + cwidget.set_i16(ListColors.ancestorfg[0],ListColors.ancestorfg[1],\ + ListColors.ancestorfg[2],0xffff) + prefsTop.get_widget("enableColors").set_active(ListColors.get_enable()) prefsTop.get_widget(ODDFGCOLOR).set_sensitive(ListColors.get_enable()) prefsTop.get_widget(ODDBGCOLOR).set_sensitive(ListColors.get_enable()) prefsTop.get_widget(EVENBGCOLOR).set_sensitive(ListColors.get_enable()) prefsTop.get_widget(EVENFGCOLOR).set_sensitive(ListColors.get_enable()) + prefsTop.get_widget(ANCESTORFGCOLOR).set_sensitive(ListColors.get_enable()) prefsTop.get_widget("dbdir").gtk_entry().set_text(db_dir) prefsTop.get_widget("repdir").gtk_entry().set_text(report_dir) diff --git a/gramps/src/ListColors.py b/gramps/src/ListColors.py index bde3168f2..75c57400b 100644 --- a/gramps/src/ListColors.py +++ b/gramps/src/ListColors.py @@ -25,6 +25,7 @@ oddbg = (0xffff,0xffff,0xffff) evenbg = (0xffff,0xffff,0xffff) oddfg = (0,0,0) evenfg = (0,0,0) +ancestorfg = (0,0,0) class ColorList: def __init__(self,clist,increment): diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 73e13c599..2e42ab0e5 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -773,6 +773,7 @@ class Person: self.note = None self.paf_uid = "" self.position = None + self.ancestor = None def setPrimaryName(self,name): """sets the primary name of the Person to the specified Name instance""" @@ -1009,6 +1010,19 @@ class Person: """returns a graphical location pointer for graphic display (x,y)""" return self.position + def setAncestor(self, value): + """set ancestor flag and recurse""" + self.ancestor = value + family = self.MainFamily + if family: + if family.Father: + family.Father.setAncestor(value) + if (family.Mother): + family.Mother.setAncestor(value) + + def getAncestor(self): + return self.ancestor + class Event(DataObj): """Event record, recording the event type, description, place, and date of a particular event""" @@ -1219,7 +1233,12 @@ class Family: def setFather(self,person): """sets the father of the Family to the specfied Person""" - self.Father = person + update = self.someChildIsAncestor() + if update and self.Father: + self.Father.setAncestor(0) + self.Father = person + if update and self.Father: + self.Father.setAncestor(1) def getFather(self): """returns the father of the Family""" @@ -1227,7 +1246,12 @@ class Family: def setMother(self,person): """sets the mother of the Family to the specfied Person""" - self.Mother = person + update = self.someChildIsAncestor() + if self.Mother and update: + self.Mother.setAncestor(0) + self.Mother = person + if update and self.Mother: + self.Mother.setAncestor(1) def getMother(self): """returns the mother of the Family""" @@ -1238,15 +1262,21 @@ class Family: to the child list""" if person not in self.Children: self.Children.append(person) + if person.ancestor: + if self.Father: + self.Father.setAncestor(1) + if (self.Mother): + self.Mother.setAncestor(1) + def removeChild(self,person): """removes the specified Person from the child list""" - index = 0 - for child in self.Children: - if child == person: - del self.Children[index] - return - index = index + 1 + self.Children.remove(person) + if person.ancestor: + if self.Father: + self.Father.setAncestor(0) + if (self.Mother): + self.Mother.setAncestor(0) def getChildList(self): """returns the list of children""" @@ -1294,6 +1324,12 @@ class Family: """Sets the list of Photo objects""" self.photoList = list + def someChildIsAncestor(self): + for child in self.Children: + if (child.ancestor): + return 1 + return None + class Source: """A record of a source of information""" @@ -1558,7 +1594,10 @@ class RelDataBase: def setDefaultPerson(self,person): """sets the default Person to the passed instance""" + if (self.default): + self.default.setAncestor(0) self.default = person + self.default.setAncestor(1) def getDefaultPerson(self): """returns the default Person of the database""" diff --git a/gramps/src/config.glade b/gramps/src/config.glade index 79e723acd..ab14235f2 100644 --- a/gramps/src/config.glade +++ b/gramps/src/config.glade @@ -1028,7 +1028,7 @@ GtkTable table22 - 5 + 6 2 False 0 @@ -1282,6 +1282,61 @@ False + + + GnomeColorPicker + ancestorForeground + True + + color_set + on_color_set + propertybox + Fri, 02 Nov 2001 05:09:36 GMT + + True + False + Pick a color + + 1 + 2 + 5 + 6 + 5 + 5 + False + False + False + False + False + False + + + + + GtkLabel + label215 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 5 + 6 + 5 + 0 + False + False + False + False + True + False + + diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index b49d03d0d..03b2442e0 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -938,13 +938,15 @@ def sort_child_list(clist): oddfg = GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2]) evenbg = GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2]) evenfg = GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2]) + ancestorfg = GdkColor(ListColors.ancestorfg[0],ListColors.ancestorfg[1],ListColors.ancestorfg[2]) rows = clist.rows - for i in range(0,rows,2): - clist.set_background(i,oddbg) - clist.set_foreground(i,oddfg) - if i != rows: - clist.set_background(i+1,evenbg) - clist.set_foreground(i+1,evenfg) + for i in range(0,rows): + clist.set_background(i,(evenbg,oddbg)[i%2]) + person = clist.get_row_data(i) + if (person.getAncestor()): + clist.set_foreground(i,ancestorfg) + else: + clist.set_foreground(i,(evenfg,oddfg)[i%2]) except OverflowError: pass clist.thaw()