__init__.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. from ._anvil_designer import Form1Template
  2. from anvil import *
  3. import anvil.server
  4. import anvil.tables as tables
  5. import anvil.tables.query as q
  6. from anvil.tables import app_tables
  7. class Form1(Form1Template):
  8. def __init__(self, **properties):
  9. # Set Form properties and Data Bindings.
  10. self.init_components(**properties)
  11. # Any code you write here will run when the form opens.
  12. def check_yaml_click(self, **event_args):
  13. """This method is called when the button is clicked"""
  14. status, parsed_data = anvil.server.call('parse_yaml',self.input.text)
  15. if status==1:
  16. self.output.foreground = 'red'
  17. else:
  18. self.output.foreground = 'blue'
  19. self.output.text = parsed_data
  20. def check_json_click(self, **event_args):
  21. """This method is called when the button is clicked"""
  22. status, parsed_data = anvil.server.call('parse_json',self.input.text)
  23. if status==1:
  24. self.output.foreground = 'red'
  25. else:
  26. self.output.foreground = 'blue'
  27. self.output.text = parsed_data