Skip to content

Use automatic width for License Agreement text#13868

Merged
seanbudd merged 5 commits into
masterfrom
fixWidthLicenseAgreement
Jul 12, 2022
Merged

Use automatic width for License Agreement text#13868
seanbudd merged 5 commits into
masterfrom
fixWidthLicenseAgreement

Conversation

@seanbudd

@seanbudd seanbudd commented Jul 4, 2022

Copy link
Copy Markdown
Member

Link to issue number:

None

Summary of the issue:

The width of the License Agreement was fixed, however the outer dialog scales with DPI.
This causes inconsistent behaviour for the License Agreement text sizing within the Launcher dialog.

Examples refer to a machine with high DPI and 200% scaling

For example, the width of the license agreement text for my machine display setting is roughly 2/3rds of the dialog.
image

Additionally, the GPL2 license text is manually wrapped wraps at different line lengths, with 80 being the most common.
Longer lines exist for custom changes to the GPL2 license.

Description of user facing changes

Makes the width of the license text dialog fit 80 characters of text comfortably.
Also changes the height of the dialog by ~100px (scaled) for readability.

Example with same display settings:
image

Description of development approach

Get a the width of a line of license text by creating and destroying a hidden text control.
Use that to set the scaled size of the license text.

Testing strategy:

Manual testing

Visually checking the installer dialog when running the launcher created with scons source and this PR build.

Opening the installer dialog from the python console, when running from source:

import gui
from gui.startupDialogs import LauncherDialog
x = LauncherDialog(gui.mainFrame)
x.run()

Known issues with pull request:

The license text in copying.txt is wrapped inconsistently.
It should be considered to reformat the file so that all sentences and only sentences end in a new line.

Change log entries:

Not worth a changelog entry IMO

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

Also increases the set height from 400px to 500px
@seanbudd seanbudd requested a review from a team as a code owner July 4, 2022 03:39
@seanbudd seanbudd requested a review from feerrenrut July 4, 2022 03:39
@seanbudd seanbudd changed the title Size width automatically for License Agreement Use automatic width for License Agreement text Jul 4, 2022
Comment thread source/gui/startupDialogs.py Outdated
@seanbudd seanbudd requested a review from feerrenrut July 5, 2022 06:30
@AppVeyorBot

This comment was marked as resolved.

Comment thread source/gui/startupDialogs.py Outdated
Comment on lines +162 to +167
_fakeTextCtrl = wx.StaticText(
self,
label="a" * 80, # The GPL2 text of copying.txt wraps sentences at 80 characters
)
widthOfLicenseText = _fakeTextCtrl.Size[0]
_fakeTextCtrl.Destroy()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be put in a helper function, wouldn't want to accidentally use _fakeTextCtrl after Destroy().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed this up

Comment thread source/gui/startupDialogs.py Outdated
_fakeTextCtrl.Destroy()
licenseTextCtrl = wx.TextCtrl(
self,
size=(widthOfLicenseText, self.scaleSize(300)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe the wx.TextCtrl also has a margin around the text. But the width is the total space the control takes up (including borders, margins, etc). Making it the width of 80 chars, may not make it big enough to contain 80 chars.
There might be a way to set the "clientSize".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think visually this does not matter, as the spacing provided for the license text ends up being greater than required to hold 80 chars.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note that the dialog appears the same for you, Quentin and I with vastly different display settings.

@seanbudd seanbudd requested a review from feerrenrut July 6, 2022 00:49
@seanbudd seanbudd merged commit 365f4f0 into master Jul 12, 2022
@seanbudd seanbudd deleted the fixWidthLicenseAgreement branch July 12, 2022 06:12
@nvaccessAuto nvaccessAuto added this to the 2022.3 milestone Jul 12, 2022
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.

4 participants