Use automatic width for License Agreement text#13868
Conversation
Also increases the set height from 400px to 500px
This comment was marked as resolved.
This comment was marked as resolved.
| _fakeTextCtrl = wx.StaticText( | ||
| self, | ||
| label="a" * 80, # The GPL2 text of copying.txt wraps sentences at 80 characters | ||
| ) | ||
| widthOfLicenseText = _fakeTextCtrl.Size[0] | ||
| _fakeTextCtrl.Destroy() |
There was a problem hiding this comment.
This could be put in a helper function, wouldn't want to accidentally use _fakeTextCtrl after Destroy().
| _fakeTextCtrl.Destroy() | ||
| licenseTextCtrl = wx.TextCtrl( | ||
| self, | ||
| size=(widthOfLicenseText, self.scaleSize(300)), |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Note that the dialog appears the same for you, Quentin and I with vastly different display settings.
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.

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:

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 sourceand this PR build.Opening the installer dialog from the python console, when running from source:
Known issues with pull request:
The license text in
copying.txtis 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: