Skip to content
Snippets Groups Projects
Commit 1d215b66 authored by David, Sebastian's avatar David, Sebastian
Browse files

letzte Aenderungen vor dem merge request

parent d3b95d64
Branches
No related tags found
1 merge request!8UI Hinzufügen
......@@ -14,7 +14,8 @@ app = dash.Dash(__name__)
# List of options when inputting data and generating the graph
additional_options = ['Update Automatically','Smart Input']
# Reads the contents of info_box.txt. They can later be displayed by pressing the corresponding button.
# Reads the contents of info_box.txt.
# They can later be displayed by pressing the corresponding button.
f = open('info_box.txt', 'r')
boxcontent = f.read()
f.close()
......@@ -28,7 +29,8 @@ app.layout = html.Div([
# Layer 1: For all mandatory Inputs
html.Div([
"Input: ",
# A simple box for inputting a string. Value is transmitted upon pressen return or clicking out of the box.
# A simple box for inputting a string.
# Value is transmitted upon pressing return or clicking out of the box.
dcc.Input(id='input-string', value='', type='text',debounce=True),
# Forward recursion. Values between 1 and 10 can be entered.
dcc.Input(id='forward-depth',value='1',type='number',min='1',max='10'),
......@@ -52,8 +54,10 @@ app.layout = html.Div([
]),
# Layer 2: For the checklist, Remove-/Start-Buttons and input-error-message
html.Div([
# All input DOIs are collected in this checklist. It is initialized to avoid error messages.
dcc.Checklist(id='input-checklist',options=[],labelStyle = dict(display='block'),value=[]),
# All input DOIs are collected in this checklist.
# It is initialized to avoid error messages.
dcc.Checklist(id='input-checklist',options=[],
labelStyle = dict(display='block'),value=[]),
# Displays error message if 'Smart Input' is active.
html.Div(id='input-err',style={'color':'red'}),
# Clears the entire list.
......@@ -90,7 +94,8 @@ app.layout = html.Div([
State('input-checklist','value'),
State('additional-options','value')
)
def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selected_inputs,additional_options):
def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,
selected_inputs,additional_options):
'''
Most important callback function. Updates the checklist that holds all inputs.
State of the checklist as input is needed so that previews entries are readded.
......@@ -140,11 +145,12 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte
# Attempts to call get_publication. If unsuccesful,
# the DOI is not added and an error message is returned
i = InputInterface()
pub = i.get_publication(input_value)
pub = i.get_pub_light(input_value)
except Exception as err:
return options,selected_inputs,'','{}'.format(err)
# Creates a more readable string to display in the checklist
rep_str = pub.contributors[0] + ',' + pub.journal + ',' + pub.publication_date
rep_str = pub.contributors[0] + ',' + pub.journal + \
',' + pub.publication_date
all_inputs.append({'label':rep_str, 'value':input_value})
# if 'Smart Input' is not selected, the input value is added as is,
......@@ -169,10 +175,11 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte
if 'Smart Input' in additional_options:
try:
i = InputInterface()
pub = i.get_publication(input_value)
pub = i.get_pub_light(input_value)
except Exception as err:
return all_inputs,selected_inputs,'','{}'.format(err)
rep_str = pub.contributors[0] + ',' + pub.journal + ',' + pub.publication_date
rep_str = pub.contributors[0] + ',' + pub.journal + \
',' + pub.publication_date
all_inputs.append({'label':rep_str, 'value':input_value})
else:
all_inputs.append({'label':input_value,'value':input_value})
......@@ -181,7 +188,6 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte
# if this is not done, the input_checklist will be generated
# with one element that contains an empty string
if input_value == '':
app.layout['input-checklist'].options.clear()
return list(),list(),'',''
@app.callback(
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
# Projekt CiS-Biochemie 2021-22 UI
# Benötigt:
- Dash
- Pandas
- beautifulsoup4
- requests
# Starten des Programms:
Ausführen von citation_parser_ui.py und einfügen des entstandenen Liks in einen Browser.
Danach müsste sich die Benutzeroberfläche im Browser öffnen.
# Übersicht der Benutzeroberfläche:
- Show Info: Durch wiederholtes klicken kann das Fenster ein und aus geblendet werden.
- Input: Die Eingabe erfolgt in Form eines DOI ("Digital Object Identifier")
- Drag and drop or click to select a file to upload: Mehrere DOI in einem txt-Dokument (genau ein DOI pro Zeile).
- Recursion: die beiden noch unbeschrifteten Felder rechts neben Input sind für die Rekursionstiefen in beide Richtungen
- Clear All: alle Eingaben werden gelöscht
- Clear Selected: alle markierten Eingaben werden gelöscht
- Generate Graph: generiert den zugehörigen Graphen (generiert momentan nur einen string)
- Update Automatically: automatische Aktualisierung des Graphen bei jeder neuen Eingabe
- Smart Input: direkte Überprüfung der Eingabe auf Richtigkeit zudem wird nicht mehr der DOI angezeigt sondern:
Der Autor, Das Journal, Das Veröffentlichungsdatum. (muss vor Hinzufügen aktiviert worden sein)
## Autoren
- Isabelle Siebels
- Sebastian David
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment