Example #1
0
def register_plugin(manager):
    manager._plugin_loaded = True
    manager.register_widget(type='button',
                            place='entry-actions',
                            endpoint='test_x_x',
                            filter=lambda f: True)
    manager.register_widget(type='button',
                            place='entry-actions',
                            endpoint='test_a_x',
                            filter=lambda f: f.mimetype.startswith('a/'))
    manager.register_widget(type='button',
                            place='entry-actions',
                            endpoint='test_x_a',
                            filter=lambda f: f.mimetype.endswith('/a'))
    manager.register_widget(type='button',
                            place='entry-actions',
                            endpoint='test_a_a',
                            filter=lambda f: f.mimetype == 'a/a')
    manager.register_widget(type='button',
                            place='entry-actions',
                            endpoint='test_b_x',
                            filter=lambda f: f.mimetype.startswith('b/'))

    test_plugin_blueprint = flask.Blueprint(
        'test_plugin', __name__, url_prefix='/test_plugin_blueprint')
    test_plugin_blueprint.add_url_rule('/',
                                       endpoint='root',
                                       view_func=lambda: 'test_plugin_root')

    manager.register_blueprint(test_plugin_blueprint)
Example #2
0
def register_plugin(manager):
    widget_class = browsepy.widget.WidgetBase

    manager._plugin_loaded = True
    manager.register_action('test_x_x', widget_class('test_x_x'), ('*/*', ))
    manager.register_action('test_a_x', widget_class('test_a_x'), ('a/*', ))
    manager.register_action('test_x_a', widget_class('test_x_a'), ('*/a', ))
    manager.register_action('test_a_a', widget_class('test_a_a'), ('a/a', ))
    manager.register_action('test_b_x', widget_class('test_b_x'), ('b/*', ))

    test_plugin_blueprint = flask.Blueprint(
        'test_plugin', __name__, url_prefix='/test_plugin_blueprint')
    test_plugin_blueprint.add_url_rule('/',
                                       endpoint='root',
                                       view_func=lambda: 'test_plugin_root')

    manager.register_blueprint(test_plugin_blueprint)
Example #3
0
def register_plugin(manager):
    manager._plugin_loaded = True
    manager.register_widget(
        type='button',
        place='entry-actions',
        endpoint='test_x_x',
        filter=lambda f: True
        )
    manager.register_widget(
        type='button',
        place='entry-actions',
        endpoint='test_a_x',
        filter=lambda f: f.mimetype.startswith('a/')
        )
    manager.register_widget(
        type='button',
        place='entry-actions',
        endpoint='test_x_a',
        filter=lambda f: f.mimetype.endswith('/a')
        )
    manager.register_widget(
        type='button',
        place='entry-actions',
        endpoint='test_a_a',
        filter=lambda f: f.mimetype == 'a/a'
        )
    manager.register_widget(
        type='button',
        place='entry-actions',
        endpoint='test_b_x',
        filter=lambda f: f.mimetype.startswith('b/')
        )

    test_plugin_blueprint = flask.Blueprint(
        'test_plugin',
        __name__,
        url_prefix='/test_plugin_blueprint')
    test_plugin_blueprint.add_url_rule(
        '/',
        endpoint='root',
        view_func=lambda: 'test_plugin_root')

    manager.register_blueprint(test_plugin_blueprint)
Example #4
0
def register_plugin(manager):
    manager._plugin_loaded = True
    manager.register_widget(type="button",
                            place="entry-actions",
                            endpoint="test_x_x",
                            filter=lambda f: True)
    manager.register_widget(
        type="button",
        place="entry-actions",
        endpoint="test_a_x",
        filter=lambda f: f.mimetype.startswith("a/"),
    )
    manager.register_widget(
        type="button",
        place="entry-actions",
        endpoint="test_x_a",
        filter=lambda f: f.mimetype.endswith("/a"),
    )
    manager.register_widget(
        type="button",
        place="entry-actions",
        endpoint="test_a_a",
        filter=lambda f: f.mimetype == "a/a",
    )
    manager.register_widget(
        type="button",
        place="entry-actions",
        endpoint="test_b_x",
        filter=lambda f: f.mimetype.startswith("b/"),
    )

    test_plugin_blueprint = flask.Blueprint(
        "test_plugin", __name__, url_prefix="/test_plugin_blueprint")
    test_plugin_blueprint.add_url_rule("/",
                                       endpoint="root",
                                       view_func=lambda: "test_plugin_root")

    manager.register_blueprint(test_plugin_blueprint)