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

Incorrect determinate MDSpinner behaviour? #792

Closed
mhuangwm opened this issue Jan 24, 2021 · 1 comment
Closed

Incorrect determinate MDSpinner behaviour? #792

mhuangwm opened this issue Jan 24, 2021 · 1 comment
Labels
Type: Bug Bug report/Bug fix

Comments

@mhuangwm
Copy link

Description of the Bug

The determinate MDSpinner with an indeterminate manner first load.
The MDSpinner with determinate does not rotate with a static starting point on second load.
(See gif)

Not sure if this is the intended behaviour, but I was expecting a behaviour to something like this:
https://kstatic.googleusercontent.com/files/22d91d17b8958635c1cc769856551760bf3f7c8ea274e01e017d2ca7b5b3833a3cea4a4155bdf32c3d365dc9d3b5d0757d87be8f6c97854f16b4b419df6fa030

Code and Logs

from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
Screen:
    MDSpinner:
        size_hint: None, None
        size: dp(100), dp(100)
        pos_hint: {'center_x': .5, 'center_y': .5}
        active: True if check.active else False
        determinate: True
        determinate_time: 20
    MDCheckbox:
        id: check
        size_hint: None, None
        size: dp(48), dp(48)
        pos_hint: {'center_x': .5, 'center_y': .4}
        active: True
'''
class Test(MDApp):
    def build(self):
        return Builder.load_string(KV)
Test().run()

Screenshots

mdspinner_determinate

Versions

  • OS:Ubuntu 20.04
  • Python: 3.7.9
  • Kivy: 2.00
  • KivyMD: 0.104.2.dev0
@mhuangwm
Copy link
Author

I think the problem comes from the init where to animation starts without waiting for the kv rules to apply:

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.color = self.theme_cls.primary_color

        ....

        if self.determinate:
            self._start_determinate()
        else:
            self._start_loop()

we should probably remove that and wait for kv rules to be applied before start:

    def on_kv_post(self, base_widget):
        if not self.active:
            return

        if self.determinate:
            self._start_determinate()
        else:
            self._start_loop()

result:
mdspinner_fix

@HeaTTheatR HeaTTheatR added the Type: Bug Bug report/Bug fix label Jan 25, 2021
KivyMD-Bot added a commit to kivymd/storage that referenced this issue Jan 25, 2021
KivyMD-Bot added a commit to kivymd/storage that referenced this issue Jan 25, 2021
KivyMD-Bot added a commit to kivymd/storage that referenced this issue Jan 25, 2021
KivyMD-Bot added a commit to kivymd/storage that referenced this issue Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug report/Bug fix
Projects
None yet
Development

No branches or pull requests

2 participants