Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class TextInputProbe(LabelProbe):
native_class = jclass("android.widget.EditText")
default_font_size = 18
redo_available = True

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions changes/3914.feature.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The PasswordInput widget is now supported in the Qt backend.
1 change: 1 addition & 0 deletions cocoa/tests_backend/widgets/multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class MultilineTextInputProbe(SimpleProbe):
native_class = NSScrollView
redo_available = True

def __init__(self, widget):
super().__init__(widget)
Expand Down
1 change: 1 addition & 0 deletions cocoa/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

class TextInputProbe(SimpleProbe):
native_class = NSTextField
redo_available = True

@property
def value(self):
Expand Down
1 change: 0 additions & 1 deletion docs/en/reference/data/apis_by_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ General widgets:
- web
unsupported:
- textual
- qt

ProgressBar:
description: A horizontal bar to visualize task progress. The task being monitored can be of known or indeterminate length.
Expand Down
Binary file added docs/en/reference/images/passwordinput-qt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gtk/tests_backend/widgets/multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class MultilineTextInputProbe(SimpleProbe):
native_class = Gtk.ScrolledWindow
redo_available = True

if GTK_VERSION >= (4, 0, 0):
pytest.skip("GTK4 doesn't support multiline text input yet")
Expand Down
1 change: 1 addition & 0 deletions gtk/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class TextInputProbe(SimpleProbe):
native_class = Gtk.Entry
redo_available = True

@property
def value(self):
Expand Down
1 change: 1 addition & 0 deletions iOS/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class TextInputProbe(SimpleProbe):
native_class = UITextField
redo_available = True

@property
def value(self):
Expand Down
2 changes: 2 additions & 0 deletions qt/src/toga_qt/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .widgets.button import Button
from .widgets.imageview import ImageView
from .widgets.label import Label
from .widgets.passwordinput import PasswordInput
from .widgets.progressbar import ProgressBar
from .widgets.switch import Switch
from .widgets.textinput import TextInput
Expand Down Expand Up @@ -46,6 +47,7 @@
"Container",
"Box",
"Label",
"PasswordInput",
"ProgressBar",
"Switch",
"TextInput",
Expand Down
9 changes: 9 additions & 0 deletions qt/src/toga_qt/widgets/passwordinput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from PySide6.QtWidgets import QLineEdit

from .textinput import TextInput


class PasswordInput(TextInput):
def create(self):
super().create()
self.native.setEchoMode(QLineEdit.Password)
5 changes: 5 additions & 0 deletions qt/tests_backend/widgets/passwordinput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .textinput import TextInputProbe


class PasswordInputProbe(TextInputProbe):
redo_available = False
1 change: 1 addition & 0 deletions qt/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class TextInputProbe(SimpleProbe):
native_class = QLineEdit
redo_available = True

@property
def value(self):
Expand Down
14 changes: 8 additions & 6 deletions testbed/tests/widgets/test_textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,18 @@ async def test_undo_redo(widget, probe):
assert probe.value == text_1

# undo
expected_text = text_0 if probe.redo_available else ""
await probe.undo()
await probe.redraw(f"Widget value should be {text_0!r}")
assert widget.value == text_0
assert probe.value == text_0
await probe.redraw(f"Widget value should be {expected_text!r}")
assert widget.value == expected_text
assert probe.value == expected_text

# redo
expected_text = text_1 if probe.redo_available else ""
await probe.redo()
await probe.redraw(f"Widget value should be {text_1!r}")
assert widget.value == text_1
assert probe.value == text_1
await probe.redraw(f"Widget value should be {expected_text!r}")
assert widget.value == expected_text
assert probe.value == expected_text


async def test_no_event_on_initialization(widget, probe, on_change):
Expand Down
1 change: 1 addition & 0 deletions winforms/tests_backend/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class TextInputProbe(SimpleProbe):
native_class = TextBox
fixed_height = 23
redo_available = True

@property
def value(self):
Expand Down