Replies: 1 comment
-
The notification facility in Textual is designed to be a straightforward stack of notifications, such that the user can always be sure where to look to see new notifications; and, of course, it's a scrolling list with newer items always appearing in the bottom right corner. I might be missing the benefit of having them potentially appear in lost of different locations with no clear way in which they could scroll as more come in. However, with that said, if you want them to work in a different way for your applications, the underlying system is mostly designed so that it can be replaced by your app (albeit by overriding an internal or two). To achieve what you're taking about it's probably easier for you to implement your own toast display overlay, and then override |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was wondering if anyone had looked into allowing toasts to be positional rather than hardcoded based on the ToastRack CSS
There might be a simple way to do this as an interim-workaround (such as just setting the CSS per notification via classes) but I think it might be worth considering to refactor the notification class to allow a 'position' argument in a pythonic way for the future.
I've tried (unsuccessfully) to set classes to control the ToastRack / ToastHolder positioning but I haven't had any success so far.
(If anyone knows how please pass that info along as that might make this idea moot, but hey, an answer is an answer)
Thoughts on this if it were implemented via python were using a Literal Type-alias like so:
This would then require changing the notification class to include that attribute as well:
I am not sure how hard this would be to include, but I suspect that the
mount
function would need to handle this for the toast by setting the CSS for the related ToastRack / ToastHolder objects containing the toast to help it be sustainable going forward.(and always defaulting back to the normal bottom-right position if not specified)
I am looking into how I can accomplish this, but if someone has any ideas or input feel free to share!
I wanted to open this thread so that if anyone else was working on this (or something similar) we could get it all in one place to get a better end result.
Beta Was this translation helpful? Give feedback.
All reactions