From ffc10d4a613953736d46bee418a2e71e96361d8d Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 5 Mar 2002 01:09:41 +0000 Subject: [PATCH] Fix color allocation svn: r813 --- gramps/src/ListColors.py | 11 +++++------ gramps/src/gramps_main.py | 22 ++++++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gramps/src/ListColors.py b/gramps/src/ListColors.py index bcdf45306..633f6bc07 100644 --- a/gramps/src/ListColors.py +++ b/gramps/src/ListColors.py @@ -18,8 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -from gtk import GdkColor - _enable = 0 oddbg = (0xffff,0xffff,0xffff) evenbg = (0xffff,0xffff,0xffff) @@ -35,10 +33,11 @@ class ColorList: self.clist = clist self.color_ok = 1 try: - self.oddbg = GdkColor(oddbg[0],oddbg[1],oddbg[2]) - self.oddfg = GdkColor(oddfg[0],oddfg[1],oddfg[2]) - self.evenbg = GdkColor(evenbg[0],evenbg[1],evenbg[2]) - self.evenfg = GdkColor(evenfg[0],evenfg[1],evenfg[2]) + cmap = clist.get_colormap() + self.oddbg = cmap.alloc(oddbg[0],oddbg[1],oddbg[2]) + self.oddfg = cmap.alloc(oddfg[0],oddfg[1],oddfg[2]) + self.evenbg = cmap.alloc(evenbg[0],evenbg[1],evenbg[2]) + self.evenfg = cmap.alloc(evenfg[0],evenfg[1],evenfg[2]) except OverflowError: self.color_ok = 0 diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index ab481c066..99fb2f112 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -913,10 +913,11 @@ class Gramps: levenbg = ListColors.evenbg levenfg = ListColors.evenfg - oddbg = gtk.GdkColor(loddbg[0],loddbg[1],loddbg[2]) - oddfg = gtk.GdkColor(loddfg[0],loddfg[1],loddfg[2]) - evenbg = gtk.GdkColor(levenbg[0],levenbg[1],levenbg[2]) - evenfg = gtk.GdkColor(levenfg[0],levenfg[1],levenfg[2]) + cmap = self.topWindow.get_colormap() + oddbg = cmap.alloc(loddbg[0],loddbg[1],loddbg[2]) + oddfg = cmap.alloc(loddfg[0],loddfg[1],loddfg[2]) + evenbg = cmap.alloc(levenbg[0],levenbg[1],levenbg[2]) + evenfg = cmap.alloc(levenfg[0],levenfg[1],levenfg[2]) rows = self.person_list.rows for i in range(0,rows,2): self.person_list.set_background(i,oddbg) @@ -1031,12 +1032,13 @@ class Gramps: levenbg = ListColors.evenbg levenfg = ListColors.evenfg lafg = ListColors.ancestorfg - - oddbg = gtk.GdkColor(loddbg[0],loddbg[1],loddbg[2]) - oddfg = gtk.GdkColor(loddfg[0],loddfg[1],loddfg[2]) - evenbg = gtk.GdkColor(levenbg[0],levenbg[1],levenbg[2]) - evenfg = gtk.GdkColor(levenfg[0],levenfg[1],levenfg[2]) - ancestorfg = gtk.GdkColor(lafg[0],lafg[1],lafg[2]) + + cmap = self.topWindow.get_colormap() + oddbg = cmap.alloc(loddbg[0],loddbg[1],loddbg[2]) + oddfg = cmap.alloc(loddfg[0],loddfg[1],loddfg[2]) + evenbg = cmap.alloc(levenbg[0],levenbg[1],levenbg[2]) + evenfg = cmap.alloc(levenfg[0],levenfg[1],levenfg[2]) + ancestorfg = cmap.alloc(lafg[0],lafg[1],lafg[2]) rows = clist.rows for i in range(0,rows): clist.set_background(i,(evenbg,oddbg)[i%2])