
retracile at gmail
May 6, 2008, 8:17 PM
Post #5 of 7
(37 views)
Permalink
|
|
Re: Displaying closed resolutions in workflow_parser.py?
[In reply to]
|
|
On Sunday 04 May 2008 03:24:04 pm Scott Bussinger wrote: > > Anyone got a quick patch for workflow_parser.py (that's the code that > > converts a Trac Workflow into a pretty picture) that includes the > > resolution state in the titles for closed ticket transitions? > > To answer my own question, here's what I ended up changing in > workflow_parser.py: > > def actions2graphviz(actions, show_ops=False, show_perms=False): > """Returns a list of lines to be fed to graphviz.""" > # The size value makes it easier to create a useful printout. > color_scheme = ColorScheme() > digraph_lines = ['digraph G {\ncenter=1\nsize="10,8"\n'] > for action, attributes in actions.items(): > label = [attributes['name'], ] > if show_ops: > label += attributes['operations'] > if show_perms: > label += attributes['permissions'] > if 'set_resolution' in attributes: > label += ['(' + attributes['set_resolution'] + ')'] > for oldstate in attributes['oldstates']: > color = color_scheme.get_color(attributes['name']) > digraph_lines.append( > '"%s" -> "%s" [label="%s" color=%s fontcolor=%s]\n' % > \ > (oldstate, attributes['newstate'], '\\n'.join(label), > color, > color)) > digraph_lines.append('}\n') > return digraph_lines > > Basically I removed the "rotate" command from the initial 'Digraph' so > that the image came out right-side up (I'm not sure why you'd want it > rotated in the first place) and then added a couple of lines to add > the set_resolution state to the diagram (if it exists). > > I find this useful -- perhaps somebody else will too. If you don't mind, could you file an enhancement ticket, attach a patch to it, and assign it to me? That will keep this from getting lost. :) As for the rotate, IIRC, I was sending it to a pdf, and the rotate undid a rotation that output format was doing for no obvious reason. The scripts in the contrib/workflow directory are more... "guidelines" than real code. ;) Eli ------------------. "If it ain't broke now, Eli Carter \ it will be soon." -- crypto-gram retracile[at]gmail.com `------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users[at]googlegroups.com To unsubscribe from this group, send email to trac-users-unsubscribe[at]googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---
|