bugfix
This commit is contained in:
parent
d90131c193
commit
0cb1d6f60d
@ -25,6 +25,8 @@ class OrientationLayout(WidgetReady, SwipeBehavior, FloatLayout):
|
||||
self.bind(on_swipe_right=self.toggle_second)
|
||||
self.bind(size=self.on_size_changed)
|
||||
self.bind(pos=self.on_size_changed)
|
||||
self.current_orient = None
|
||||
self.register_event_type('on_orientation_changed')
|
||||
|
||||
def build_children(self, *args):
|
||||
if isinstance(self.main_widget, dict):
|
||||
@ -52,8 +54,19 @@ class OrientationLayout(WidgetReady, SwipeBehavior, FloatLayout):
|
||||
self.on_size_changed(self.size)
|
||||
|
||||
def on_size_changed(self,*args):
|
||||
old_orient = self.current_orient
|
||||
if self.isLandscape():
|
||||
self.current_orient = 'landscape'
|
||||
else:
|
||||
self.current_orient = 'portrait'
|
||||
if old_orient and old_orient != self.current_orient:
|
||||
self.dispatch('on_orientation_changed')
|
||||
|
||||
Clock.schedule_once(self.two_widget_layout,0)
|
||||
|
||||
def on_orientation_changed(self, *args):
|
||||
print('on_orientation_changed fired')
|
||||
|
||||
def two_widget_layout(self, *args):
|
||||
if not isinstance(self.widget_main, Widget) or not isinstance(self.widget_second, Widget):
|
||||
# Clock.schedule_once(self.two_widget_layout,0)
|
||||
|
Loading…
Reference in New Issue
Block a user