diff options
Diffstat (limited to 'src/fringlib')
-rw-r--r-- | src/fringlib/fringrenderer.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/fringlib/fringrenderer.py b/src/fringlib/fringrenderer.py index 9b92418..c5fd5ee 100644 --- a/src/fringlib/fringrenderer.py +++ b/src/fringlib/fringrenderer.py @@ -46,9 +46,13 @@ class FringRenderer: self.LINE_WIDTH = .5 self.LABEL_UNTIL_RING = 0 self.RING_OUTLINE_COLOR = (.2,.2,.2) + self.LEG_LINE_WIDTH = 1 self.LEG_LINE_COLOR = (.1,.1,.1) + self.LINK_LABEL_COLOR = (0,0,1) + self.FILE_LABEL_COLOR = (.5,.5,.5) + def prepare_layouts(self,ctx): self.linklayout = ctx.create_layout() @@ -125,7 +129,6 @@ class FringRenderer: leg_radius = self.INNER_RADIUS + (self.RINGS_MAX+1) * (self.RING_RADIUS + self.RING_SPACE) leg_radius -= (self.RING_RADIUS + self.RING_SPACE) / 2 - if cos((start+end)*pi) >= 0: x = self.WIDTH align_x = 0 @@ -135,7 +138,6 @@ class FringRenderer: y = CENTERY+leg_radius*sin((start+end)*pi) xmod = 2*(align_x*2-1) - #xmod = 0 point_a = CENTERX+e*cos((start+end)*pi), CENTERY+e*sin((start+end)*pi) point_b = CENTERX+leg_radius*cos((start+end)*pi), CENTERY+leg_radius*sin((start+end)*pi) @@ -143,23 +145,22 @@ class FringRenderer: # draw the side link label ctx.move_to(x+xmod,y) - if hasContents: - ctx.set_source_rgb(0,0,1) - width,height = self._draw_centered_text(ctx, fn + "/", align_x) - else: - ctx.set_source_rgb(0.5,0.5,0.5) - width,height = self._draw_centered_text(ctx, fn, align_x) + if hasContents: ctx.set_source_rgb(*self.LINK_LABEL_COLOR) + else: ctx.set_source_rgb(*self.FILE_LABEL_COLOR) + + # todo: cut down label size if longer than WIDTH/2 - ring*ringradius - innerradius + label = fn - if align_x == 0: - width *= -1 + width,height = self._draw_centered_text(ctx, label, align_x) + if align_x == 0: width *= -1 #TODO change this... self.__register_side_link(hasContents,p,value,end-start,x,y+(height/2),x+(width),y-(height/2)) # draw line ctx.move_to(*point_a) ctx.line_to(*point_b) offset = 5 - if align_x: ctx.line_to(point_c[0]+width+offset,point_c[1]) + if align_x: ctx.line_to(point_c[0]+width+offset,point_c[1]) #TODO ...and this! else: ctx.line_to(point_c[0]+xmod+width-offset,point_c[1]) ctx.set_source_rgb(*self.LEG_LINE_COLOR) ctx.set_line_width(self.LEG_LINE_WIDTH) |