You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lexonomy_custom_editor/src/model/model.py

53 lines
1.3 KiB

from model.entry import Entry
from browser import window
class Model:
def __init__(self, names):
# main data stuff
self.entry = None
# report everything that happens!
self.log = []
#runtime info
self.menu_location = (0, 0)
self.menu_target = None
# modal handling
self.modal = lambda: []
self.modal_shown = False
# currently edited stuff
self.translation = None
self.sense = None
# choosing examples
self.chosen_examples = []
self.reset()
self.modal_reset()
def reset(self):
# do both resets at once
self.pre_reset()
self.post_reset()
def pre_reset(self):
# the reset before updating models
self.menu_target = None
self.modal_shown = False
def post_reset(self):
# the reset after updating the models
self.chosen_examples = []
def modal_reset(self):
self.modal = lambda: []
def import_xml(self, xml_text):
parser = __new__(DOMParser())
xmlDoc = parser.parseFromString(xml_text, "text/xml")
self.entry = Entry(xmlDoc.querySelector("entry"))