diff options
Diffstat (limited to 'exon_color.py')
-rw-r--r-- | exon_color.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/exon_color.py b/exon_color.py index bd8e192..c91d8f2 100644 --- a/exon_color.py +++ b/exon_color.py @@ -1,5 +1,5 @@ # coding: UTF-8 -# Copyright 2009 Thomas Jourdan +# Copyright 2009, 2010 Thomas Jourdan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -77,8 +77,14 @@ class Color(model_allele.Allele): """Set red, green, blue and alpha to random values.""" cpool = model_constraintpool.ConstraintPool.get_pool() constraints = cpool.get(self, COLOR_CONSTRAINT) - self.constraint = ka_extensionpoint.create(random.choice(constraints), - self.path) + #TODO prefer a single constraint + #TODO Remove pushing colorconstraint_none by a more generalized solution + if 'colorconstraint_none' in constraints and random.random() < 0.5: + self.constraint = ka_extensionpoint.create(random.choice(['colorconstraint_none']), + self.path) + else: + self.constraint = ka_extensionpoint.create(random.choice(constraints), + self.path) self.rgba = self.constraint.randomize() def mutate(self): |