def remove_from_focus(self, prev_focus=False):
'''Remove widget from focusable_widgets or focus_grab_widgets list'''
global current_focus, prev_focused_widgets, focus_grab_widgets
global prev_focused_widgets
if current_focus == self:
remove_focus()
if self.grab_focus and self in focus_grab_widgets:
focus_grab_widgets.remove(self)
elif self in focusable_widgets:
focusable_widgets.remove(self)
remlist = [
i for i, x in enumerate(prev_focused_widgets) if x() == self]
for x in reversed(remlist):
del prev_focused_widgets[x]
if prev_focus:
Clock.schedule_once(set_focus_previous, 0)
评论列表
文章目录