ModelicaSpecification
ModelicaSpecification copied to clipboard
Standardize Dialog annotation __Dymola_label
It might be worth to standardize the Dialog annotation "__Dymola_label" to improve the display of variables in the parameter dialog.
Examples:
parameter Real 'alpha 1' = 1 "UTF-8 encoded"
annotation(Dialog(__Dymola_label="α₁"));
parameter Real 'alpha 2' = 2 "HTML formatted"
annotation(Dialog(__Dymola_label="<html>α<sub>2</sub></html>"));
The idea would be that Dialog had an annotation label defined as:
If present label suggest a label
in the parameter-dialog for the variable, replacing the variable name. The label
may contain HTML-formatted text indicated by starting the value with <html>
and ending it with </html>
.
Maybe someone (@beutlich?) with experience of using this feature could explain how it can be used without causing confusion to someone who also gets exposed to the real name of the component?
For example:
parameter Real 'alpha 1' = 1 "UTF-8 encoded"
annotation(Dialog(__Dymola_label="α₁"));
parameter Real p = 2 * 'alpha 1';
It would also be good to see an analysis of the implications of allowing HTML in this context.
If we want something more flexible for typesetting advanced labels, it would make sense to pick something that we would also allow in graphical annotations. I mean, if we require tools to support rendering something fancy in dialogs, it would make sense to also take advantage of that for graphics. Now that we allos SVG in graphics, would it make more sense to allow SVG labels than HTML labels?
Maybe someone (@beutlich?) with experience of using this feature could explain how it can be used without causing confusion to someone who also gets exposed to the real name of the component?
To me that would primarily be the responsibility of the one making the model, especially regarding avoiding ambiguities.
One option would be that tools help by modifying the looks of the label compared to normal names, but I understand that some like the labels to look like normal parameter-names.
If we want something more flexible for typesetting advanced labels, it would make sense to pick something that we would also allow in graphical annotations. I mean, if we require tools to support rendering something fancy in dialogs, it would make sense to also take advantage of that for graphics. Now that we allos SVG in graphics, would it make more sense to allow SVG labels than HTML labels?
For graphics I would more leverage the existing group-images, as a simple example consider: Modelica.Magnetic.FluxTubes.Shapes.FixedShape.HollowCylinderAxialFlux if that were an svg-image I could imagine that selecting r0 highlighted it in the image.
The difference is that this is an image for a group of parameters where they are explained in relation to each other, whereas the name is for one.
Simple question: Shall we add label to give a label to the parameter (to be used similarly as the name - but optionally containing HTML-coded text)? Any ambiguity for collisions between labels or between labels and names would be the responsibility of the modeler.
No matter how hard I try I can't convince myself that this is a good idea. I can see the benefit when visualization/rendering equations, but that's not really what this issue is about. As a modeler I would find it confusing to keep track of what "display names" match what identifiers when reading/editing code/equations. I'm also pretty sure I would forget to update the "display name" when I change the identifier, especially when working in the text view. Overall I think the disadvantages outweigh the benefits by far.
As a user, It sounds confusing to me to have two different identifiers/labels for one variable. As d-hedberg said, labeling a variable with α and using the following input field as sin(alpha) is enough for me to dislike the idea.
Doesn't seem enough interest in favor of it at the moment.