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.
68 lines
2.5 KiB
68 lines
2.5 KiB
import basic.program
|
|
CSS_CLASS = {
|
|
"general": {
|
|
"table, td, th": "border: 1px solid grey;font-family:sans-serif"
|
|
},
|
|
"diffFiles": {
|
|
"novalue": "color:grey",
|
|
"diffA": "color:green;font-weight:bold;",
|
|
"diffB": "color:crimson;font-weight:bold;",
|
|
"acceptA": "color:darkblue;",
|
|
"acceptB": "color:darkmagenta;"
|
|
},
|
|
"resultFile": {
|
|
"result0": "background-color:white;",
|
|
"result1": "background-color:lightgreen;",
|
|
"result2": "background-color:yellow;",
|
|
"result3": "background-color:tomato;",
|
|
"result4": "background-color:tomato;"
|
|
}
|
|
}
|
|
|
|
def getInlineStyle(job, filetype, cssclass):
|
|
#job = basic.program.Job.getInstance()
|
|
verify = int(job.getDebugLevel("css_tool")) - 1
|
|
# job.debug(verify, "getDiffHeader ")
|
|
if job.conf.confs.get("tools").get("csstyp") == "inline":
|
|
out = "style=\""+CSS_CLASS[filetype][cssclass]+"\""
|
|
else:
|
|
out = "class=\"" + cssclass + "\""
|
|
return out
|
|
|
|
def getInternalStyle(job, filetype):
|
|
#job = basic.program.Job.getInstance()
|
|
verify = int(job.getDebugLevel("match_tool")) - 1
|
|
out = ""
|
|
if job.conf.confs.get("tools").get("csstyp") == "internal":
|
|
out = "<style>"
|
|
for c in CSS_CLASS["general"]:
|
|
line = "\n"+c+" { "+CSS_CLASS["general"][c]+"} "
|
|
line.replace(":", ": ").replace(";", "; ").replace("_Q_", ", ")
|
|
out += line
|
|
arr = filetype.split(",")
|
|
for a in arr:
|
|
for c in CSS_CLASS[a]:
|
|
out += "\n."+c+" { "+CSS_CLASS[a][c].replace(":", ": ").replace(";", "; ")+"} "
|
|
out += "\n</style>"
|
|
elif job.conf.confs.get("tools").get("csstyp") == "external":
|
|
out = " <link rel=\"stylesheet\" href=\""+job.conf.confs.get("tools").get("cssfile")+"\"> "
|
|
else:
|
|
out = "<style>"
|
|
for c in CSS_CLASS["general"]:
|
|
line = "\n "+c+" { "+CSS_CLASS["general"][c]+" } "
|
|
line.replace(":", ": ").replace(";", "; ").replace("_Q_", ", ")
|
|
out += line
|
|
out += " \n </style>"
|
|
return out
|
|
|
|
def getExternalStyle(job, filetype):
|
|
#job = basic.program.Job.getInstance()
|
|
verify = int(job.getDebugLevel("match_tool")) - 1
|
|
out = ""
|
|
if job.conf.confs.get("tools").get("csstyp") == "external":
|
|
arr = filetype.split(",")
|
|
for a in arr:
|
|
for c in CSS_CLASS[a]:
|
|
out += c+" {\n "+CSS_CLASS[a][c].replace(":", ": ").replace(";", ";\n ")+"}\n"
|
|
out.replace("\n \n}", "\n}")
|
|
return out
|
|
|