lexonomy_custom_editor/src/message/simple_messages.py
Ozbolt Menegatti d8291a15cf refactoring view, now combining modals and view into one module.
Also common modal components can now be nicely separated and reused
2019-11-16 14:41:29 +01:00

29 lines
780 B
Python

from message.message import Message, ClickMessage, msg
from browser import window
class Reset(ClickMessage):
def update_model(self, model):
pass
class NoReset(Reset):
def reset(self):
return False
# a "hack" message for reseting modals #
# everytime a modal closes, run 100ms later model.modal = []
# this is done to achieve nice close animation
# after setting model.modal, do view update to actually update the DOM
class _ModalResetDelayed(Message):
def update_model(self, model):
model.modal_reset()
class ModalNotOkClose(Reset):
def update_model(self, model):
# msg just creates a callback, need to actually run it!
window.setTimeout(lambda: msg(_ModalResetDelayed)(None), 100)