bluenevus commited on
Commit
9e26678
·
verified ·
1 Parent(s): 97f00bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -238,6 +238,7 @@ Now, generate the {document_type}:
238
  Input('btn-generate-document', 'n_clicks'),
239
  State('document-source', 'value'),
240
  State('specific-document-name', 'children'),
 
241
  prevent_initial_call=True
242
  )
243
  def generate_document_preview(*args):
@@ -247,6 +248,7 @@ def generate_document_preview(*args):
247
  raise dash.exceptions.PreventUpdate
248
 
249
  triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
 
250
 
251
  if triggered_id.startswith('btn-'):
252
  document_type = triggered_id.replace('btn-', '').replace('-', ' ').title()
@@ -256,10 +258,11 @@ def generate_document_preview(*args):
256
  return html.Div(f"Ready to generate {document_type} document."), "", f"Ready to generate {document_type} document.", {'display': 'block'}, {'display': 'flex'}, {'display': 'block'}
257
  elif document_type in ["Pink Review", "Red Review", "Gold Review", "Virtual Board", "Loe"]:
258
  return html.Div(f"Ready to generate {document_type}."), "", f"Ready to generate {document_type}.", {'display': 'block'}, {'display': 'flex'}, {'display': 'block'}
259
-
 
260
  if triggered_id == 'btn-generate-document':
261
- document_source = args[-2]
262
- specific_document = args[-1]
263
 
264
  if document_type == "Shred":
265
  if not uploaded_files:
@@ -321,7 +324,8 @@ def generate_document_preview(*args):
321
  print(f"Error generating document: {str(e)}")
322
  return html.Div(f"Error generating document: {str(e)}"), "Error", "An error occurred while generating the document.", {'display': 'none'}, {'display': 'none'}, {'display': 'none'}
323
 
324
- raise dash.exceptions.PreventUpdate
 
325
  @app.callback(
326
  Output('specific-document-name', 'children'),
327
  Input('upload-specific-document', 'contents'),
 
238
  Input('btn-generate-document', 'n_clicks'),
239
  State('document-source', 'value'),
240
  State('specific-document-name', 'children'),
241
+ State('file-list', 'children'),
242
  prevent_initial_call=True
243
  )
244
  def generate_document_preview(*args):
 
248
  raise dash.exceptions.PreventUpdate
249
 
250
  triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
251
+ file_list = args[-1]
252
 
253
  if triggered_id.startswith('btn-'):
254
  document_type = triggered_id.replace('btn-', '').replace('-', ' ').title()
 
258
  return html.Div(f"Ready to generate {document_type} document."), "", f"Ready to generate {document_type} document.", {'display': 'block'}, {'display': 'flex'}, {'display': 'block'}
259
  elif document_type in ["Pink Review", "Red Review", "Gold Review", "Virtual Board", "Loe"]:
260
  return html.Div(f"Ready to generate {document_type}."), "", f"Ready to generate {document_type}.", {'display': 'block'}, {'display': 'flex'}, {'display': 'block'}
261
+ return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
262
+
263
  if triggered_id == 'btn-generate-document':
264
+ document_source = args[-3]
265
+ specific_document = args[-2]
266
 
267
  if document_type == "Shred":
268
  if not uploaded_files:
 
324
  print(f"Error generating document: {str(e)}")
325
  return html.Div(f"Error generating document: {str(e)}"), "Error", "An error occurred while generating the document.", {'display': 'none'}, {'display': 'none'}, {'display': 'none'}
326
 
327
+ return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
328
+
329
  @app.callback(
330
  Output('specific-document-name', 'children'),
331
  Input('upload-specific-document', 'contents'),