bugfix
This commit is contained in:
parent
b51cd43b73
commit
ac8ff8b36e
@ -627,6 +627,7 @@ class Blocks(EventDispatcher):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getWidgetById(self,id,from_widget=None):
|
def getWidgetById(self,id,from_widget=None):
|
||||||
|
print('getWidgetById(%s,%s) ...' % (id, from_widget))
|
||||||
def find_widget_by_id(id, from_widget):
|
def find_widget_by_id(id, from_widget):
|
||||||
if id=='self':
|
if id=='self':
|
||||||
return from_widget
|
return from_widget
|
||||||
@ -641,12 +642,6 @@ 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:
|
|
||||||
if Window.fullscreen == True:
|
|
||||||
w = app.fs_widget
|
|
||||||
if w:
|
|
||||||
return find_widget_by_id(id, w)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
ids = id.split('.')
|
ids = id.split('.')
|
||||||
@ -654,18 +649,29 @@ class Blocks(EventDispatcher):
|
|||||||
fid = ids[0]
|
fid = ids[0]
|
||||||
if fid == '/self' or fid == 'root':
|
if fid == '/self' or fid == 'root':
|
||||||
from_widget = app.root
|
from_widget = app.root
|
||||||
ids[0] = 'self'
|
if len(ids) == 1:
|
||||||
|
return from_widget
|
||||||
|
ids = ids[1:]
|
||||||
if fid == 'Window':
|
if fid == 'Window':
|
||||||
from_widget == Window
|
from_widget == Window
|
||||||
ids[0] = 'self'
|
if len(ids) == 1:
|
||||||
|
return from_widget
|
||||||
|
ids = ids[1:]
|
||||||
if fid == 'app':
|
if fid == 'app':
|
||||||
return app
|
return app
|
||||||
|
|
||||||
if from_widget is None:
|
if from_widget is None:
|
||||||
from_widget = app.root
|
from_widget = app.root
|
||||||
for id in ids:
|
for id in ids:
|
||||||
|
print('finding', id)
|
||||||
w = find_widget_by_id(id,from_widget=from_widget)
|
w = find_widget_by_id(id,from_widget=from_widget)
|
||||||
|
if w is None \
|
||||||
|
and id == ids[0] \
|
||||||
|
and Window.fullscreen == True \
|
||||||
|
and app.root != app.fs_widget:
|
||||||
|
w = find_widget_by_id(id, app.fs_widget)
|
||||||
if w is None:
|
if w is None:
|
||||||
|
print(id, 'not found ....')
|
||||||
return None
|
return None
|
||||||
from_widget = w
|
from_widget = w
|
||||||
return w
|
return w
|
||||||
|
@ -25,6 +25,12 @@ description file format
|
|||||||
self.bind(source=self.load_text)
|
self.bind(source=self.load_text)
|
||||||
if self.source:
|
if self.source:
|
||||||
Clock.schedule_once(self.load_text, 0.3)
|
Clock.schedule_once(self.load_text, 0.3)
|
||||||
|
self.bind(size=self.setChildMinWidth)
|
||||||
|
|
||||||
|
def setChildMinWidth(self, *args):
|
||||||
|
print('size changed')
|
||||||
|
for c in self._inner.children:
|
||||||
|
c.width = self.width
|
||||||
|
|
||||||
def load_text(self, *args):
|
def load_text(self, *args):
|
||||||
print('source fired, hahaha', *args)
|
print('source fired, hahaha', *args)
|
||||||
@ -52,6 +58,7 @@ description file format
|
|||||||
"text":txt,
|
"text":txt,
|
||||||
"size_hint_x":None,
|
"size_hint_x":None,
|
||||||
"width":self.width,
|
"width":self.width,
|
||||||
|
"minimum_width":self.width,
|
||||||
"size_hint_y":None,
|
"size_hint_y":None,
|
||||||
"markup":True,
|
"markup":True,
|
||||||
"wrap":True,
|
"wrap":True,
|
||||||
@ -95,6 +102,7 @@ description file format
|
|||||||
"wrap":True,
|
"wrap":True,
|
||||||
"size_hint_x":None,
|
"size_hint_x":None,
|
||||||
"width":self.width,
|
"width":self.width,
|
||||||
|
"minimum_width":self.width,
|
||||||
"markup":True,
|
"markup":True,
|
||||||
"valign":"middle",
|
"valign":"middle",
|
||||||
"halign":"left"
|
"halign":"left"
|
||||||
|
Loading…
Reference in New Issue
Block a user