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

Rename Checkbox to Switch #1751

Merged
merged 3 commits into from
Feb 9, 2023
Merged

Rename Checkbox to Switch #1751

merged 3 commits into from
Feb 9, 2023

Conversation

davep
Copy link
Contributor

@davep davep commented Feb 9, 2023

A new form of Checkbox will be arriving in Textual soon, working in conjunction with a RadioButton. What was called Checkbox is perhaps a wee bit heavyweight in terms of visual design, but is a style of widget that should remain.

With this in mind we're renaming the current Checkbox to Switch. In all other respects its workings remains the same, only the name has changed.

Things for people to watch out for:

  • Imports will need to be updated.
  • Queries will need to be updated; special attention will need to be paid to any queries that are string-based.
  • CSS will need to be changed if any Checkbox styling is happening, or if any Checkbox component styles are being used.

See #1725 as the initial motivation and #1746 as the issue for this particular change.

A new form of Checkbox will be arriving in Textual soon, working in
conjunction with a RadioButton. What was called Checkbox is perhaps a wee
bit heavyweight in terms of visual design, but is a style of widget that
should remain.

With this in mind we're renaming the current Checkbox to Switch. In all
other respects its workings remains the same, only the name has changed.

Things for people to watch out for:

- Imports will need to be updated.
- Queries will need to be updated; special attention will need to be paid to
  any queries that are string-based.
- CSS will need to be changed if any Checkbox styling is happening, or if
  any Checkbox component styles are being used.

See Textualize#1725 as the initial motivation and Textualize#1746 as the issue for this
particular change.
@davep davep added enhancement New feature or request Task labels Feb 9, 2023
@davep davep self-assigned this Feb 9, 2023
@davep davep linked an issue Feb 9, 2023 that may be closed by this pull request
@davep
Copy link
Contributor Author

davep commented Feb 9, 2023

Consideration will need to be given to this PR and the work that @rodrigogiraoserrao is doing on documenting compound widgets as his example application does make use of Checkbox.

@rodrigogiraoserrao
Copy link
Contributor

Consider my work independent of this PR. We can merge this and I'll update my examples accordingly.

Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

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

Almost ready to merge, IMO.

Off the top of my head, I can't think of any other places where we might have to go look for Checkbox.

src/textual/widgets/__init__.py Show resolved Hide resolved
src/textual/demo.py Outdated Show resolved Hide resolved
src/textual/widgets/__init__.pyi Outdated Show resolved Hide resolved
src/textual/widgets/_switch.py Show resolved Hide resolved
tests/test_focus.py Outdated Show resolved Hide resolved
Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

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

:)

@davep davep dismissed stale reviews from darrenburns and rodrigogiraoserrao February 9, 2023 14:20

Testing dismissing a review (because we weren't sure if it would let you say why or not).

@davep davep merged commit 989e71e into Textualize:main Feb 9, 2023
@davep davep deleted the checkbox-switch branch February 9, 2023 14:24
davep added a commit to davep/textual that referenced this pull request Feb 9, 2023
Following on from Textualize#1751: originally Switch was called Checkbox and the
moving part was, for the component class, called a checkbox--switch; after
renaming the widget to Switch that component class ended up being
switch--switch; which wasn't ideal.

We decided to go with it as-is, but I just realised that internally the code
calls it a slider. So this leans into that and I'm renaming the component
class switch--slider. This removes the doubling-up of the name and also
makes the code more consistent.
@davep davep mentioned this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename Checkbox to Switch
4 participants