Commit d49c37c3 authored by P Marbaix's avatar P Marbaix
Browse files

Further work on details + adaptation to Python 3.9.

I got annoying problems with xlrd, so this will be the last commit with a code using xlrd. It seems to work, but only to due to a workaround in embermaker.helpers as explained here
parent 92adc32d
Pipeline #369132 failed with stages
in 55 seconds
......@@ -13,7 +13,7 @@
<excludeFolder url="file://$MODULE_DIR$/local" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
<orderEntry type="jdk" jdkName="Python 3.7 (EmberFactory)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.9 (EmberFactory)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<component name="PackageRequirementsSettings">
......@@ -3,7 +3,7 @@
<component name="ProjectPlainTextFileTypeManager">
<file url="file://$PROJECT_DIR$/setup.cfg" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (EmberFactory)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (EmberFactory)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
......@@ -7,8 +7,11 @@ from reportlab.lib.styles import getSampleStyleSheet
import defusedxml
from defusedxml.common import EntitiesForbidden
import zipfile
from xlrd import open_workbook
from pdf2image import convert_from_path
import xlrd3
#xlrd3.xlsx.ensure_elementtree_imported(False, None)
xlrd3.xlsx.Element_has_iter = True
This module contains several types of "helper functions" :
......@@ -156,8 +159,9 @@ def secure_open_workbook(file, maxsize=2E6):
# Protect against XML bombs
return open_workbook(file)
return xlrd3.open_workbook(file)
except EntitiesForbidden:
raise ValueError('Excel file appears invalid')
......@@ -287,3 +291,8 @@ def drawparagraph(canvas, xx, yy, text, length=10*cm, align='left', font=("Helve
par.wrap(length, 10 * cm)
par.drawOn(canvas, xx, yy)
logging.warning("Drawparagraph is only a stub")
def getimage(path):
image = convert_from_path(path)
return image
\ No newline at end of file
......@@ -82,6 +82,8 @@ def result():
critical = hlp.getlog("critical")
if len(critical) > 0:
message["error"] = critical
#outimage = hlp.getimage(outfile)
#message["outfile"] = outimage
# No file was generated: a fatal error occurred:
......@@ -11,7 +11,7 @@ your diagram, continue to section 2 about the layout parameters. Those parameter
sorting embers from your data before plotting, or adding some types of information on the diagram.
For more details about the parameters, see [Parameters](parameters).
# 1. Basic format
# Basic format
We expect the Basic format to fill most needs (at least with the inclusion of the optional spreadsheet
described in section 2 below). It is simple and may receive more development efforts to accommodate
......@@ -66,7 +66,7 @@ The most common ones are the following:
None of these parameters is mandatory: there are default values, for more information on the
metadata and other parameters, see [Parameters](parameters).
# 2. Basic format + layout parameters sheet
# Basic format + layout parameters sheet
The "Basic format" (above) is limited to a few parameters which are sufficient to reproduce most types
or 'burning ember' figures published so far, but with limitations regarding layout details.
......@@ -108,7 +108,7 @@ There are other options illustrated in this Excel file, such as the possibility
This makes it possible to generate different diagrams without changing the 'data' sheet, by list ember names
in the desired order. See [Parameters](parameters) for more information.
# 3. Fullflex format
# Fullflex format
[Fullflex format example](examples/Flex-fmt-RFC.xlsx)
......@@ -5,6 +5,7 @@ body {
font-size: 13px;
margin:15px 0px 0px 0px;
line-height: 1.3em;
counter-reset: h1counter;
/* For more development about fonts, consider reading */
......@@ -82,6 +83,12 @@ p{
margin-bottom: 9px;
h1:not(.nondoc):before {
content: counter(h1counter) ".\0000a0";
counter-increment: h1counter;
h1 {
font-size: 1.3em;
color: #9D2747;
......@@ -2,7 +2,7 @@
{% extends 'base.html' %}
{% block topmessage %}
<h1> An error occurred !</h1>
<h1 class="nondoc"> An error occurred !</h1>
{% endblock %}
{% block content %}
......@@ -10,7 +10,7 @@
carefully tested. However, this is not a product of the IPCC (which is
not responsible for projects or researches).
<h1>Development history</h1>
<h1 class="nondoc">Development history</h1>
Although the web application and layout details were improved over time, there is no change affecting the translation
of the risk levels provided as input to colours in the burning embers. The changes are recorded on
{% set active_page = "index" %}
{% extends 'base.html' %}
{% block content %}
<h1 class="nondoc">Introduction</h1>
<a href="{{ url_for('.examples_fil', filename='Basic-fmt-SRCCL.xlsx')}}" class="btn btn-right">
<svg class="btn-icon" aria-hidden="true">
......@@ -25,7 +25,7 @@
Feedback is welcome, including on what you would like to have as input format, layout or other issues that you may
experience, or missing features.
<h1>Ember graph production</h1>
<h1 class="nondoc">Ember graph production</h1>
<form enctype="multipart/form-data" id="fileUpload" action="{{ url_for('control.result')}}" method="post">
<fieldset class="innerframe">
<p style="margin-top:0">To start, upload your data here (first select the file, then upload and process):</p>
......@@ -5,4 +5,5 @@ setuptools>=46.4.0
\ No newline at end of file
\ No newline at end of file
......@@ -7,4 +7,4 @@ def getversion():
return line.split("'")[1]
return None
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment