Skip to content
Snippets Groups Projects
Commit ddfef394 authored by Vanessa Stehr's avatar Vanessa Stehr
Browse files

Add output elements

parent f0843df8
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,10 @@ import json
import tarfile
import warnings
import bokehCssPTB
from bokeh.plotting import curdoc
from dsiParser import dsiParser
from bokeh.plotting import curdoc,figure
from bokeh.layouts import column, row
from bokeh.models import FileInput, Div, CustomJS, Button, TabPanel, Tabs, Dropdown, TextInput, Button
from bokeh.models import FileInput, Div, CustomJS, Button, TabPanel, Tabs, Dropdown, TextInput, Button, MathText, Label
from bokeh.events import ValueSubmit
VERSION = "0.1.0"
......@@ -26,7 +27,52 @@ class page():
curdoc().add_root(self.inputRow)
self.results = column(children = [])
curdoc().add_root(self.results)
def parseInput(self):
print(self.dsiInput.value)
self.results.children = []
input = self.dsiInput.value
p = dsiParser()
resultTree = p.parse(input)
parsingMessages = []
if resultTree.valid:
parsingMessages.append(
Div(
text = "DSI string parsed without warnings",
css_classes = ["msg-positive"],
)
)
else:
for message in resultTree.warnings:
parsingMessages.append(
Div(
text = message,
css_classes = ["msg-negative"]
)
)
self.resultErrors = column(children = parsingMessages)
# latexOutput = TextInput(value=resultTree.toLatex(), title="DSI unit string:")
# latexOutput.js_on_change()
latexOutput = row(children=[
Div(text = "$$\mathrm{\LaTeX{}}$$ code:"),
Div(text = "<pre><code>"+resultTree.toLatex()+"</code></pre>", disable_math=True)
])
p = figure(width=500, height=100, x_range=(0, 1), y_range=(0, 1), tools="save")
p.xaxis.visible = False
p.yaxis.visible = False
p.grid.visible = False
p.add_layout(Label(
x=0.5, y=0.5, text=resultTree.toLatex(), text_font_size="12px", text_baseline="middle", text_align="center",
))
imageOutput = row(children = [
Div(text = "$$\mathrm{\LaTeX{}}$$ output:"),
p
])
self.results.children = [self.resultErrors, latexOutput, imageOutput]
thisPage = page()
bokeh~=3.3.2
-e git+https://dockerPull:-jVp9LBaxeKp9HKAe9dw@gitlab1.ptb.de/digitaldynamicmeasurement/bokehCssPtb.git#egg=bokehCssPTB
\ No newline at end of file
-e git+https://dockerPull:-jVp9LBaxeKp9HKAe9dw@gitlab1.ptb.de/digitaldynamicmeasurement/bokehCssPtb.git#egg=bokehCssPTB
-e git+https://dockerPull:x3S7APs-7WMgN6xiyM2T@gitlab1.ptb.de/Seeger/python_dsi_latex_converter.git@release#egg=dsiParser
\ No newline at end of file
......@@ -50,7 +50,7 @@
<div class="container">
<div>Contact: <a href="mailto:vanessa.stehr@ptb.de">vanessa.stehr@ptb.de</a></div>
<div>Version: {{ VERSION }}</div>
<div><a href="">this project on Gitlab</a></div>
<div><a href="https://gitlab1.ptb.de/digitaldynamicmeasurement/dsi-parser-frontend">this project on Gitlab</a></div>
<div><a href="https://gitlab1.ptb.de/digitaldynamicmeasurement/python_dsi_latex_converter">this functionality as a python library</a></div>
</div>
</footer>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment