コード例 #1
0
async def test_examples(native_app, path):
    example = path[:-6].replace("/", ".")  # Remove example/ and .enaml

    if "thermostat" in example:
        return pytest.skip("thermostat example needs updated")

    app = AndroidApplication(debug=True)
    with enaml.imports():
        try:
            ContentView = locate(f"{example}.ContentView")
        except ErrorDuringImport as e:
            msg = f"{e}"
            if iconify is None and "iconify" in msg:
                return pytest.skip("enaml-native-icons is not installed")
            if googlemaps is None and "googlemaps" in msg:
                return pytest.skip("enaml-native-maps is not installed")
            if charts is None and "charts" in msg:
                return pytest.skip("enaml-native-charts is not installed")
            raise

    app.activity = ExampleActivity(example=ContentView())
    f = nativehooks.shown = app.create_future()

    def on_error(event):
        f.set_exception(event["value"])

    app.observe("error_occurred", on_error)

    # f.add_done_callback(lambda f: app.stop())
    # Add fail timeout
    app.timed_call(5 * 1000, lambda: f.set_result(False))
    app.deferred_call(app.activity.start)
    assert await f
コード例 #2
0
def main():
    from charts.android.factories import install
    install()
    #: Called to start your app
    from enamlnative.android.app import AndroidApplication
    app = AndroidApplication()
    #app.debug = True #: Uncomment to debug the bridge
    app.dev = '192.168.41.139'  #: Uncomment to enable reloading
    app.reload_view = reload_view
    app.deferred_call(load_view, app)
    app.start()
コード例 #3
0
def main():
    #: TODO: Plugins should support this...
    from zxing.android.factories import install
    install()

    #: Called to start your app
    from enamlnative.android.app import AndroidApplication
    app = AndroidApplication()
    app.debug = True  #: Makes a lot of lag!
    app.dev = 'server'  # "10.0.2.2" # or 'server'
    app.reload_view = reload_view
    app.deferred_call(load_view, app)
    app.start()
コード例 #4
0
def main():
    """ Called by PyBridge.start()
    """
    print(sys.path)
    import enamlnative
    with enamlnative.imports():
        from enamlnative.android.app import AndroidApplication
        app = AndroidApplication('com.codelv.enamlnative.EnamlActivity')
    app.debug = True  #: Makes a lot of lag!
    app.dev = 'server'
    app.reload_view = reload_view
    app.deferred_call(load_view, app)
    app.start()
コード例 #5
0
def main():
    """ Called by PyBridge.start()
    """
    print(sys.path)
    import enamlnative
    with enamlnative.imports():
        from enamlnative.android.app import AndroidApplication
        app = AndroidApplication('com.enaml.MainActivity')
    #app.debug = True #: Makes a lot of lag!
    #app.dev = '192.168.34.103'
    #app.reload_view = reload_view
    app.ignore_reference_errors = True
    app.deferred_call(load_view, app)
    #app.deferred_call(dump_stats)
    app.start()
コード例 #6
0
ファイル: main.py プロジェクト: marksagal/enaml-native
def main():
    """ Called by PyBridge.start()
    """
    #: If we don't our code goes away
    os.environ['TMP'] = os.path.join(sys.path[0], '../tmp')

    import enamlnative
    from enamlnative.android.app import AndroidApplication
    app = AndroidApplication()
    #app.debug = True #: Makes a lot of lag!
    app.dev = 'server' # "10.0.2.2" # or 'server'
    app.reload_view = reload_view
    app.deferred_call(load_view, app)
    app.deferred_call(dump_stats)
    app.start()