Skip to content
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

Fix TextInputCutCopyPaste widget #7905

Merged
merged 1 commit into from Jun 23, 2022

Conversation

misl6
Copy link
Member

@misl6 misl6 commented Jun 21, 2022

The changes introduced in PR #7882 have broken the usage of the TextInputCutCopyPaste widget in a TextInput.

Minimal runnable example that reproduces the issue fixed in this PR:

TextInput:
    use_bubble: True
    text: "This is a test"

Error log:

Traceback (most recent call last):
   File "/Users/mirko/Documents/projects/kivy/examples/demo/kivycatalog/main.py", line 192, in <module>
     KivyCatalogApp().run()
   File "/Users/mirko/Documents/projects/kivy/kivy/app.py", line 955, in run
     runTouchApp()
   File "/Users/mirko/Documents/projects/kivy/kivy/base.py", line 574, in runTouchApp
     EventLoop.mainloop()
   File "/Users/mirko/Documents/projects/kivy/kivy/base.py", line 339, in mainloop
     self.idle()
   File "/Users/mirko/Documents/projects/kivy/kivy/base.py", line 379, in idle
     Clock.tick()
   File "/Users/mirko/Documents/projects/kivy/kivy/clock.py", line 733, in tick
     self.post_idle(ts, self.idle())
   File "/Users/mirko/Documents/projects/kivy/kivy/clock.py", line 776, in post_idle
     self._process_events()
   File "kivy/_clock.pyx", line 620, in kivy._clock.CyClockBase._process_events
     cpdef _process_events(self):
   File "kivy/_clock.pyx", line 653, in kivy._clock.CyClockBase._process_events
     self.handle_exception(e)
   File "kivy/_clock.pyx", line 649, in kivy._clock.CyClockBase._process_events
     event.tick(self._last_tick)
   File "kivy/_clock.pyx", line 218, in kivy._clock.ClockEvent.tick
     ret = callback(self._dt)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/textinput.py", line 1488, in long_touch
     self._show_cut_copy_paste(
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/textinput.py", line 1895, in _show_cut_copy_paste
     self._bubble = bubble = TextInputCutCopyPaste(textinput=self)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/textinput.py", line 306, in __init__
     super().__init__(**kwargs)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/bubble.py", line 406, in __init__
     super().__init__(**kwargs)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/boxlayout.py", line 145, in __init__
     super(BoxLayout, self).__init__(**kwargs)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/layout.py", line 76, in __init__
     super(Layout, self).__init__(**kwargs)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/widget.py", line 366, in __init__
     self.apply_class_lang_rules(
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/widget.py", line 470, in apply_class_lang_rules
     Builder.apply(
   File "/Users/mirko/Documents/projects/kivy/kivy/lang/builder.py", line 540, in apply
     self._apply_rule(
   File "/Users/mirko/Documents/projects/kivy/kivy/lang/builder.py", line 659, in _apply_rule
     widget.add_widget(child)
   File "/Users/mirko/Documents/projects/kivy/kivy/uix/bubble.py", line 416, in add_widget
     raise BubbleException(
 kivy.uix.bubble.BubbleException: Bubble can only contain a single Widget or Layout

Additionally, a layout issue was also introduced:

Expected:

Image 21-06-22 at 21 35

After the changes introduced in #7882:

Image 21-06-22 at 22 32

⚠️ After PR #7882, the bubble arrow may need some fixes to properly show on retina displays. It may be necessary to change the resource in order to avoid pixelation. (I have a retina-display-related WIP, so it will be managed separately)

Maintainer merge checklist

  • Title is descriptive/clear for inclusion in release notes.
  • Applied a Component: xxx label.
  • Applied the api-deprecation or api-break label.
  • Applied the release-highlight label to be highlighted in release notes.
  • Added to the milestone version it was merged into.
  • Unittests are included in PR.
  • Properly documented, including versionadded, versionchanged as needed.

@misl6 misl6 added this to the 2.2.0 milestone Jun 21, 2022
@misl6 misl6 added the Component: Widgets kivy/uix, style.kv label Jun 21, 2022
@akshayaurora akshayaurora merged commit 538cc24 into kivy:master Jun 23, 2022
id: content
BubbleButton:
id: cut
text: 'Cut'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm do we have many places with hardcoded strings in kivy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Widgets kivy/uix, style.kv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants