This commit is contained in:
yumoqing 2021-06-30 11:07:19 +08:00
parent ff80d4b91a
commit cf6f74ec53
2 changed files with 8 additions and 1 deletions

View File

@ -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:

View File

@ -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')