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

Move CSS to separate package

parent 47a22afd
No related branches found
No related tags found
No related merge requests found
...@@ -2,4 +2,5 @@ bokeh~=3.3.10 ...@@ -2,4 +2,5 @@ bokeh~=3.3.10
pytest~=7.4.2 pytest~=7.4.2
pytest-cov~=4.1.0 pytest-cov~=4.1.0
#-e git+https://pipPull:BMzhUMQZThk-wLy6KDvs@gitlab1.ptb.de/digitaldynamicmeasurement/dcc_XMLJSONConv.git@release#egg=dcc_XMLJSONConv #-e git+https://pipPull:BMzhUMQZThk-wLy6KDvs@gitlab1.ptb.de/digitaldynamicmeasurement/dcc_XMLJSONConv.git@release#egg=dcc_XMLJSONConv
-e git+https://pipPull:eVJmNgPKyXCjxgEqDquL@gitlab1.ptb.de/digitaldynamicmeasurement/py-dsi-vectors-and-tables.git@release#egg=dsiVectorsAndTables -e git+https://pipPull:eVJmNgPKyXCjxgEqDquL@gitlab1.ptb.de/digitaldynamicmeasurement/py-dsi-vectors-and-tables.git@release#egg=dsiVectorsAndTables
\ No newline at end of file -e git+https://gitlab1.ptb.de/digitaldynamicmeasurement/bokehCssPtb.git#egg=bokehCssPTB
\ No newline at end of file
...@@ -3,10 +3,10 @@ import io ...@@ -3,10 +3,10 @@ import io
import json import json
import tarfile import tarfile
import warnings import warnings
import bokehCssPTB
from bokeh.plotting import curdoc from bokeh.plotting import curdoc
from bokeh.layouts import column from bokeh.layouts import column
from bokeh.models import FileInput, Div, CustomJS, Button, TabPanel, Tabs, Dropdown, InlineStyleSheet, ImportedStyleSheet from bokeh.models import FileInput, Div, CustomJS, Button, TabPanel, Tabs, Dropdown
from bokeh.themes import Theme
from pyDsiVectorsAndTables.pyDsiVectorsAndTables import ( from pyDsiVectorsAndTables.pyDsiVectorsAndTables import (
dsiVector, dsiVector,
dsiMultiVector, dsiMultiVector,
...@@ -21,8 +21,7 @@ VERSION = "0.1.0" ...@@ -21,8 +21,7 @@ VERSION = "0.1.0"
class page: class page:
def __init__(self, stylesheets=[]): def __init__(self):
self.stylesheets = stylesheets
self.fileUploader = fileUploader(self.readFile) self.fileUploader = fileUploader(self.readFile)
self.fileDownloader = fileDownloader() self.fileDownloader = fileDownloader()
self.tabs = [] self.tabs = []
...@@ -32,17 +31,9 @@ class page: ...@@ -32,17 +31,9 @@ class page:
self.tabs = Tabs(tabs=[self.ogDisplayerTab, self.gemimegTab], name="content") self.tabs = Tabs(tabs=[self.ogDisplayerTab, self.gemimegTab], name="content")
curdoc().template_variables["VERSION"] = VERSION curdoc().template_variables["VERSION"] = VERSION
curdoc().add_root(bokehCssPTB.getStyleDiv())
curdoc().add_root(self.tabs) curdoc().add_root(self.tabs)
curdoc().theme = Theme( curdoc().theme = bokehCssPTB.getTheme()
json=dict(
attrs=dict(
UIElement=dict(stylesheets=self.stylesheets),
),
),
)
# curdoc().add_root(self.fileUploader.layout)
# curdoc().add_root(self.fileDownloader.layout)
# curdoc().add_root(self.dataView.layout)
def buildGemimegTab(self): def buildGemimegTab(self):
gemimegElement = Div(text="""<embed src="https://s18361.bs.ptb.de/gemimeg-tool/#/" height="1080" width="1920">""") gemimegElement = Div(text="""<embed src="https://s18361.bs.ptb.de/gemimeg-tool/#/" height="1080" width="1920">""")
...@@ -162,7 +153,7 @@ class fileUploader: ...@@ -162,7 +153,7 @@ class fileUploader:
args=dict(div=self.fileInputMessage, file_input=self.fileInput), args=dict(div=self.fileInputMessage, file_input=self.fileInput),
code=""" code="""
div.text = "Processing file…" div.text = "Processing file…"
div.css_classes = ["msg-positive"] div.css_classes = ["msg-neutral"]
""", """,
) )
self.fileInput.js_on_change("filename", jsCallback) self.fileInput.js_on_change("filename", jsCallback)
...@@ -230,7 +221,6 @@ class fileDownloader: ...@@ -230,7 +221,6 @@ class fileDownloader:
self.setMessage("Please select a file format!", ["msg-negative"]) self.setMessage("Please select a file format!", ["msg-negative"])
return return
self.setMessage("Preparing download file…") self.setMessage("Preparing download file…")
# base64_string = base64.b64encode(self.byte_object).decode("utf-8")
match self.selectedDownloadFormat: match self.selectedDownloadFormat:
case "csv": case "csv":
buffer = io.BytesIO() buffer = io.BytesIO()
...@@ -244,7 +234,6 @@ class fileDownloader: ...@@ -244,7 +234,6 @@ class fileDownloader:
tarinfo.size = len(string_buffer.getvalue()) tarinfo.size = len(string_buffer.getvalue())
tar.addfile(tarinfo, string_buffer) tar.addfile(tarinfo, string_buffer)
buffer.seek(0) buffer.seek(0)
# self.fileContent = base64.b64encode(buffer.getvalue()).decode("ascii")
download_js = CustomJS( download_js = CustomJS(
args=dict(buffer_contents=buffer.getvalue(), filename=filename), args=dict(buffer_contents=buffer.getvalue(), filename=filename),
...@@ -262,8 +251,6 @@ class fileDownloader: ...@@ -262,8 +251,6 @@ class fileDownloader:
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
""" """
) )
# case "ods":
# self.fileContent = base64.b64encode(next(iter(self.dcc.createdMultiVectors.values())).dump_ods().getvalue()).decode("ascii")
case "xlsx": case "xlsx":
filename = f'{self.filename}.xlsx' filename = f'{self.filename}.xlsx'
buffer = io.BytesIO() buffer = io.BytesIO()
...@@ -281,7 +268,6 @@ class fileDownloader: ...@@ -281,7 +268,6 @@ class fileDownloader:
link.click(); link.click();
""", """,
) )
# self.fileContent = "Test"
self.download_button.js_on_click(download_js) self.download_button.js_on_click(download_js)
self.setMessage("File ready for download!", ["msg-positive"]) self.setMessage("File ready for download!", ["msg-positive"])
...@@ -296,8 +282,4 @@ class fileDownloader: ...@@ -296,8 +282,4 @@ class fileDownloader:
self.fileDownloadMessage.css_classes = css_classes self.fileDownloadMessage.css_classes = css_classes
stylesheets = [ thisPage = page()
# ImportedStyleSheet(url = "https://cdn.simplecss.org/simple.min.css"),
InlineStyleSheet(css = open("static/css/styles.css").read())
]
thisPage = page(stylesheets)
/* html, body{
background: red;
} */
/* label {
font-size: 100px;
background: skyblue !important;
} */
body {
grid-template-columns: 1fr 80% 1fr;
}
/* .container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr;
gap: 0px 0px;
grid-template-areas:
". . .";
} */
.msg-negative, .msg-neutral, .msg-positive {
border-style: solid;
border-radius: 5px;
border-width: 1px;
padding: 0.5em 1em;
margin: 0.5em;
}
.msg-neutral {
background: #ffebcd;
border-color: #ffcc80;
}
.msg-positive {
background-color: #90ee90;
border-color: #45ab45;
}
.msg-negative {
background-color: #f08080;
border-color: #ac4545;
}
.data-view {
border-bottom: 1px solid #e6e6e6;
}
.bk-tab {
font-weight: bold;
font-size: larger;
}
.bk-tab.bk-active {
background-color: #f2f2f2;
}
\ No newline at end of file
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
background: red !important; background: red !important;
} */ } */
</style> </style>
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css"> <!-- <link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css"> -->
<link rel="stylesheet" href="src/static/css/styles.css"/> <!-- <link rel="stylesheet" href="src/static/css/styles.css"/> -->
{% block css_resources -%} {% block css_resources -%}
{{- bokeh_css if bokeh_css }} {{- bokeh_css if bokeh_css }}
{%- endblock css_resources %} {%- endblock css_resources %}
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
{% block inner_body %} {% block inner_body %}
{% block contents %} {% block contents %}
<div> <div>
{{ embed(roots.styleSheetDiv) }}
{{ embed(roots.content) }} {{ embed(roots.content) }}
</div> </div>
{% endblock contents %} {% endblock contents %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment