Fix color allocation

svn: r813
This commit is contained in:
Don Allingham 2002-03-05 01:09:41 +00:00
parent 83cd367728
commit ffc10d4a61
2 changed files with 17 additions and 16 deletions

View File

@ -18,8 +18,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
from gtk import GdkColor
_enable = 0 _enable = 0
oddbg = (0xffff,0xffff,0xffff) oddbg = (0xffff,0xffff,0xffff)
evenbg = (0xffff,0xffff,0xffff) evenbg = (0xffff,0xffff,0xffff)
@ -35,10 +33,11 @@ class ColorList:
self.clist = clist self.clist = clist
self.color_ok = 1 self.color_ok = 1
try: try:
self.oddbg = GdkColor(oddbg[0],oddbg[1],oddbg[2]) cmap = clist.get_colormap()
self.oddfg = GdkColor(oddfg[0],oddfg[1],oddfg[2]) self.oddbg = cmap.alloc(oddbg[0],oddbg[1],oddbg[2])
self.evenbg = GdkColor(evenbg[0],evenbg[1],evenbg[2]) self.oddfg = cmap.alloc(oddfg[0],oddfg[1],oddfg[2])
self.evenfg = GdkColor(evenfg[0],evenfg[1],evenfg[2]) self.evenbg = cmap.alloc(evenbg[0],evenbg[1],evenbg[2])
self.evenfg = cmap.alloc(evenfg[0],evenfg[1],evenfg[2])
except OverflowError: except OverflowError:
self.color_ok = 0 self.color_ok = 0

View File

@ -913,10 +913,11 @@ class Gramps:
levenbg = ListColors.evenbg levenbg = ListColors.evenbg
levenfg = ListColors.evenfg levenfg = ListColors.evenfg
oddbg = gtk.GdkColor(loddbg[0],loddbg[1],loddbg[2]) cmap = self.topWindow.get_colormap()
oddfg = gtk.GdkColor(loddfg[0],loddfg[1],loddfg[2]) oddbg = cmap.alloc(loddbg[0],loddbg[1],loddbg[2])
evenbg = gtk.GdkColor(levenbg[0],levenbg[1],levenbg[2]) oddfg = cmap.alloc(loddfg[0],loddfg[1],loddfg[2])
evenfg = gtk.GdkColor(levenfg[0],levenfg[1],levenfg[2]) evenbg = cmap.alloc(levenbg[0],levenbg[1],levenbg[2])
evenfg = cmap.alloc(levenfg[0],levenfg[1],levenfg[2])
rows = self.person_list.rows rows = self.person_list.rows
for i in range(0,rows,2): for i in range(0,rows,2):
self.person_list.set_background(i,oddbg) self.person_list.set_background(i,oddbg)
@ -1032,11 +1033,12 @@ class Gramps:
levenfg = ListColors.evenfg levenfg = ListColors.evenfg
lafg = ListColors.ancestorfg lafg = ListColors.ancestorfg
oddbg = gtk.GdkColor(loddbg[0],loddbg[1],loddbg[2]) cmap = self.topWindow.get_colormap()
oddfg = gtk.GdkColor(loddfg[0],loddfg[1],loddfg[2]) oddbg = cmap.alloc(loddbg[0],loddbg[1],loddbg[2])
evenbg = gtk.GdkColor(levenbg[0],levenbg[1],levenbg[2]) oddfg = cmap.alloc(loddfg[0],loddfg[1],loddfg[2])
evenfg = gtk.GdkColor(levenfg[0],levenfg[1],levenfg[2]) evenbg = cmap.alloc(levenbg[0],levenbg[1],levenbg[2])
ancestorfg = gtk.GdkColor(lafg[0],lafg[1],lafg[2]) evenfg = cmap.alloc(levenfg[0],levenfg[1],levenfg[2])
ancestorfg = cmap.alloc(lafg[0],lafg[1],lafg[2])
rows = clist.rows rows = clist.rows
for i in range(0,rows): for i in range(0,rows):
clist.set_background(i,(evenbg,oddbg)[i%2]) clist.set_background(i,(evenbg,oddbg)[i%2])