-
Notifications
You must be signed in to change notification settings - Fork 103
TUI rewrite #1255
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
base: master
Are you sure you want to change the base?
TUI rewrite #1255
Conversation
Add the apis to BrickMain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to fully review this as the code is way more complex than my knowledge 😅 . My understading is:
- Menus are defined by two parallel datatypes The "Fields" + "Options", and then this
GenericMenu
thing which I barely understand... Instead of Having "Options" + list of fields as before. - Existentials are hidden behind TypeClasses + Data.Some if I understand correctly.
- I don't get the Overlays part. AFAIU,
brick
dispatches events to the frontward layers, so there is no need to pass events to the "child"/overlayed widget... but maybe I got this wrong
@lsmor Unfortunately the changes here did become big and complex. They can be seen as two major parts The first is the I guess the main thing to review here is how the new design is being used and how more features/widgets could be added. In this commit I have implemented a confirmation prompt for pre-install messages using this new design. Implementing this in the earlier design would have been far more complex. |
Removes use of existentials. fixes Remove existential types in TUI #1217
Makes use of GHC.Generics to take care of the Menu boilerplate
Improves the structure of code as each widget now need to implement the instance of BaseWidget, which captures the two essential parts, rendering and event handling.
The structure of the widget state matches directly to the "tree" structure of widgets. And the use of enums, like
Mode
, have been removed.The input fields are more generic and we can nest them, like
EditInput
is being used insideSelectInput
The value of input fields can be modified like this
The child widget does not modify the state of parent (as it was earlier being done via lens)
The 'quit' key handling logic is now mostly part of the
BasicOverlay
abstraction, and has been removed from the event handlers of individual widgets.We can even do nesting of
GenericMenu
, in case we want to make fancy sub-menus