Commits

Hiroki MIZUNO committed 60371a6

support actdiag

Comments (0)

Files changed (2)

blockdiagcontrib_excelshape/excelshape.py

 import os.path
 from blockdiag.utils import XY,Box,Size
 from types import StringType
-from webcolors import name_to_rgb
+from webcolors import name_to_rgb, hex_to_rgb
 from blockdiag.imagedraw import base, textfolder
 class ExcelShapeImageDraw(base.ImageDraw):
     MSO_SHAPE_RECTANGE = 1
         pass
 
     def rgb(self, rgb):
-        if type(rgb) is StringType:
+        if type(rgb) is StringType and rgb[0] == '#':
+            rgb = hex_to_rgb(rgb)
+        elif type(rgb) is StringType:
             rgb = name_to_rgb(rgb)
         r,g,b = rgb
         return (b << 16) + (g << 8) + r
 
         if outline != None:
             shape.Line.ForeColor.RGB = self.rgb(outline)
+        else:
+            shape.Line.Visible = False
+
         if fill != None:
             shape.Fill.ForeColor.RGB = self.rgb(fill)
+        else:
+            shape.Fill.Visible = False
 
     def rectangle(self, box, **kwargs):
         left   = box[0]
         chars.Text = string
         chars.Font.Color = self.rgb(fill)
         chars.Font.Size = font.size
-
-        if kwargs['halign'] == 'center':
+        if kwargs.get('halign') == 'center':
             shape.TextFrame.HorizontalAlignment = self.XL_CENTER
         shape.TextFrame.VerticalAlignment = self.XL_CENTER
 
 eggs =
      blockdiag
      seqdiag
+     actdiag
+     nwdiag
      blockdiagcontrib-excelshape
 interpreter = py