fixup: fix setters for doc_background_pattern_width/height_unitentry …#1773
Open
Doublonmousse wants to merge 1 commit into
Open
fixup: fix setters for doc_background_pattern_width/height_unitentry …#1773Doublonmousse wants to merge 1 commit into
Doublonmousse wants to merge 1 commit into
Conversation
…on setup Otherwise the following occurs : - the unitentry starts with default dpi and value whereas the engine has the correct value - setting the dpi first makes the unitentry recalculate with the new dpi but default value so a new value in px is applied to the engine through the connect_notify on "value" - setting the value in px afterwards will recalculate the value (this time with the correct dpi/value/unit combo) so the value in px is correct but this triggers again a modification on the engine because we changed this value just before. This thus triggers 2*2 updates of the engine upon startup. But changing the order isn't enough (as in that case the first change of the value will return the expected value in px but not the second one if the unit is not px (because of the dpi scaling changing when setting the dpi with a unit != from px.). To fix this, create a setter that changes both dpi and value in a way where the value property is only set once with the correct value_in_px callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…on setup
Otherwise the following occurs :
This thus triggers 2*2 updates of the engine upon startup. But changing the order isn't enough (as in that case the first change of the value will return the expected value in px but not the second one if the unit is not px (because of the dpi scaling changing when setting the dpi with a unit != from px.).
To fix this, create a setter that changes both dpi and value in a way where the value property is only set once with the correct value_in_px callback
Fixes #1258. Replaces #1453
NOTE : the
elsepart inset_dpi_and_value_pxis not technically needed for the fix (I kinda figured it'd be better to have an helper function with all cases covered anyway, and that it's a little clearer this way)