This commit is contained in:
yumoqing 2021-01-04 19:55:38 +08:00
parent 5ee7e534ff
commit bf2e9bc1e3
2 changed files with 11 additions and 1 deletions

View File

@ -533,7 +533,7 @@ class Blocks(EventDispatcher):
@classmethod @classmethod
def getWidgetById(self,id,from_widget=None): def getWidgetById(self,id,from_widget=None):
def find_widget_by_id(id, from_widget=None): def find_widget_by_id(id, from_widget):
if id=='self': if id=='self':
return from_widget return from_widget
if hasattr(from_widget,'widget_id'): if hasattr(from_widget,'widget_id'):
@ -547,6 +547,12 @@ class Blocks(EventDispatcher):
ret = find_widget_by_id(id,from_widget=c) ret = find_widget_by_id(id,from_widget=c)
if ret: if ret:
return ret return ret
app = App.get_running_app()
if from_widget == app.root:
w = getattr(app,'fs_widget',None)
if w:
print('full screen ...............................')
return find_widget_by_id(id, w)
return None return None
ids = id.split('.') ids = id.split('.')
app = App.get_running_app() app = App.get_running_app()

View File

@ -1,6 +1,7 @@
from kivy.event import EventDispatcher from kivy.event import EventDispatcher
from kivy.core.window import Window from kivy.core.window import Window
from kivy.utils import platform from kivy.utils import platform
from kivy.app import App
from kivy.properties import BooleanProperty from kivy.properties import BooleanProperty
desktopOSs=[ desktopOSs=[
@ -64,8 +65,10 @@ class WidgetReady(EventDispatcher):
'no parent.') 'no parent.')
return return
app = App.get_running_app()
if value: if value:
Window.fullscreen = True Window.fullscreen = True
app.fs_widget = self
self._fullscreen_state = state = { self._fullscreen_state = state = {
'parent': self.parent, 'parent': self.parent,
'pos': self.pos, 'pos': self.pos,
@ -91,6 +94,7 @@ class WidgetReady(EventDispatcher):
self.pos_hint = {} self.pos_hint = {}
self.size_hint = (1, 1) self.size_hint = (1, 1)
else: else:
app.fs_widget = None
Window.fullscreen = False Window.fullscreen = False
#if platform in desktopOSs: #if platform in desktopOSs:
# Window.restore() # Window.restore()