Don't attempt to change colors under Python 2.0, to prevent tripping a PyGTK bug

svn: r55
This commit is contained in:
Don Allingham 2001-05-23 22:18:55 +00:00
parent 4bb330f1e1
commit b94e9e303f

View File

@ -20,6 +20,13 @@
from gtk import *
import sys
if sys.version[:3] == "1.5":
color_ok = 1
else:
color_ok = 0
enable = 0
oddbg = (0xffff,0xffff,0xffff)
evenbg = (0xffff,0xffff,0xffff)
@ -32,6 +39,7 @@ class ColorList:
self.modval = 2*increment
self.increment = increment
self.clist = clist
if color_ok:
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])
@ -39,7 +47,7 @@ class ColorList:
def add(self,list):
self.clist.append(list)
if enable:
if enable and color_ok:
if self.index % self.modval < self.increment:
self.clist.set_background(self.index,self.oddbg)
self.clist.set_foreground(self.index,self.oddfg)