def __init__(self, trunk): super(TreeNode, self).__init__(trunk) self.left_treenode = None self.right_treenode = None self.left_background = exon_color.Color(self.path, 0, 0, 0, 1) self.right_background = exon_color.Color(self.path, 0, 0, 0, 1) layer_factory = ka_factory.get_factory('layer') self.layer = layer_factory.create(layer_factory.keys()[0], self.path) merger_factory = ka_factory.get_factory('merger') self.merger = merger_factory.create(merger_factory.keys()[0], self.path) modifier_factory = ka_factory.get_factory('modifier') self.modifier = modifier_factory.create(modifier_factory.keys()[0], self.path)
def get_randomized_color(self, path): """Set red, green, blue and alpha to random values. """ lightness = random.random() saturation = random.random() alpha = random.random() rgb = colorsys.hls_to_rgb(self.hue, lightness, saturation) return exon_color.Color(path, rgb[0], rgb[1], rgb[2], alpha)
def get_randomized_color(self, path): """Set red, green, blue and alpha to random values. """ lightness = random.random() saturation = random.random() alpha = random.random() deviate = 0.0 if random.randint(0, 1) == 0 else 0.5 rgb = colorsys.hls_to_rgb(self.hue + deviate, lightness, saturation) color = exon_color.Color(path, rgb[0], rgb[1], rgb[2], alpha) color.set_base_color(deviate, 0.0, 0.0) return color
def __init__(self, trunk): """CircularArc diagram layer constructor""" super(CircularArc, self).__init__(trunk) cpool = model_constraintpool.ConstraintPool.get_pool() self.linecolor = exon_color.Color(self.path, 0, 0, 0, 1) self.line_width = cpool.get(self, LINE_WIDTH__CONSTRAINT)[0] self.size = cpool.get(self, SIZE_CONSTRAINT)[0] self.start_angle = cpool.get(self, START_ANGLE_CONSTRAINT)[0] self.angle = cpool.get(self, ANGLE_CONSTRAINT)[0] sampler_factory = ka_factory.get_factory('sampler') sampler_key = sampler_factory.keys()[0] self.sampler = sampler_factory.create(sampler_key, self.path)
def get_randomized_color(self, path): """Set red, green, blue and alpha to random values. """ hue_dircetion = random.choice([-1, 0, 1]) hue = self._get_hue(hue_dircetion) lightness = random.random() saturation = random.random() alpha = random.random() rgb = colorsys.hls_to_rgb(hue, lightness, saturation) color = exon_color.Color(path, rgb[0], rgb[1], rgb[2], alpha) color.set_base_color(hue_dircetion, 0, 0) return color
def __init__(self, trunk): """LetterPress diagram layer constructor""" super(LetterPress, self).__init__(trunk) cpool = model_constraintpool.ConstraintPool.get_pool() self.textcolor = exon_color.Color(self.path, 0, 0, 0, 1) self.family = cpool.get(self, FONTFAMILY_CONSTRAINT)[0] self.style = cpool.get(self, FONTSTYLE_CONSTRAINT)[0] self.size = cpool.get(self, FONTSIZE_CONSTRAINT)[0] self.weight = cpool.get(self, FONTWEIGHT_CONSTRAINT)[0] self.center = exon_position.Position(self.path, 0.0, 0.0) sampler_factory = ka_factory.get_factory('sampler') sampler_key = sampler_factory.keys()[0] self.sampler = sampler_factory.create(sampler_key, self.path) self.buzzwords = exon_buzzword.Buzzword(self.path, [''])