summaryrefslogtreecommitdiff
path: root/icktool
diff options
context:
space:
mode:
Diffstat (limited to 'icktool')
-rwxr-xr-xicktool37
1 files changed, 18 insertions, 19 deletions
diff --git a/icktool b/icktool
index 6e493d1..7be5bc1 100755
--- a/icktool
+++ b/icktool
@@ -192,31 +192,30 @@ class Icktool(cliapp.Application):
current = build['current_action']
status = build['status']
+ f = self.output
+ f.write('digraph "build_graph" {\n')
+ for i, action in enumerate(actions):
+ self._describe_node(f, i, current, action)
+ f.write('}\n')
+
+ def _describe_node(self, f, i, current, action):
styles = {
'done': ('rectangle', '#ffffff'),
'building': ('ellipse', '#00ff00'),
'blocked': ('ellipse', '#bbbbbb'),
}
- node_tmpl = 'a{} [label="{}" shape={} style=filled fillcolor="{}"]\n'
-
- f = self.output
- f.write('digraph "build_graph" {\n')
- for i, action in enumerate(actions):
- if current is None:
- shape, color = styles['done']
- elif i < current:
- shape, color = styles['done']
- elif i == current:
- shape, color = styles['building']
- elif i > current:
- shape, color = styles['blocked']
- f.write(
- node_tmpl.format(
- i, self._describe_action(action), shape, color))
- if i > 0:
- f.write('a{} -> a{}\n'.format(i-1, i))
- f.write('}\n')
+ if current is None:
+ shape, color = styles['done']
+ elif i < current:
+ shape, color = styles['done']
+ elif i == current:
+ shape, color = styles['building']
+ elif i > current:
+ shape, color = styles['blocked']
+
+ tmpl = 'a{} [label="{}" shape={} style=filled fillcolor="{}"]\n'
+ f.write(tmpl.format(i, self._describe_action(action), shape, color))
def _describe_action(self, action):
for key in ['action', 'archive']: