-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Set default background color for widgets on iOS #3009
Merged
+8
−54
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
046d8de
Set default background color for widgets on iOS
proneon267 481ea93
Remove unnecessary color conversion
proneon267 c7553ed
Enable background color tests for slider widget
proneon267 f18cbf1
Revert enabled slider background color tests
proneon267 5813bc0
Use systemBackgroundColor as default fallback
proneon267 a68c366
Remove complex background color assignment on button
proneon267 2d39724
Set default background color on activityindicator
proneon267 d61e23e
Keep the widget's original background color as the default background…
proneon267 c9cfb35
Keep the widget's original background color as the default background…
proneon267 65eb6d0
Merge branch 'main' into iOS_transparency_fix
proneon267 ae30d17
Restart CI
proneon267 a71325c
Merge branch 'beeware:main' into iOS_transparency_fix
proneon267 0e3db97
Remove `_default_background_color`
proneon267 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
On iOS, the default background color is now TRANSPARENT for Box, Canvas, ImageView, Label, ProgressBar, ScrollContainer and Slider widgets. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
from rubicon.objc import CGRect, NSInteger, NSMakeRect, objc_method, send_super | ||
from travertino.size import at_least | ||
|
||
from toga.colors import TRANSPARENT | ||
from toga_iOS.colors import native_color | ||
from toga_iOS.libs import ( | ||
NSLineBreakByClipping, | ||
|
@@ -47,12 +46,6 @@ def set_text_align(self, value): | |
def set_color(self, value): | ||
self.native.textColor = native_color(value) | ||
|
||
def set_background_color(self, color): | ||
if color == TRANSPARENT or color is None: | ||
self.native.backgroundColor = native_color(TRANSPARENT) | ||
else: | ||
self.native.backgroundColor = native_color(color) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with ImageView - why does the implementation change not match Button? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as #3009 (comment) |
||
|
||
def set_font(self, font): | ||
self.native.font = font._impl.native | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
This was the same implementation as
Button
... why hasn't the implementation changed in the same way?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.
Not really, the implementation of Button was:
Here,
TRANSPARENT
andNone
are shorted toNone
, as the behavior of setting transparent or resetting the button background color is restoring to the original background color, like on other backends.While the previous implementation of ImageView was:
Here,
TRANSPARENT
andNone
are instead shorted toTRANSPARENT
. Hence, the backgroundColor implementation is different from Button.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.
Ah - they're very similar, but not quite the same; the key difference being that Button is explicitly changing the interpretation of TRANSPARENT to "reset", whereas imageview/label are using the default interpretation (and relying on the fact that "clearColor" and "None" are effectively the same on iOS for these widgets). Thanks for the clarification.