changed colors of few elements and a bit of additional logic for colors.

This commit is contained in:
Ozbolt Menegatti 2020-01-26 17:46:12 +01:00
parent d25a708314
commit 7127194c4d
4 changed files with 35 additions and 4 deletions

View File

@ -19,3 +19,5 @@
@gray: #aaa;
@black: #111;
// added a few for this usecase
@darkred: #860a03;

View File

@ -43,7 +43,7 @@
#headword {
font-size: 1.2em;
color: @red;
color: @darkred;
font-weight: bold;
}
@ -126,7 +126,7 @@
.translation-text {
display: inline;
color: @maroon;
color: @blue;
.translation-element-margin();
}
.translation-source {
@ -174,6 +174,17 @@
.example-text {
._hoverable();
.example-text-1 {
color: @black;
}
.example-text-2 {
color: @red;
}
.example-text-3 {
color: @red;
font-weight: bold;
}
}
.example-cluster, .example-logdice, .example-frequency {

View File

@ -66,6 +66,15 @@ class Example(Editable):
def is_collocation(self):
return type(self.inner) is CorpusExample
def get_view_type(self):
# as per the bosses, these are the rules for different colors
if type(self.inner) is CorpusExample:
return 1
elif self.inner.type == "collocation":
return 2
else:
return 3
class CorpusExample:
def __init__(self, example_xml):
@ -90,7 +99,7 @@ class CorpusExample:
class MultiwordExample:
def __init__(self, example_xml):
self.other_attributes = {}
for oth_attr in ["type", "lexical_unit_id", "structure_id", "structureName", "audio", "frequency", "logDice"]:
for oth_attr in ["lexical_unit_id", "structure_id", "structureName", "audio", "frequency", "logDice"]:
if example_xml.hasAttribute(oth_attr):
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
@ -99,6 +108,11 @@ class MultiwordExample:
if example_xml.hasAttribute("cluster"):
self.cluster_valid = True
self.cluster = int(example_xml.getAttribute("cluster"))
if example_xml.hasAttribute("type"):
self.type = example_xml.getAttribute(oth_attr)
else:
self.type = None
def export(self, doc):
result = doc.createElement("multiwordExample")
@ -109,6 +123,9 @@ class MultiwordExample:
if self.cluster_valid:
result.setAttribute("cluster", str(self.cluster))
if self.type is not None:
result.setAttribute("type", self.type)
return result
def get_cluster(self):

View File

@ -133,7 +133,8 @@ class View:
if cluster is not None:
example_content.append(h("span.example-cluster", {}, str(cluster)))
example_content.append(h("span.example-text-inner", {}, example.text()))
example_text_inner_tag = "span.example-text-{}".format(example.get_view_type())
example_content.append(h(example_text_inner_tag, {}, example.text()))
if "frequency" in example.other_attributes:
example_content.append(h("span.example-frequency", {}, example.other_attributes["frequency"]))