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

Make sure the wizard buttons always remain visible in NCurses (SLE-15-SP1 branch) #926

Merged
merged 2 commits into from
May 16, 2019
Merged

Make sure the wizard buttons always remain visible in NCurses (SLE-15-SP1 branch) #926

merged 2 commits into from
May 16, 2019

Conversation

shundhammer
Copy link
Contributor

This is for the SLE-15-SP1 branch. The merge to master will follow.

Trello

https://trello.com/c/kUpqSPGu

Bugzilla

https://bugzilla.suse.com/show_bug.cgi?id=1133367

Problem

In the NCurses UI, the wizard buttons can disappear when the wizard content is too large.

registration-ncurses-80x24-broken
Notice there are no wizard buttons visible.

Cause

Unlike in the Qt UI, the NCurses UI does not have a dedicated Wizard widget; a wizard dialog is pieced together from standard widgets. This includes the outer wizard dialog, the wizard buttons and the framework for the wizard contents which is basically a fancy ReplacePoint where the application later puts the dialog content.

Since all those parts were created equal, in case the UI runs out of screen space because a wizard dialog is overcrowded, it has to cut off widgets somewhere. In the standard algorithm it cuts off some part of all the widgets in the dimension where there is not enough space; so the dialog content loses some space, and the wizard buttons also lose some space.

But since an NCurses button is only one line high, it will quickly disappear if that happens in the vertical dimension, making the buttons useless.

Fix

Give higher layout priority to the wizard buttons, i.e. lower the layout priority for the dialog content in the vertical dimension.

This is commonly done with a VWeight widget: In a VBox, each item gets the space that it reports it needs, and excess space is distributed evenly or, if there are VWeights, according to those VWeights.

In the opposite case when there is not enough space, the widgets without a VWeight get their desired space, and the rest goes to the widgets with a VWeight. If there is only one of those, it gets all the remaining space.

Screenshots

registration-ncurses-80x24-fixed
80x24: The problematic case in this bug. Notice the wizard buttons are now there alright.

registration-ncurses-128x40-fixed
128x40: Works fine with much larger than standard resolution.

registration-ncurses-80x20-fixed
80x20: Even works fine with much less resolution (but this is really pushing the limits).

Effect on other dialogs and modules

They won't ever lose their wizard buttons again. They will be the last screen element to disappear.

So this fix fixes not only this particular case, but all NCurses wizard buttons in all dialogs and modules forevermore.


The diff is best viewed with Diff Settings -> Hide Whitespace Changes.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 28.076% when pulling 7b53daa on shundhammer:huha-ncurses-wizard-buttons-sp1 into 982e356 on yast:SLE-15-SP1.

Copy link
Member

@lslezak lslezak left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot for the details in the PR! 👍

@shundhammer shundhammer merged commit fec7438 into yast:SLE-15-SP1 May 16, 2019
@shundhammer shundhammer deleted the huha-ncurses-wizard-buttons-sp1 branch May 16, 2019 10:13
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.

3 participants