Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DSI Parser Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DigitalDynamicMeasurement
DSI Parser Frontend
Commits
c1ba6f13
Commit
c1ba6f13
authored
1 year ago
by
Benedikt
Browse files
Options
Downloads
Patches
Plain Diff
added second unit filds and compare option
parent
03ddfdae
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dockerfile
+3
-4
3 additions, 4 deletions
dockerfile
main.py
+31
-10
31 additions, 10 deletions
main.py
with
34 additions
and
14 deletions
dockerfile
+
3
−
4
View file @
c1ba6f13
...
...
@@ -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"]
This diff is collapsed.
Click to expand it.
main.py
+
31
−
10
View file @
c1ba6f13
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment