From 567e526e294766cdad41c7226e5a4be6c8dc57fa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 3 Feb 2021 14:44:59 +0800 Subject: [PATCH] bugfix --- kivyblocks/blocks.py | 10 +++++++++- kivyblocks/ready.py | 6 +++--- kivyblocks/register.py | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/kivyblocks/blocks.py b/kivyblocks/blocks.py index 3de40c3..ed635ca 100755 --- a/kivyblocks/blocks.py +++ b/kivyblocks/blocks.py @@ -648,11 +648,19 @@ class Blocks(EventDispatcher): if w: return find_widget_by_id(id, w) return None + ids = id.split('.') app = App.get_running_app() - if id.startswith('/self') or id.startswith('root'): + fid = ids[0] + if fid == '/self' or fid == 'root': from_widget = app.root ids[0] = 'self' + if fid == 'Window': + from_widget == Window + ids[0] = 'self' + if fid == 'app': + return app + if from_widget is None: from_widget = app.root for id in ids: diff --git a/kivyblocks/ready.py b/kivyblocks/ready.py index 303b163..54ded91 100644 --- a/kivyblocks/ready.py +++ b/kivyblocks/ready.py @@ -10,12 +10,12 @@ desktopOSs=[ "macosx" ] -class WidgetReady(EventDispatcher): +class WidgetReady(object): fullscreen = BooleanProperty(False) - _fullscreen_state = False - def __init__(self): + def __init__(self, **kw): self.register_event_type('on_ready') + self._fullscreen_state = False self._ready = False def on_ready(self): diff --git a/kivyblocks/register.py b/kivyblocks/register.py index 6551a68..1ae9d6f 100644 --- a/kivyblocks/register.py +++ b/kivyblocks/register.py @@ -24,8 +24,11 @@ from .message import Conform from .pagepanel import PagePanel from .markdown import Markdown from .custom_camera import CustomCamera, QrReader +from .camerawithmic import CameraWithMic, ScreenWithMic r = Factory.register +r('ScreenWithMic', ScreenWithMic) +r('CameraWithMic', CameraWithMic) r('CustomCamera', CustomCamera) r('QrReader', QrReader) r('Markdown', Markdown)