Skip to content

Commit

Permalink
Merge pull request #168 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Bugfix: Error when clicking "Cancel" on some dialogs
  • Loading branch information
seamm committed May 26, 2024
2 parents 72b97f8 + 2ce9e6b commit 3905edd
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
2024.5.26 -- Bugfix: Error when clicking "Cancel" on some dialogs
* Dialogs that have a Results tab -- mainly the computational engines -- raised an
error if the "Cancel" button was clicked. "OK" worked. This fixes the problem.

2024.5.3.1 -- Bugfix: JSON in Results GUI not set correctly.

2024.5.3 -- Added the time to Results.json
Expand Down
100 changes: 100 additions & 0 deletions seamm/templates/surface.graph_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"data": [
{%- for trace in traces %}
{
"contours": {
"z": {
"show": true,
"usecolormap": true,
"highlightcolor" : "#42f462",
"project": {
"z": true
}
}
},
"hoverlabel": {
"namelength": 0
},
{%- if 'hovertemplate' in trace %}
"hovertemplate": "{{ trace.hovertemplate }}",
{%- else %}
"hovertemplate": "{{ trace.xlabel }}=%{x} {{ trace.xunits }}<br>{{ trace.ylabel }}=%{y} {{ trace.yunits }}",
{%- endif %}
"legendgroup": "",
"mode": "lines",
{%- if 'showlegend' in trace %}
"showlegend": {{ trace.showlegend }},
{%- endif %}
"line": {
"color": "{{ trace.color|default('#4dbd74') }}",
"dash": "{{ trace.dash|default('solid') }}",
"width": "{{ trace.width|default('1') }}"
},
{%- if 'fill' in trace %}
"fill": "{{ trace.fill }}",
{%- endif %}
{%- if 'fillcolor' in trace %}
"fillcolor": "{{ trace.color|default('lightgray') }}",
{%- endif %}
"name": "{{ trace.name }}",
"type": "surface",
{%- if 'visible' in trace %}
"visible": "{{ trace.visible }}",
{%- endif %}
{%- if 'x' in trace %}
"x": {{ trace.x|jsonify }},
{%- else %}
"x0": {{ trace.x0 }},
"dx": {{ trace.dx }},
{%- endif %}
"xaxis": "{{ trace.xaxis }}",
{%- if 'y' in trace %}
"y": {{ trace.y|jsonify }},
{%- else %}
"y0": {{ trace.y0 }},
"dy": {{ trace.dy }},
{%- endif %}
"yaxis": "{{ trace.yaxis }}",
"z": {{ trace.z|jsonify }},
"zaxis": "{{ trace.zaxis }}"
{%- if loop.last %}
}
{%- else %}
},
{%- endif %}
{%- endfor %}
],
"layout": {
"hovermode": "x",
"legend": {
"title": "",
"tracegroupgap": 0
},
"title": {
"x": 0.5,
"text": "{{ title }}",
"xanchor": "center"
},
"scene": {
{%- for axis in axes %}
"{{ axis.name[:-1] }}": {
"domain": [
{{ axis.start }},
{{ axis.stop }}
],
{%- if 'range' in axis %}
"range": {{ axis.range|jsonify }},
{%- endif %}
"title": {
"text": "{{ axis.label }}"
}
{%- if loop.last %}
}
{%- else %}
},
{%- endif %}
{%- endfor %}
}
}
}

118 changes: 118 additions & 0 deletions seamm/templates/surface.html_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<html>
<head><meta charset="utf-8" /></head>
<body>
<div>
<script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id="b4d1ccf6-a731-4cfc-95dd-479f770eaa06" class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script type="text/javascript">

window.PLOTLYENV=window.PLOTLYENV || {};

if (document.getElementById("b4d1ccf6-a731-4cfc-95dd-479f770eaa06")) {
Plotly.newPlot(
'b4d1ccf6-a731-4cfc-95dd-479f770eaa06',
[
{%- for trace in traces %}
{
"contours": {
"z": {
"show": true,
"usecolormap": true,
"highlightcolor" : "#42f462",
"project": {
"z": true
}
}
},
"hoverlabel": {
"namelength": 0
},
{%- if 'hovertemplate' in trace %}
"hovertemplate": "{{ trace.hovertemplate }}",
{%- else %}
"hovertemplate": "{{ trace.xlabel }}=%{x} {{ trace.xunits }}<br>{{ trace.ylabel }}=%{y} {{ trace.yunits }}",
{%- endif %}
"legendgroup": "",
"mode": "lines",
{%- if 'showlegend' in trace %}
"showlegend": {{ trace.showlegend }},
{%- endif %}
"line": {
"color": "{{ trace.color|default('#4dbd74') }}",
"dash": "{{ trace.dash|default('solid') }}",
"width": "{{ trace.width|default('1') }}"
},
{%- if 'fill' in trace %}
"fill": "{{ trace.fill }}",
{%- endif %}
{%- if 'fillcolor' in trace %}
"fillcolor": "{{ trace.color|default('lightgray') }}",
{%- endif %}
"name": "{{ trace.name }}",
"type": "surface",
{%- if 'visible' in trace %}
"visible": "{{ trace.visible }}",
{%- endif %}
{%- if 'x' in trace %}
"x": {{ trace.x|jsonify }},
{%- else %}
"x0": {{ trace.x0 }},
"dx": {{ trace.dx }},
{%- endif %}
"xaxis": "{{ trace.xaxis }}",
{%- if 'y' in trace %}
"y": {{ trace.y|jsonify }},
{%- else %}
"y0": {{ trace.y0 }},
"dy": {{ trace.dy }},
{%- endif %}
"yaxis": "{{ trace.yaxis }}",
"z": {{ trace.z|jsonify }},
"zaxis": "{{ trace.zaxis }}"
{%- if loop.last %}
}
{%- else %}
},
{%- endif %}
{%- endfor %}
],
{
"hovermode": "x",
"legend": {
"title": "",
"tracegroupgap": 0
},
"title": {
"x": 0.5,
"text": "{{ title }}",
"xanchor": "center"
},
"scene": {
{%- for axis in axes %}
"{{ axis.name[:-1] }}": {
"domain": [
{{ axis.start }},
{{ axis.stop }}
],
{%- if 'range' in axis %}
"range": {{ axis.range|jsonify }},
{%- endif %}
"title": {
"text": "{{ axis.label }}"
}
{%- if loop.last %}
}
{%- else %}
},
{%- endif %}
{%- endfor %}
}
}
)
};
</script>
</div>
</body>
</html>

4 changes: 2 additions & 2 deletions seamm/tk_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,9 @@ def handle_dialog(self, result):

if w_json is not None:
if "json" in tmp:
self.tk_var["json " + key]["value"].set(1)
self.tk_var["json " + key].set(1)
else:
self.tk_var["json " + key]["value"].set(0)
self.tk_var["json " + key].set(0)

if w_units is not None:
if "units" in tmp:
Expand Down

0 comments on commit 3905edd

Please sign in to comment.