cluster edit is now data change. Also ordering of clusters

This commit is contained in:
Ozbolt Menegatti 2020-02-16 17:46:55 +01:00
parent 446e16d629
commit b20ceca27a
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
from message.message import Message from message.message import Message
from message.simple_messages import NoReset from message.simple_messages import NoReset, DataChgClickMessage
import message.common_accessors as common_accessors import message.common_accessors as common_accessors
from browser import document from browser import document
from model import Sense, Example from model import Sense, Example
@ -100,14 +100,14 @@ class EditEntryLabels(Message):
model.entry.labels = labels model.entry.labels = labels
class ExampleClusterEdit(NoReset): class ExampleClusterEdit(DataChgClickMessage):
def update_model(self, model): def update_model(self, model):
example = self.get_arg(0, Example) example = self.get_arg(0, Example)
cluster = self.get_arg(1, int) cluster = self.get_arg(1, int)
example.set_cluster(cluster) example.set_cluster(cluster)
class ExampleClusterAdd(NoReset): class ExampleClusterAdd(DataChgClickMessage):
def update_model(self, model): def update_model(self, model):
example = self.get_arg(0, Example) example = self.get_arg(0, Example)

View File

@ -40,7 +40,7 @@ class ExampleClusters:
self.lists[key].add(cluster) self.lists[key].add(cluster)
for key in self.lists.keys(): for key in self.lists.keys():
self.lists[key] = sorted(self.lists[key], key=lambda x: x) self.lists[key] = sorted(self.lists[key], key=lambda x: int(x))
def _get_list(self, sense, example): def _get_list(self, sense, example):
key = ExampleClusters.get_key(sense, example) key = ExampleClusters.get_key(sense, example)