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 text attributes not changing after the settings panel is opened #8535

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

ElliotGarbus
Copy link
Contributor

@ElliotGarbus ElliotGarbus commented Dec 29, 2023

If the settings panel is opened text attributes will no longer get updated. See issues: #8519, #8079, #8047, #7895,

Below is a test case. In version 2.2.1 of kivy, if the setting panel is opened the on screen count will stop, and will not resume. The Clock callback continues.

from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.properties import NumericProperty, BooleanProperty

kv = """
BoxLayout:
    BoxLayout:
        orientation: 'vertical'
        Label:
            id: label
            text: str(app.count)
            font_size: 60
        BoxLayout:
            size_hint_y: None
            height: dp(48)
            Button:
                text: 'Open Settings'
                on_release: app.open()
                disabled: app.settings_open
    BoxLayout:
        id: box
"""


class CheckSettings(App):
    count = NumericProperty(0)
    settings_open = BooleanProperty(False)

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def build(self):
        return Builder.load_string(kv)

    def display_settings(self, settings):
        self.root.ids.box.add_widget(settings)
        self.settings_open = True
        return True

    def close_settings(self, *args):
        self.root.ids.box.clear_widgets()
        self.settings_open = False

    def on_start(self):
        Clock.schedule_interval(self._count, 1)

    def _count(self, _):
        self.count += 1
        print(f'Count: {self.count}')

    def open(self):
        self.open_settings()   # added to use as a breakpoint


CheckSettings().run()

The issue: In settings.py the class SettingTitle was erroneously redefining Label.text.

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.

…d and bound the label text attribute to title in kv.
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

And 2.3.0rc2 on its way!

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

2 participants