Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event when create, update, or create an annotation #87

Merged
merged 8 commits into from
Dec 14, 2023
Merged

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Dec 12, 2023

resolves #76

I'm going back and forth between having one event for all or an event for each of the types.

Code
from __future__ import annotations

import holoviews as hv
import panel as pn

from holonote.annotate import Annotator, SQLiteDB
from holonote.app import PanelWidgets

hv.extension("bokeh")
pn.extension(notifications=True)

connector = SQLiteDB(table_name="test_events")

annotator = Annotator({"TIME": float}, fields=["description"], connector=connector)
anno = annotator * hv.Curve(range(10), kdims="TIME")


def notification(e):
    if e.type == "create":
        pn.state.notifications.info("Annotation created")
    elif e.type == "delete":
        pn.state.notifications.error("Annotation deleted")
    elif e.type == "update":
        pn.state.notifications.success("Annotation updated")


pn.bind(notification, annotator, watch=True) # or annotator.on_event(notification)


b = PanelWidgets(annotator)
pn.Row(b, anno).servable()
screenrecord-2023-12-12_16.20.13.mp4

@hoxbro hoxbro marked this pull request as draft December 12, 2023 15:24
Copy link

codspeed-hq bot commented Dec 12, 2023

CodSpeed Performance Report

Merging #87 will not alter performance

Comparing add_events (1bdc441) with main (89c966e)

Summary

✅ 6 untouched benchmarks

@hoxbro hoxbro marked this pull request as ready for review December 13, 2023 18:05
@hoxbro hoxbro merged commit 16a1040 into main Dec 14, 2023
17 checks passed
@hoxbro hoxbro deleted the add_events branch December 14, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watch for new annotation updates
1 participant