From cf6f74ec530c05678f0f53cbb99c4ad586e8e3b3 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 30 Jun 2021 11:07:19 +0800 Subject: [PATCH] bugfix --- kivyblocks/blocksapp.py | 5 +++++ kivyblocks/twosides.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kivyblocks/blocksapp.py b/kivyblocks/blocksapp.py index e9cf437..41bf972 100644 --- a/kivyblocks/blocksapp.py +++ b/kivyblocks/blocksapp.py @@ -36,6 +36,8 @@ from appPublic.rsa import RSA if platform == 'android': from jnius import autoclass +from .android_rotation import get_rotation + class ServerInfo: def __init__(self): self.rsaEngine = RSA() @@ -96,6 +98,9 @@ kivyblocks_css_keys = [ ] class BlocksApp(App): + def get_rotation(self): + return get_rotation() + def load_csses(self): config = getConfig() if not config.css: diff --git a/kivyblocks/twosides.py b/kivyblocks/twosides.py index 25166b5..3ccbad3 100644 --- a/kivyblocks/twosides.py +++ b/kivyblocks/twosides.py @@ -1,4 +1,5 @@ from kivy.clock import Clock +from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.factory import Factory from kivy.core.window import Window @@ -36,6 +37,7 @@ class TwoSides(WidgetReady, BoxLayout): self.register_event_type('on_beforeswitch_portrait') self.register_event_type('on_afterswitch_portrait') self.bind(fullscreen=self.show_switch_image) + self.app = App.get_running_app() def set_switch_button_pos(self): h = self.switch_button.height @@ -108,7 +110,7 @@ class TwoSides(WidgetReady, BoxLayout): self.dispatch('on_afterswitch_landscape') self.panel_shape = 'landscape' else: - print('twosides.py:Window.rotation=', Window.rotation, + print('twosides.py:Window.rotation=', self.app.get_rotation(), Window.size) if not self.portrait_widget in self.children: self.dispatch('on_beforeswitch_landscape')