File size: 671 Bytes
f3141ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import mesop as me
from state import State


def on_open_dialog(e: me.ClickEvent):
  """Generic event to open a dialog."""
  state = me.state(State)
  setattr(state, e.key, True)


def on_close_dialog(e: me.ClickEvent):
  """Generic event to close a dialog."""
  state = me.state(State)
  setattr(state, e.key, False)


def on_update_input(e: me.InputBlurEvent | me.InputEvent | me.InputEnterEvent):
  """Generic event to update input values."""
  state = me.state(State)
  setattr(state, e.key, e.value)


def on_update_selection(e: me.SelectSelectionChangeEvent):
  """Generic event to update input values."""
  state = me.state(State)
  setattr(state, e.key, e.value)