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

versti start version of table tool

parent 9b872fb3
Branches
No related tags found
No related merge requests found
from bokeh.models import TabPanel, Tabs,FileInput,CustomJS, Div from bokeh.models import TabPanel, Tabs,FileInput,CustomJS, Div, Dropdown, MultiChoice
from bokeh.layouts import column, curdoc from bokeh.layouts import column
from bokeh.plotting import figure, show, output_file from bokeh.plotting import figure, show, output_file,curdoc
from base64 import b64decode
from io import BytesIO
import pandas as pd
import base64
from openpyxl import load_workbook
sheetNames=[]
controalDict={}
##FileUploadSide
dataXLSFile=None
output_file(filename="custom_filename.html", title="Static HTML file") output_file(filename="custom_filename.html", title="Static HTML file")
dataFileInput = FileInput(title="Select Data files:", accept=".csv,.xls,.xlsx,.odf") dataFileInput = FileInput(title="Select Data files:", accept=".csv,.xls,.xlsx,.odf")
controalFileImput = FileInput(title="Optional select conversion control file:", accept=".json") controalFileImput = FileInput(title="Optional select conversion control file:", accept=".json")
sheetSelectDropDown = Dropdown(label="Dropdown button", button_type="warning", menu=sheetNames,disabled=True)
div = Div(text="<h1>FileInput Values:</h1><p>filename:<p>base64 value:") def dataFileUploadCallback(attr, old, new):
data = b64decode(dataFileInput.value)
callback = CustomJS(args=dict(div=div, file_input=dataFileInput), code=""" dataXLSFile=BytesIO(data)
div.text = "<h1>FileInput Values:</h1><p>filename: " + file_input.filename wb = load_workbook(dataXLSFile,'wb')
+ "<p>b64 value: " + file_input.value active_ws = wb.active
""") sheetNames=wb.sheetnames
dataFileInput.js_on_change('filename', callback) sheetSelectDropDown.disabled=False
tab1 = TabPanel(child=column(dataFileInput,div,controalFileImput), title="File Upload") sheetSelectDropDown.menu=sheetNames
#sheetnamesDropDownMenue=[]
#for sName in sheetNames:
# sheetnamesDropDownMenue.append((sName,sName))
print("XLS upload Succeeded")
print(sheetNames)
def sheetSelectionCallBack(event):
controalDict['Sheet']=event.item
sheetSelectDropDown.label=str(controalDict['Sheet'])
sheetSelectDropDown.button_type='success'
#tab2.disabled=False# we have uplaoded an file and chosed a sheet so we can activate the next tab TODO fix this
tab2.update(disabled=False)
overAllTabs.active=1# switch to tabel view tab
overAllTabs.update()
print("Test")
dataFileInput.on_change('filename', dataFileUploadCallback)
sheetSelectDropDown.on_click(sheetSelectionCallBack)
tab1 = TabPanel(child=column(dataFileInput,controalFileImput,sheetSelectDropDown), title="File Upload")
###DataViewSide
p2 = figure(width=300, height=300) p2 = figure(width=300, height=300)
p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color="navy", alpha=0.5) p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color="navy", alpha=0.5)
tab2 = TabPanel(child=p2, title="line") tab2 = TabPanel(child=p2, title="TableView",disabled=False)#TODO deactivate as default
# put the button and plot in a layout and add to the document # put the button and plot in a layout and add to the document
curdoc().add_root(Tabs(tabs=[tab1, tab2])) overAllTabs=Tabs(tabs=[tab1, tab2])
\ No newline at end of file curdoc().add_root(overAllTabs)
\ No newline at end of file
## Inhalt ## Inhalt
Dieses Repo enthält Python-Klassen zum Umgang mit DDC KalibrationsDaten. Dieses Repo enthält Python-Klassen zum Umgang mit DDC KalibrationsDaten.
## [Beispiel Jupyther Notebook (klick mich)](pyDCCToolsExamplesNoteBook.ipynb) ## [Beispiel Jupyther Notebook (klick mich)](pyDCCToolsExamplesNoteBook.ipynb)
\ No newline at end of file
## Bokeh server Debugging
Zum Debuggen einer Bokeh Server Aplilikation in Pycharm muss die "Run/Debug Configuration" wie folgt eingestellt werden:
Script path: ```$project/venv/bin/bokeh```. Pycharm startet nun nicht mehr ein Python Interpreter, sondern die Bokeh executable.
Da mit nun das richtige Pythonscript ausgeführt wird, müssen die Programmparameter (diese werden an Bohek übergeben) wie folgt lauten:
Parameters: ```serve --show $project/$main.py --args myargs```
Um Zugriff auf die Python Console zu haben sollte diese mit der Checkbox ```Run with Python Console``` aktiviert werden.
Beispiel Configuration
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment