-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Add tweak option per node #349
Comments
I wrote:
I just realized that I might have been making this problem more complicated than needed. It should be sufficient to accumulate tweaks from each node in the harness and join everything before executing all at once with the total We just need to find a proper placeholder for the node designator, and replace all usage of this placeholder within each node Are there also other attributes of a cable or connector that would be useful to have placeholders for? I am mainly thinking about attributes that are not easily known by the YAML author. |
That sounds still rather complicated. The tweaks would be inserted inside the Another way that should work, but I have not tested is simply using the same designator multiple times for each tweak. They should be merged by GraphViz in the same fashion that subgraphs are merged when they have identical names. |
@kvid Considering that we use prefixes instead of placeholders, then it could be used to implement the grouping through clusters. This could be a solution to #325 then, if the prefix itself could also be used literally without being replaced. Something like:
Because Graphviz has C-style comments, it would ignore everything after
Should work, though I cannot test it currently. |
I meant that the tweaks would be applied after the calls to dot.node here https://github.com/wireviz/WireViz/blob/issue349tweak/src%2Fwireviz%2FHarness.py#L292-L298 and here https://github.com/wireviz/WireViz/blob/issue349tweak/src%2Fwireviz%2FHarness.py#L555-L561. The way that you implemented it applies all the tweaks in a final step. This allows some debugging by comparing before and after tweaking, if needed. |
@kvid wrote:
Yes and no. I could think of placeholders for metadata like user, file and folder name that a user might like to add in a text label. Date and time stamps are also something useful, though I see that YAML might provide tags for this purpose. I guess that we should discuss this elsewhere. Note that YAML tags could be used to generate random designators/placeholders! |
@martinrieder wrote:
Any presence of the placeholder text will be replaced with the node instance designator. The only reason for making the user select such a placeholder text instead of having a hard coded placeholder, is to avoid the edge case that such a hard coded text is needed literally in any tweak attribute. See also my newly extended #270 (comment) for a use case with example YAML input using a
What do you need a prefix for?
See the upper part of this comment. The user is able to choose a placeholder that doesn't conflict with the other tweak text.
I still don't understand how this will work.
|
I suggest adding a
tweak
option for each node (both cables and connectors). It has been on mind many times, but was now triggered again by @martinrieder, and I create a new issue to avoid cluttering the original issue where such a feature would be helpful.@martinrieder wrote:
I totally agree. It has been on my mind many times since I wrote my suggestion above, but I haven't given priority to diving into the graphviz package to find how to inject my tweak code for each node. Todays tweak code is very simple using search and replace on the total
.gv
text output from the graphviz package. To do it per node, it will probably require injecting my code earlier in the process, while each node is generated.That I haven't tried. That sounds like very useful in combination with tweak per node. I have been thinking of adding my own per node specifyer for being included into a common group, but what you describe might be a lower hanging fruit.
Originally posted by @kvid in #270 (comment)
The text was updated successfully, but these errors were encountered: