Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pyDCCandDBTools
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
Benedikt
pyDCCandDBTools
Commits
734d722c
Commit
734d722c
authored
2 years ago
by
Benedikt
Browse files
Options
Downloads
Patches
Plain Diff
versti start version of table tool
parent
9b872fb3
Branches
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
DCCTableTool.py
+47
-18
47 additions, 18 deletions
DCCTableTool.py
README.md
+15
-1
15 additions, 1 deletion
README.md
with
62 additions
and
19 deletions
DCCTableTool.py
+
47
−
18
View file @
734d722c
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
This diff is collapsed.
Click to expand it.
README.md
+
15
−
1
View file @
734d722c
## 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
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