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: Dialog widget #4044

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft

WiP: Dialog widget #4044

wants to merge 44 commits into from

Conversation

davep
Copy link
Contributor

@davep davep commented Jan 18, 2024

A dialog container/widget.

Work in progress.

The current version of this code uses a workaround for some needed functionality in CSS, to help calculate the ideal with/height of parts of the widget.

davep added 30 commits January 9, 2024 15:57
While the intention is that it won't be exported, I think it's sensible to
give it a "public" name so we can refer to it in styling guides, so
something can then style:

  Dialog > Body { ... }

and so on, without needing to use leading underscores, making it look like
they shouldn't do that.
Some of this text is just reminders for the moment, and proper linking will
need to be done too; but that can come once everything has settled down.
Far from having the final styles yet; but this gets me started.
I was inheriting from various containers to build up the key parts of the
dialog; the problem with that is that it's pretty easy for a developer using
this dialog to also have done some pretty simple app-level styling of a
Vertical or a Horizontal, and then things would start to fall apart in ways
they might not expect.

So here I just inherit from Widget and style the width/height/layout as
needed. It's not much extra work and it helps keep some isolation.
While I'm trying to get to the bottom of how best to size all the various
parts of the dialog, let's make it easier to see what part of the display is
responsible for what space.
I want this, but this managed to sneak in too early; so reverting.

There's currently a problem of wanting to width/height: auto this, but cap
it at 1fr within the max-width/height of its container. Textual can't handle
that right now; so we either need to find a better way of pulling this off,
or CSS might need a bit of a tweak to support this.
The plan isn't go actually go with this; but this sort of implements what
I'm aiming for; so we'll riff on this for the moment.
Tidying up the way I calculate the ideal height for the body. As mentioned
before, this isn't the ideal way to do things; it can give a flicker as the
dialog is first shown; but it's an approximation of what I want at least.
I think I'll want to dial in the styling some more; but this is the core
framework for this.
More to add to this, more to write, but this kicks off the basics for
documenting the Dialog.
I think there might be some to add, still to be decided, but now's a good
time to remove the placeholder in case that doesn't happen.
davep added 12 commits January 17, 2024 15:20
There's little point in someone putting one of these anywhere other than
inside a Dialog; so blow up if they do.
This helps make testing for this easier; for one thing.
Just some of the exception testing for now.
While I would never encourage it, ever, this does allow for a dialog within
a dialog (and, really, just don't!).
There are more comprehensive examples in the main documentation; there's
little point in having a cut-down version in the code too.
@davep davep added enhancement New feature or request Task labels Jan 18, 2024
@davep davep self-assigned this Jan 18, 2024
@davep davep linked an issue Jan 22, 2024 that may be closed by this pull request
@davep
Copy link
Contributor Author

davep commented Jan 22, 2024

Keeping this on hold for the moment, as per in-person request last week (as we want to do some extra work on CSS in support of some of the requirements in here).

@MatixAndr09
Copy link

Looks like a cool feature definitely will be used by me!! <3

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.

Dialog widget
2 participants