In the family mode view, color direct ancestors of the home person.

svn: r538
This commit is contained in:
David Hampton 2001-11-02 05:13:06 +00:00
parent bb516839b2
commit f43c3cf7b4
5 changed files with 122 additions and 15 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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"""

View File

@ -1028,7 +1028,7 @@
<widget>
<class>GtkTable</class>
<name>table22</name>
<rows>5</rows>
<rows>6</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -1282,6 +1282,61 @@
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GnomeColorPicker</class>
<name>ancestorForeground</name>
<can_focus>True</can_focus>
<signal>
<name>color_set</name>
<handler>on_color_set</handler>
<object>propertybox</object>
<last_modification_time>Fri, 02 Nov 2001 05:09:36 GMT</last_modification_time>
</signal>
<dither>True</dither>
<use_alpha>False</use_alpha>
<title>Pick a color</title>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label215</name>
<label>Ancestor Foreground</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>5</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>

View File

@ -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()