[wmlunits] Add warnings about missing images to log.
This commit is contained in:
parent
2596fee255
commit
1a45e8f61e
4 changed files with 27 additions and 8 deletions
|
@ -81,9 +81,11 @@ class ImageCollector:
|
|||
return image
|
||||
|
||||
def make_name(x):
|
||||
x = x.strip("./ ")
|
||||
if x.startswith(options.config_dir): x = x[len(options.config_dir):]
|
||||
if x.startswith("data/core/"): x = x[len("data/core/"):]
|
||||
if x.startswith("images/"): x = x[len("images/"):]
|
||||
if x.startswith(options.data_dir): x = x[len(options.data_dir):]
|
||||
x = x.strip("./ ")
|
||||
if x.startswith("data"): x = x[len("data"):]
|
||||
x = x.strip("./ ")
|
||||
y = ""
|
||||
for c in x:
|
||||
|
|
|
@ -490,7 +490,11 @@ class HTMLOutput:
|
|||
"Warning: Missing image for unit %s(%s).\n" % (
|
||||
u.get_text_val("id"), x.name))
|
||||
return None, None
|
||||
picname = image_collector.add_image(self.addon, image)
|
||||
icpic = image_collector.add_image_check(self.addon, image)
|
||||
if not icpic.ipath:
|
||||
error_message("Warning: No picture %s for unit %s.\n" %
|
||||
(image, u.get_text_val("id")))
|
||||
picname = icpic.id_name
|
||||
image = os.path.join(pics_location, picname)
|
||||
if portrait:
|
||||
picname = image_collector.add_image(self.addon, portrait,
|
||||
|
|
|
@ -38,6 +38,12 @@ def write_addon_overview(folder, addon):
|
|||
w('<li><a href="' + cpath + '">' + campaign["name"] + '</a></li>')
|
||||
w("</ul>")
|
||||
|
||||
w("<div>")
|
||||
if os.path.exists(os.path.join(folder, "error.log")):
|
||||
w('<p><b>Warnings or errors were found: <a href="error.html"/>log</a></b></p>')
|
||||
w('<p><a href="../overview.html">back to overview</a></p>')
|
||||
w("</div>")
|
||||
|
||||
w('</div> <!-- overview -->')
|
||||
|
||||
w(html_output.html_footer % locals())
|
||||
|
@ -68,6 +74,7 @@ def main(folder):
|
|||
count = 0
|
||||
total_n = 0
|
||||
total_error_logs = 0
|
||||
total_lines = 0
|
||||
for f in sorted(glob.glob(os.path.join(folder, "*"))):
|
||||
if not os.path.isdir(f): continue
|
||||
if f.endswith("/pics"): continue
|
||||
|
@ -134,6 +141,7 @@ def main(folder):
|
|||
|
||||
htmlerr = open(error_html, "w")
|
||||
htmlerr.write("<html><body>")
|
||||
lines_count = 0
|
||||
for line in text.splitlines():
|
||||
line = line.strip()
|
||||
if line in ["<INTERNAL ERROR>", "<WML ERROR>", "<PARSE ERROR>"]:
|
||||
|
@ -141,11 +149,15 @@ def main(folder):
|
|||
elif line in ["</INTERNAL ERROR>", "</WML ERROR>", "</PARSE ERROR>"]:
|
||||
htmlerr.write("</p>")
|
||||
else:
|
||||
htmlerr.write(postprocess(line))
|
||||
err_html = postprocess(line)
|
||||
lines_count += err_html.count("<br")
|
||||
htmlerr.write(err_html)
|
||||
htmlerr.write("</body></html>")
|
||||
|
||||
total_lines += lines_count
|
||||
|
||||
total_error_logs += 1
|
||||
w('<a class="error" href="%s">%s</a>' % (error_name, error_kind))
|
||||
w('<a class="error" href="%s">%s (%d lines)</a>' % (error_name, error_kind, lines_count))
|
||||
w("</td></tr>")
|
||||
|
||||
count += 1
|
||||
|
@ -155,7 +167,7 @@ def main(folder):
|
|||
w("</td><td>")
|
||||
w(str(total_n))
|
||||
w("</td><td>")
|
||||
w(str(total_error_logs))
|
||||
w(str(total_error_logs) + " (" + str(total_lines) + " lines)")
|
||||
w("</td></tr>")
|
||||
|
||||
w("</table>")
|
||||
|
|
|
@ -299,7 +299,6 @@ div.unit-column-right {
|
|||
}
|
||||
|
||||
table.overview {
|
||||
margin: 1em;
|
||||
border-spacing: 0px;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
|
@ -325,10 +324,12 @@ table.overview a.error {
|
|||
div.overview {
|
||||
margin: 0 auto;
|
||||
background-color: #E7D9C0;
|
||||
max-width: 66em;
|
||||
max-width: 60em;
|
||||
width: auto;
|
||||
border-radius: 1em 1em 1em 1em;
|
||||
border: solid 1px white;
|
||||
font-style: sans-serif;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
div.portrait {
|
||||
|
|
Loading…
Add table
Reference in a new issue