Skip to content
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

[WIP] Implement single wire cable #405

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

martinrieder
Copy link
Contributor

@martinrieder martinrieder commented Jul 13, 2024

@martinrieder martinrieder changed the base branch from dev to master July 13, 2024 12:58
@martinrieder martinrieder changed the title Implement simple cable [WIP] Implement simple cable Jul 13, 2024
@martinrieder martinrieder changed the title [WIP] Implement simple cable [WIP] Implement single wire cable Jul 13, 2024
@@ -271,6 +271,7 @@ class Cable:
show_name: Optional[bool] = None
show_wirecount: bool = True
show_wirenumbers: Optional[bool] = None
show_colorname: bool = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest a different name:

Suggested change
show_colorname: bool = True
show_wirecolor_text: bool = True

Alternatively show_color_text, but then someone might expect it to also affect showing the cable.color (jacket color) text. Do you want that?

I suggest text instead of name because the text might be different text representations of the colors, depending on options.color_mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we are on the same page here. In a single-core cable, the color of the wire and the jacket would be identical. Anyway thanks for mentioning this, because it needs to apply to multi-core cables as well.

IMO neither text nor name is needed. In order to keep it intuitive, I consider the following for alignment with the other show_ switches:

cables:
  w:
    color: BK           # jacket color box, omit this to hide it all
    show_color: plain   # only hide the text from jacket color box
    show_color: text    # only show the text and hide the bgcolor

    colors: [GY]        # wire color (list), omit this for defaults
    show_colors: plain  # hide the color text from individual wires
    show_colors: text   # only show the text without wire coloring

Copy link
Collaborator

@kvid kvid Jul 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This increases the code complexity slightly, but it seems easier to read, and hopefully is easier to understand as well.

I assume you'll also allow the values True for showing everything and False for showing nothing.

With None as default value for show_colors, you can set it in __post_init__() default plain for your single-core cable use case and True otherwise.

PS: Maybe we in a future separate PR will consider collecting all show_* switches like this:

    show:
      color: text
      colors: True
      wirecount: False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants