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 textual dialogs #2092

Merged
merged 6 commits into from
Aug 25, 2023
Merged

Add textual dialogs #2092

merged 6 commits into from
Aug 25, 2023

Conversation

freakboy3742
Copy link
Member

@freakboy3742 freakboy3742 commented Aug 22, 2023

Add Info, Question, Confirm, Error, and Stack Trace dialogs for Textual.

Also corrects the 24/25 line aspect ratio calculation identified in this comment

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

super().__init__()
self.interface = impl.interface
self.impl = impl
self.titlebar = TitleBar(title)
Copy link
Member

Choose a reason for hiding this comment

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

I noticed that the standard title bar expands when you click on it, which isn't really useful. Was that the reason for replacing it, or was there something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

The primary reason for replacing it was that Header() can (AFAICT) only have the title of the app. That's great for the default title of a MainWindow, but useless for every other location where we might need a header (such as the titlebar of a dialog, or the titlebar or any other window - or changing the title of the main window. Removing the "thick" rendering was a bonus.

Comment on lines 11 to 13
class CloseIcon(TextualWidget):
DEFAULT_CSS = """
CloseIcon {
Copy link
Member

Choose a reason for hiding this comment

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

In the standard Textual header, I don't think this was intended to be a close button, but an application icon, as it's in the place where the icon would be on Windows.

Now that I'm a Mac user, I thought it was a close button too, and spent some time trying to work out why it didn't do anything. To avoid this confusion, maybe we'd be better off just removing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a fair point - it's a decoration, but not a functional one.

I guess the alternative would be to make it functional... turn it into a button that does the close action on the window...

Copy link
Member

@mhsmith mhsmith left a comment

Choose a reason for hiding this comment

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

Looks fine to me, except that the X on the close button was disappearing when you pointed at it, in both the VSCode terminal and the macOS terminal. It looks like this is caused by the border: none property, so I've added that to the hover block as well.

@freakboy3742 freakboy3742 merged commit c60c429 into beeware:main Aug 25, 2023
40 checks passed
@freakboy3742 freakboy3742 deleted the textual-dialogs branch August 25, 2023 09:43
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