From 89e0868a88a8be9ae8950d071c3c4f42325d1c5b Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 12 Jul 2020 08:54:13 +0800 Subject: [PATCH] bugfix --- kivyblocks/baseWidget.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kivyblocks/baseWidget.py b/kivyblocks/baseWidget.py index a473775..2bbb923 100755 --- a/kivyblocks/baseWidget.py +++ b/kivyblocks/baseWidget.py @@ -6,6 +6,8 @@ from kivy.uix.button import Button, ButtonBehavior from kivy.uix.accordion import Accordion,AccordionItem from kivy.uix.label import Label from kivy.event import EventDispatcher +from kivy.metrics import dp +from kivy.core.window import Window from kivy.uix.actionbar import ActionBar,ActionView,ActionPrevious,ActionItem,ActionButton from kivy.uix.actionbar import ActionToggleButton, ActionCheck,ActionSeparator,ActionGroup @@ -192,3 +194,11 @@ def getDataHandler(url,**kwargs): return FILEDataHandler(url,**kwargs) return HTTPDataHandler(url, **kwaegs) +def device_type(): + if platform != "android" and platform != "ios": + return "desktop" + elif Window.width >= dp(600) and Window.height >= dp(600): + return "tablet" + else: + return "mobile" +