-
-
Notifications
You must be signed in to change notification settings - Fork 684
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
[widget audit] toga.MultilineTextInput #1938
Merged
Merged
Changes from 13 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
5cac536
Audit docs and core tests for MultilineTextInput.
freakboy3742 5429acc
WIP
freakboy3742 c0cf0f3
Cocoa MultilineTextView to 100% coverage.
freakboy3742 cc80700
iOS to 100% coverage.
freakboy3742 8fa3aa9
Add Changenote.
freakboy3742 9096f52
Use the UIKeyInput protocol to fake keyboard input.
freakboy3742 cf9da9c
Ensure a redraw includes at an event loop tick on macOS.
freakboy3742 5800c40
Spelling corrections in docstrings.
freakboy3742 6a5be8a
Tweaked some test docstrings.
freakboy3742 d89e49c
Gtk implementation to 100%
freakboy3742 2f8f214
Enable GTK focus tests.
freakboy3742 7aea2d0
Add a window manager to the GTK CI config.
freakboy3742 7fceda3
Correct iOS placeholder test definition.
freakboy3742 ead982d
Android WIP
mhsmith 43759f9
Merge branch 'main' into audit-multilinetext
freakboy3742 c763aa9
Add type annotations.
freakboy3742 4cdab2c
Tweaked some docs formatting.
freakboy3742 ff27cde
Simplified some probe handling.
freakboy3742 e636a1f
Tweaked handling of on-change and enabled.
freakboy3742 98343dc
Correct GTK on_change handling.
freakboy3742 375d26c
Additional tolerance for scoll size.
freakboy3742 8ef583d
Another scrollbar tolerance tweak.
freakboy3742 838c6e4
Propegate widget descriptions to the API summary page.
freakboy3742 6dff342
Actually save all the changes before pushing...
freakboy3742 80ea9f6
Update Android for changes in testbed
mhsmith b3b8ed3
Add tests for vertical alignment, and fix on Android
mhsmith cbe63ec
Implement vertical alignment checks for GTK.
freakboy3742 9eec789
Removed and no-covered some unreachable and unused content in cocoa/i…
freakboy3742 2ff9920
Probe implementations (and widget implementation) for top vertical al…
freakboy3742 08c8d50
Added Winforms implementation and fix for vertical alignment.
freakboy3742 e379547
Fix Android background color
mhsmith 5db4c77
Android at 100% coverage
mhsmith be9ca2f
Deprecated the clear() method on text inputs.
freakboy3742 07abb24
Add allowance for minor GTK style differences.
freakboy3742 e9132f0
Update change note and support table
mhsmith df00658
Make libs/android/graphics/drawable match Java package structure
mhsmith bb71950
All Winforms tests passing except test_scroll_position
mhsmith 3ad5352
Winforms at 100% coverage
mhsmith e687898
Correct iOS test failure caused by focus.
freakboy3742 4ca8a9b
Document Winforms issue with TRANSPARENT backgrounds, and mainline th…
freakboy3742 87fffda
Correct GTK handling of clearing while focussed.
freakboy3742 fee4bb6
Simplify winforms implementation, removing proxy value.
freakboy3742 9f871ef
Winforms: fix interactions between placeholder and on_change handler
mhsmith 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
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 @@ | ||
The MultilineTextInput widget now has 100% test coverage, and complete API documentation. |
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 |
---|---|---|
@@ -1,11 +1,97 @@ | ||
from toga.colors import TRANSPARENT | ||
from toga_cocoa.libs import NSScrollView | ||
|
||
from .base import SimpleProbe | ||
from .properties import toga_alignment, toga_color, toga_font | ||
|
||
|
||
class MultilineTextInputProbe(SimpleProbe): | ||
native_class = NSScrollView | ||
|
||
def __init__(self, widget): | ||
super().__init__(widget) | ||
self.native_text = widget._impl.native_text | ||
|
||
@property | ||
def value(self): | ||
return str(self.native_text.string) | ||
|
||
@property | ||
def placeholder(self): | ||
return str(self.native_text.placeholderString) | ||
|
||
def placeholder_visible(self): | ||
mhsmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# macOS manages it's own placeholder visibility. | ||
# We can use the existence of widget text as a proxy. | ||
return not bool(self.native_text.string) | ||
|
||
@property | ||
def placeholder_hides_on_focus(self): | ||
return False | ||
|
||
@property | ||
def color(self): | ||
return toga_color(self.native_text.textColor) | ||
|
||
@property | ||
def background_color(self): | ||
if self.native_text.drawsBackground: | ||
# Confirm the scroll container is also opaque | ||
assert self.native.drawsBackground | ||
if self.native_text.backgroundColor: | ||
return toga_color(self.native_text.backgroundColor) | ||
else: | ||
return None | ||
else: | ||
# Confirm the scroll container is also transparent | ||
assert not self.native.drawsBackground | ||
return TRANSPARENT | ||
|
||
@property | ||
def font(self): | ||
return toga_font(self.native_text.font) | ||
|
||
@property | ||
def alignment(self): | ||
return toga_alignment(self.native_text.alignment) | ||
|
||
@property | ||
def enabled(self): | ||
# Enabled is proxied onto readonly on the text view | ||
return self.native_text.isEditable() | ||
|
||
@property | ||
def readonly(self): | ||
return not self.native.documentView.isEditable() | ||
return not self.native_text.isEditable() | ||
|
||
@property | ||
def has_focus(self): | ||
return self.native.window.firstResponder == self.native_text | ||
|
||
@property | ||
def visible_height(self): | ||
return self.native.contentView.bounds.size.height | ||
|
||
@property | ||
def visible_width(self): | ||
return self.native.contentView.bounds.size.width | ||
mhsmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@property | ||
def document_height(self): | ||
return self.native_text.bounds.size.height | ||
|
||
@property | ||
def document_width(self): | ||
return self.native_text.bounds.size.width | ||
|
||
@property | ||
def horizontal_scroll_position(self): | ||
return self.native.contentView.bounds.origin.x | ||
|
||
@property | ||
def vertical_scroll_position(self): | ||
return self.native.contentView.bounds.origin.y | ||
|
||
async def wait_for_scroll_completion(self): | ||
# No animation associated with scroll, so this is a no-op | ||
pass |
Oops, something went wrong.
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 needed in the past to avoid a crash if the app ran on a MacBook with a Touch Bar; however, touchbars are no longer present on modern Macs, and in my testing on an older macBook with a Touch Bar, the bug no longer manifests.