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': if platform == 'android':
from jnius import autoclass from jnius import autoclass
from .android_rotation import get_rotation
class ServerInfo: class ServerInfo:
def __init__(self): def __init__(self):
self.rsaEngine = RSA() self.rsaEngine = RSA()
@ -96,6 +98,9 @@ kivyblocks_css_keys = [
] ]
class BlocksApp(App): class BlocksApp(App):
def get_rotation(self):
return get_rotation()
def load_csses(self): def load_csses(self):
config = getConfig() config = getConfig()
if not config.css: if not config.css:

View File

@ -1,4 +1,5 @@
from kivy.clock import Clock from kivy.clock import Clock
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivy.factory import Factory from kivy.factory import Factory
from kivy.core.window import Window 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_beforeswitch_portrait')
self.register_event_type('on_afterswitch_portrait') self.register_event_type('on_afterswitch_portrait')
self.bind(fullscreen=self.show_switch_image) self.bind(fullscreen=self.show_switch_image)
self.app = App.get_running_app()
def set_switch_button_pos(self): def set_switch_button_pos(self):
h = self.switch_button.height h = self.switch_button.height
@ -108,7 +110,7 @@ class TwoSides(WidgetReady, BoxLayout):
self.dispatch('on_afterswitch_landscape') self.dispatch('on_afterswitch_landscape')
self.panel_shape = 'landscape' self.panel_shape = 'landscape'
else: else:
print('twosides.py:Window.rotation=', Window.rotation, print('twosides.py:Window.rotation=', self.app.get_rotation(),
Window.size) Window.size)
if not self.portrait_widget in self.children: if not self.portrait_widget in self.children:
self.dispatch('on_beforeswitch_landscape') self.dispatch('on_beforeswitch_landscape')