You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pins attribute of a connector contains a list of such dicts in that suggestion. That also enables default auto-numbered pins unless specifying a pin attribute in the dicts for each pin.
Value: The same dict for each pin as above (However, a pin attribute in such a dict doesn't make sense in this case)
I suggest we accept both the current syntax and at least the upper alternative above (list of dicts). The Connector.__post_init__() should check the pins attribute for alternative syntax, and translate any such values into the current data structure with separate lists.
As this probably will only involve adding some code in __post_init__() and nothing else, then conflicts with other PRs should be minimal or none.
We might consider expanding this issue scope to also include a similar concept for cable/bundle wires. As we don't support custom wire naming/renumbering, then we probably should reject both a wire attribute in a wire dict, and the optional dict of wire dicts.
Perhaps a syntax change/option would help for this. Right now connectors define pins as a list, which is order-dependent. 3rd one defined is pin 3 etc. Pinlabels are defined the same way - see the connectors above. This means making sure that the pin labels are in the correct order to match the pin colors ...
How about defining pins individually ?
A4:
pins:
- pin: 1label: AC lock sensorcolor: GNYE
- pin: 2label: AC lock sensorcolor: VTWH
- pin: 3label: NC
- pin: 4label: AC magnetic clutchcolor: BU
That is a good idea. It should be possible to accept an input syntax similar to your suggestion as an alternative to the existing syntax, and WireViz can easily map the values from such an input into the current data structure. This way, users can select the easiest syntax for each connector and cable. Implementing such a feature should be quite easy and only involve __post_init__() of the classes Connector and Cable, but I suggest raising a separate feature request issue for it, as it is independent from the automatic ordering in #275.
To support such a feature also for cables/bundles, then I guess we need a new attribute wires that can take a list of dicts. Such a syntax alternative might also be an advantage when new attributes per wire is requested, like in #56 or #268. However, supporting custom wire naming/renumbering as is already supported for connector pins, would require numerous changes in several source files, and should therefore perhaps be out of scope for now.
@Halfwalker has suggested a syntax change that might help the use case in [feature] Automatic ordering of wires in a wire/bundle #275: defining pins individually (by specifying pin attributes in a dict for each pin - see details below)
The
pins
attribute of a connector contains a list of such dicts in that suggestion. That also enables default auto-numbered pins unless specifying apin
attribute in the dicts for each pin.Optionally, the
pins
attribute of a connector could contain a dict (aswireinfo
in [feature] More control over wire parameters #56) with a set of:pin
attribute in such a dict doesn't make sense in this case)I suggest we accept both the current syntax and at least the upper alternative above (list of dicts). The
Connector.__post_init__()
should check thepins
attribute for alternative syntax, and translate any such values into the current data structure with separate lists.As this probably will only involve adding some code in
__post_init__()
and nothing else, then conflicts with other PRs should be minimal or none.We might consider expanding this issue scope to also include a similar concept for cable/bundle wires. As we don't support custom wire naming/renumbering, then we probably should reject both a
wire
attribute in a wire dict, and the optional dict of wire dicts.@Halfwalker wrote:
That is a good idea. It should be possible to accept an input syntax similar to your suggestion as an alternative to the existing syntax, and WireViz can easily map the values from such an input into the current data structure. This way, users can select the easiest syntax for each connector and cable. Implementing such a feature should be quite easy and only involve
__post_init__()
of the classesConnector
andCable
, but I suggest raising a separate feature request issue for it, as it is independent from the automatic ordering in #275.To support such a feature also for cables/bundles, then I guess we need a new attribute
wires
that can take a list ofdicts
. Such a syntax alternative might also be an advantage when new attributes per wire is requested, like in #56 or #268. However, supporting custom wire naming/renumbering as is already supported for connector pins, would require numerous changes in several source files, and should therefore perhaps be out of scope for now.Originally posted by @kvid in #275 (comment)
The text was updated successfully, but these errors were encountered: