Skip to content
Snippets Groups Projects
Commit c1ba6f13 authored by Benedikt's avatar Benedikt
Browse files

added second unit filds and compare option

parent 03ddfdae
No related branches found
No related tags found
No related merge requests found
......@@ -13,11 +13,10 @@ ENV no_proxy="ptb.de"
# Install any needed packages specified in requirements.txt
RUN git clone https://dockerPull:Fu7bxBnYeyhq8Xz8seHS@gitlab1.ptb.de/digitaldynamicmeasurement/dsi-parser-frontend
RUN pip install --proxy=webproxy.bs.ptb.de:8080 --no-cache-dir -r dsi-parser-frontend/requirements.txt
#RUN pip install --proxy=webproxy.bs.ptb.de:8080 --no-cache-dir -r dsi-parser-frontend/requirements.txt
# RUN pip install --no-cache-dir -r dsi-parser-frontend/requirements.txt
#COPY . .
RUN pip install --no-cache-dir -r dsi-parser-frontend/requirements.txt
EXPOSE 5020
#WORKDIR ./pydccdisplayer/src
CMD ["bokeh", "serve", "dsi-parser-frontend/", "--port", "5020", "--allow-websocket-origin", "*","--use-xheaders","--prefix","dsi-parser-frontend"]
......@@ -11,30 +11,23 @@ from bokeh.models import FileInput, Div, CustomJS, Button, TabPanel, Tabs, Dropd
from bokeh.events import ValueSubmit
VERSION = "0.1.0"
class dsiparserInput():
class page():
def __init__(self):
curdoc().template_variables["VERSION"] = VERSION
curdoc().title = "DSI to Latex"
curdoc().add_root(bokehCssPTB.getStyleDiv())
curdoc().theme = bokehCssPTB.getTheme()
self.dsiInput = TextInput(value="", title="DSI unit string:", width=500)
self.dsiInput.on_event(ValueSubmit, self.parseInput)
self.dsiSubmitButton = Button(label="Convert", button_type="primary")
self.dsiSubmitButton.on_click(self.parseInput)
self.inputRow = row(children = [self.dsiInput, self.dsiSubmitButton], css_classes = ["textInputRow"])
self.results = column(children = [])
self.layoutColumn = column(children = [self.inputRow, self.results], css_classes = ["textlikeColumn"])
curdoc().add_root(self.layoutColumn)
self.widget = column(children=[self.inputRow, self.results], css_classes=["textlikeColumn"])
def parseInput(self):
self.results.children = []
input = self.dsiInput.value
p = dsiParser()
resultTree = p.parse(input)
parsingMessages = []
if resultTree.valid:
parsingMessages.append(
......@@ -74,5 +67,33 @@ class page():
p
], css_classes = ["latexImageRow"])
self.results.children = [self.resultErrors, latexOutput, imageOutput]
self.dsiTree = resultTree
class page():
def __init__(self):
curdoc().template_variables["VERSION"] = VERSION
curdoc().title = "DSI to Latex"
curdoc().add_root(bokehCssPTB.getStyleDiv())
curdoc().theme = bokehCssPTB.getTheme()
self.dsiInput1 = dsiparserInput()
self.dsiInput2 = dsiparserInput()
self.inputs=row([self.dsiInput1.widget, self.dsiInput2.widget])
curdoc().add_root(self.inputs)
self.comapreButton = Button(label="Compare", button_type="primary")
self.comapreButton.on_click(self.compare)
self.compaReresult = Div(text = "", css_classes = ["msg-positive"])
self.compareRow = row(children = [self.comapreButton,self.compaReresult], css_classes = ["textInputRow"])
curdoc().add_root(self.compareRow)
def compare(self):
self.dsiInput1.parseInput()
self.dsiInput2.parseInput()
scalfactor,baseUnit=self.dsiInput1.dsiTree.isScalablyEqualTo(self.dsiInput2.dsiTree)
if scalfactor:
self.compaReresult.text = "The two units are equal up to a scaling factor of "+str(scalfactor)+" and a base unit of "+str(baseUnit)
self.compaReresult.css_classes=["msg-positive"]
else:
self.compaReresult.text = "The two units are not equal"
self.compaReresult.css_classes = ["msg-negative"]
thisPage = page()
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