Skip to content

Commit 44655d6

Browse files
committed
enh(plot,.TC): +fontcolor on operations
1 parent ff1f5e9 commit 44655d6

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

graphtik/plot.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,11 @@ class Style:
370370
## DATA node
371371

372372
kw_data = {}
373-
kw_data_pruned = {"color": Ref("cancel_color"), "tooltip": "(pruned node)"}
373+
kw_data_pruned = {
374+
"color": Ref("cancel_color"),
375+
"tooltip": "(pruned node)",
376+
"fontcolor": Ref("cancel_color"),
377+
}
374378
kw_data_in_plan = {"color": Ref("in_plan")}
375379
kw_data_in_solution = {"style": "filled", "fillcolor": Ref("fill_color")}
376380
kw_data_overwritten = {"style": "filled", "fillcolor": Ref("overwrite_color")}
@@ -387,7 +391,7 @@ class Style:
387391
kw_op = {}
388392
#: props only for HTML-Table label
389393
kw_op_label = {}
390-
kw_op_pruned = {"color": Ref("cancel_color")}
394+
kw_op_pruned = {"color": Ref("cancel_color"), "fontcolor": Ref("cancel_color")}
391395
kw_op_executed = {"fillcolor": Ref("fill_color")}
392396
kw_op_rescheduled = {"penwidth": Ref("resched_thickness")}
393397
kw_op_endured = {"penwidth": Ref("resched_thickness")}
@@ -414,15 +418,31 @@ class Style:
414418
'HREF': op_url | hrefer | ee,
415419
'TARGET': op_link_target | ee
416420
} | xmlattr }}
417-
>{{ '<B>OP:</B> <I>%s</I>' % op_name |ee if op_name }}</TD></TR
421+
>
422+
{%- if fontcolor -%}
423+
<FONT COLOR="{{ fontcolor }}">
424+
{%- endif -%}
425+
{{ '<B>OP:</B> <I>%s</I>' % op_name |ee if op_name }}
426+
{%- if fontcolor -%}
427+
</FONT>
428+
{%- endif -%}
429+
</TD></TR
418430
>
419431
{%- if fn_name -%}
420432
<TR><TD {{- {
421433
'TOOLTIP': fn_tooltip | truncate | eee,
422434
'HREF': fn_url | hrefer | ee,
423435
'TARGET': fn_link_target | ee
424436
} | xmlattr }}
425-
><B>FN:</B> {{ fn_name | eee }}</TD></TR>
437+
>
438+
{%- if fontcolor -%}
439+
<FONT COLOR="{{ fontcolor }}">
440+
{%- endif -%}
441+
<B>FN:</B> {{ fn_name | eee }}
442+
{%- if fontcolor -%}
443+
</FONT>
444+
{%- endif -%}
445+
</TD></TR>
426446
{%- endif %}
427447
</TABLE>>
428448
"""

test/test_plot.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_op_label_template_full():
7171
fn_name="the fn",
7272
penwidth="44",
7373
color="red",
74+
fontcolor="blue",
7475
fillcolor="wheat",
7576
op_url="http://op_url.com<label>",
7677
op_tooltip='<op " \t tooltip>',
@@ -82,12 +83,12 @@ def test_op_label_template_full():
8283
got = plot._render_template(plot.Style.op_template, **kw)
8384
print(got)
8485
exp = """
85-
<<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded" BORDER="44" COLOR="red" BGCOLOR="wheat"
86-
><TR><TD BORDER="1" SIDES="b" TOOLTIP="&lt;op &quot; &#9; tooltip&gt;" HREF="http://op_url.com_label_" TARGET="_self"
87-
><B>OP:</B> <I>the op</I></TD></TR
88-
><TR><TD TOOLTIP="&lt;fn&#10;tooltip&gt;" HREF="http://fn_url.com/quoto_and" TARGET="_top"
89-
><B>FN:</B> the fn</TD></TR>
90-
</TABLE>>
86+
<<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded" BORDER="44" COLOR="red" BGCOLOR="wheat"
87+
><TR><TD BORDER="1" SIDES="b" TOOLTIP="&lt;op &quot; &#9; tooltip&gt;" HREF="http://op_url.com_label_" TARGET="_self"
88+
><FONT COLOR="blue"><B>OP:</B> <I>the op</I></FONT></TD></TR
89+
><TR><TD TOOLTIP="&lt;fn&#10;tooltip&gt;" HREF="http://fn_url.com/quoto_and" TARGET="_top"
90+
><FONT COLOR="blue"><B>FN:</B> the fn</FONT></TD></TR>
91+
</TABLE>>
9192
"""
9293

9394
assert _striplines(got) == _striplines(exp)

0 commit comments

Comments
 (0)