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

Add a Unicode digits display widget #2916

Closed
rodrigogiraoserrao opened this issue Jul 11, 2023 · 5 comments · Fixed by #3073
Closed

Add a Unicode digits display widget #2916

rodrigogiraoserrao opened this issue Jul 11, 2023 · 5 comments · Fixed by #3073
Assignees
Labels
enhancement New feature or request

Comments

@rodrigogiraoserrao
Copy link
Contributor

rodrigogiraoserrao commented Jul 11, 2023

(This issue is reserved for the EuroPython 2023 sprint. If you are not participating in the sprint, please refrain from working on this issue. Thanks!)

This issue concerns itself with adding a new widget to Textual.
This widget should use Unicode box-drawing characters to create a display for digits.
Each digit should be drawn like shown below.

Digits
┏━┓
┃ ┃
┗━┛
 ┓
 ┃
╺┻╸
╺━┓
┏━┛
┗━╸
╺━┓
 ━┫
╺━┛
╻ ╻
┗━┫
  ╹
┏━╸
┗━┓
╺━┛
┏━╸
┣━┓
┗━┛
╺━┓
  ┃
  ┃
┏━┓
┣━┫
┗━┛
┏━┓
┗━┫
╺━┛

The widget should have a reactive attribute value that holds the integer value associated with the display.

To implement the actual display, you'll want to implement the method render.
See _progress_bar.py or _placeholder.py for two examples of widgets that implement the method render.

Take a look at #2333 to see what files need to be changed when you implement a new widget.
Then, don't be like me and also do the final step shown in #2399 to add your new widget to the widget gallery.

Good luck and have fun!

@willmcgugan
Copy link
Collaborator

I'm thinking that this should accept a str. I can see us wanting to render more than integers. We might also want to pad it with zeros. Consider 001 002 etc.

We should also consider extending it with a few more characters. I'm thinking "+", "-", and ".". Maybe even "X" for mathematical notation.

@davep
Copy link
Contributor

davep commented Jul 12, 2023

mathematical notation

Longer-term, this could then feed into Textualize/frogmouth#46

@eliasdorneles
Copy link

Hello, EuroPython sprinter here, I'd like to take this one! =)

@willmcgugan
Copy link
Collaborator

Fantastic. Looking forward to this one.

@davep davep linked a pull request Aug 9, 2023 that will close this issue
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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

Successfully merging a pull request may close this issue.

4 participants