changed colors of few elements and a bit of additional logic for colors.
This commit is contained in:
parent
d25a708314
commit
7127194c4d
|
@ -19,3 +19,5 @@
|
||||||
@gray: #aaa;
|
@gray: #aaa;
|
||||||
@black: #111;
|
@black: #111;
|
||||||
|
|
||||||
|
// added a few for this usecase
|
||||||
|
@darkred: #860a03;
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#headword {
|
#headword {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
color: @red;
|
color: @darkred;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
|
|
||||||
.translation-text {
|
.translation-text {
|
||||||
display: inline;
|
display: inline;
|
||||||
color: @maroon;
|
color: @blue;
|
||||||
.translation-element-margin();
|
.translation-element-margin();
|
||||||
}
|
}
|
||||||
.translation-source {
|
.translation-source {
|
||||||
|
@ -174,6 +174,17 @@
|
||||||
|
|
||||||
.example-text {
|
.example-text {
|
||||||
._hoverable();
|
._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 {
|
.example-cluster, .example-logdice, .example-frequency {
|
||||||
|
|
|
@ -66,6 +66,15 @@ class Example(Editable):
|
||||||
def is_collocation(self):
|
def is_collocation(self):
|
||||||
return type(self.inner) is CorpusExample
|
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:
|
class CorpusExample:
|
||||||
def __init__(self, example_xml):
|
def __init__(self, example_xml):
|
||||||
|
@ -90,7 +99,7 @@ class CorpusExample:
|
||||||
class MultiwordExample:
|
class MultiwordExample:
|
||||||
def __init__(self, example_xml):
|
def __init__(self, example_xml):
|
||||||
self.other_attributes = {}
|
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):
|
if example_xml.hasAttribute(oth_attr):
|
||||||
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
|
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
|
||||||
|
|
||||||
|
@ -100,6 +109,11 @@ class MultiwordExample:
|
||||||
self.cluster_valid = True
|
self.cluster_valid = True
|
||||||
self.cluster = int(example_xml.getAttribute("cluster"))
|
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):
|
def export(self, doc):
|
||||||
result = doc.createElement("multiwordExample")
|
result = doc.createElement("multiwordExample")
|
||||||
|
|
||||||
|
@ -109,6 +123,9 @@ class MultiwordExample:
|
||||||
if self.cluster_valid:
|
if self.cluster_valid:
|
||||||
result.setAttribute("cluster", str(self.cluster))
|
result.setAttribute("cluster", str(self.cluster))
|
||||||
|
|
||||||
|
if self.type is not None:
|
||||||
|
result.setAttribute("type", self.type)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_cluster(self):
|
def get_cluster(self):
|
||||||
|
|
|
@ -133,7 +133,8 @@ class View:
|
||||||
if cluster is not None:
|
if cluster is not None:
|
||||||
example_content.append(h("span.example-cluster", {}, str(cluster)))
|
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:
|
if "frequency" in example.other_attributes:
|
||||||
example_content.append(h("span.example-frequency", {}, example.other_attributes["frequency"]))
|
example_content.append(h("span.example-frequency", {}, example.other_attributes["frequency"]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user