|
|
@ -2,6 +2,11 @@ from lib.snabbdom import h
|
|
|
|
import message
|
|
|
|
import message
|
|
|
|
from view.modal_templates import *
|
|
|
|
from view.modal_templates import *
|
|
|
|
from view.utils import show_toggle_cluster_buttons
|
|
|
|
from view.utils import show_toggle_cluster_buttons
|
|
|
|
|
|
|
|
from export import export_to_xml, export_example_to_entry_xml
|
|
|
|
|
|
|
|
from update import update
|
|
|
|
|
|
|
|
from model.entry import Entry
|
|
|
|
|
|
|
|
import lib.screenful as screenful
|
|
|
|
|
|
|
|
from model.model import Model
|
|
|
|
import model
|
|
|
|
import model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,7 +132,37 @@ def edit_comment(comment):
|
|
|
|
return modal_template(big_question("Edit comment", comment), "Comment", (message.EditComment,), (message.DeleteComment,))
|
|
|
|
return modal_template(big_question("Edit comment", comment), "Comment", (message.EditComment,), (message.DeleteComment,))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def do_chosen_examples(example_list, entry):
|
|
|
|
def do_chosen_examples(example_list, model, multiword_example):
|
|
|
|
|
|
|
|
if multiword_example is False:
|
|
|
|
|
|
|
|
return move_examples_to_sense(example_list, model.entry)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return modal_template([
|
|
|
|
|
|
|
|
h("button.shyButton", {"on": {"click": (lambda: move_to_view(example_list, model))}}, "Premakni v pomen"),
|
|
|
|
|
|
|
|
h("button.shyButton", {"on": {"click": (lambda: export_to_new_entry())}},
|
|
|
|
|
|
|
|
"Izvozi v novo geslo")], "Izberite željeno akcijo", None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def move_to_view(example_list, model):
|
|
|
|
|
|
|
|
model.modal_reset()
|
|
|
|
|
|
|
|
model.modal_set(lambda: move_examples_to_sense(example_list, model.entry))
|
|
|
|
|
|
|
|
update.view.view(model, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def export_to_new_entry(multiword_example, example_list):
|
|
|
|
|
|
|
|
other_examples = []
|
|
|
|
|
|
|
|
for example in example_list:
|
|
|
|
|
|
|
|
if example.is_multiword() is False:
|
|
|
|
|
|
|
|
other_examples.append(example)
|
|
|
|
|
|
|
|
entry_xml = export_example_to_entry_xml(multiword_example, other_examples if len(example_list) > 0 else None)
|
|
|
|
|
|
|
|
new_entry = Entry()
|
|
|
|
|
|
|
|
new_entry.import_xml(entry_xml)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new_model = Model()
|
|
|
|
|
|
|
|
new_model.entry = new_entry
|
|
|
|
|
|
|
|
screenful.screenful().Editor['new'](None, export_to_xml(new_model))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def move_examples_to_sense(example_list, entry):
|
|
|
|
example_senses = []
|
|
|
|
example_senses = []
|
|
|
|
for idx, sense in enumerate(entry.senses):
|
|
|
|
for idx, sense in enumerate(entry.senses):
|
|
|
|
for ex in sense.examples:
|
|
|
|
for ex in sense.examples:
|
|
|
@ -150,7 +185,7 @@ def do_chosen_examples(example_list, entry):
|
|
|
|
options.append(h("label.checkable", {"attrs": {"for": id_}}, text))
|
|
|
|
options.append(h("label.checkable", {"attrs": {"for": id_}}, text))
|
|
|
|
options.append(h("br", {}, []))
|
|
|
|
options.append(h("br", {}, []))
|
|
|
|
|
|
|
|
|
|
|
|
return modal_template(options, "Examples picker", (message.DoChosenExamples, example_list))
|
|
|
|
return modal_template(options, "Examples picker", (message.MoveExamplesToSense, example_list))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ske_list(search_term, data, page_num, senses, ske_kinds):
|
|
|
|
def ske_list(search_term, data, page_num, senses, ske_kinds):
|
|
|
|