Skip to content

Commit

Permalink
2.0.0 - Material Design 3
Browse files Browse the repository at this point in the history
Fix ` kivy.uix.widget.WidgetException` (double click to open the panel).
  • Loading branch information
HeaTTheatR committed Jan 16, 2024
1 parent eaf7a72 commit 752e79a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions kivymd/uix/expansionpanel/expansionpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ class MDExpansionPanel(DeclarativeBehavior, BoxLayout):
# Height of the MDExpansionPanelContent widget.
_original_content_height = NumericProperty()
_allow_add_content = False
_panel_is_process_opening = False

def __init__(self, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -492,18 +493,21 @@ def set_content_opacity(*args):
d=self.opening_time,
).start(self._content)
self.is_open = True
self._panel_is_process_opening = False
self.dispatch("on_open")

self._allow_add_content = True
self.add_widget(self._content)
if not self._panel_is_process_opening:
self._allow_add_content = True
self._panel_is_process_opening = True
self.add_widget(self._content)

anim_height = Animation(
height=self._original_content_height,
t=self.opening_transition,
d=self.opening_time,
)
anim_height.bind(on_complete=set_content_opacity)
anim_height.start(self._content)
anim_height = Animation(
height=self._original_content_height,
t=self.opening_transition,
d=self.opening_time,
)
anim_height.bind(on_complete=set_content_opacity)
anim_height.start(self._content)

def add_widget(self, widget, index=0, canvas=None):
if isinstance(widget, MDExpansionPanelHeader):
Expand Down

0 comments on commit 752e79a

Please sign in to comment.