def setscreen(self):
if self.kivy:
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
from kivy.utils import platform as core_platform
self.root = FloatLayout()
if (self.xratio == 0) or (self.yratio == 0):
if core_platform == 'android':
self.screen_size = Window.size
if self.screen_size[0] < self.screen_size[1]:
x = self.screen_size[0]
y = self.screen_size[0] / 4 * 3
self.screen_size = (x, y)
else:
self.screen_size = (800, 600)
self.xratio = self.screen_size[0] / 800.0
self.yratio = self.screen_size[1] / 600.0
if core_platform == 'android':
Window.softinput_mode = 'pan'
else:
Window.size = self.screen_size
else:
import ui
if (self.xratio == 0) or (self.yratio == 0):
ss1 = ui.get_screen_size()[0]
ss3 = ui.get_screen_size()[1]
notoptimal = True
while notoptimal:
if ss1 % 8 == 0:
notoptimal = False
else:
ss1 -= 1
ss2 = (ss1 / 4) * 3
title_bar_height = int(ss3 / 600 * 90)
if ss2 > ss3 - title_bar_height:
ss2 = ss3 - title_bar_height
notoptimal = True
while notoptimal:
if ss2 % 6 == 0:
notoptimal = False
else:
ss2 -= 1
ss1 = (ss2 / 3) * 4
self.screen_size = (ss1, ss2)
self.xratio = ss1 / 800
self.yratio = ss2 / 600
self.root = ui.View(frame=(0,0,self.screen_size[0], \
self.screen_size[1]))
评论列表
文章目录