ivoryos 1.0.9__py3-none-any.whl → 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ivoryos might be problematic. Click here for more details.

Files changed (87) hide show
  1. ivoryos/__init__.py +26 -7
  2. ivoryos/routes/api/api.py +56 -0
  3. ivoryos/routes/auth/auth.py +5 -5
  4. ivoryos/routes/control/control.py +77 -372
  5. ivoryos/routes/control/control_file.py +36 -0
  6. ivoryos/routes/control/control_new_device.py +142 -0
  7. ivoryos/routes/control/templates/controllers.html +166 -0
  8. ivoryos/routes/control/templates/controllers_new.html +112 -0
  9. ivoryos/routes/control/utils.py +38 -0
  10. ivoryos/routes/data/data.py +129 -0
  11. ivoryos/routes/data/templates/components/step_card.html +13 -0
  12. ivoryos/routes/{database/templates/database → data/templates}/workflow_database.html +14 -8
  13. ivoryos/routes/{database/templates/database → data/templates}/workflow_view.html +3 -3
  14. ivoryos/routes/design/__init__.py +4 -0
  15. ivoryos/routes/design/design.py +298 -656
  16. ivoryos/routes/design/design_file.py +68 -0
  17. ivoryos/routes/design/design_step.py +145 -0
  18. ivoryos/routes/design/templates/components/action_form.html +53 -0
  19. ivoryos/routes/design/templates/components/actions_panel.html +25 -0
  20. ivoryos/routes/design/templates/components/autofill_toggle.html +10 -0
  21. ivoryos/routes/design/templates/components/canvas.html +5 -0
  22. ivoryos/routes/design/templates/components/canvas_footer.html +9 -0
  23. ivoryos/routes/design/templates/components/canvas_header.html +75 -0
  24. ivoryos/routes/design/templates/components/canvas_main.html +34 -0
  25. ivoryos/routes/design/templates/components/deck_selector.html +10 -0
  26. ivoryos/routes/design/templates/components/edit_action_form.html +38 -0
  27. ivoryos/routes/design/templates/components/instruments_panel.html +66 -0
  28. ivoryos/routes/design/templates/components/modals/drop_modal.html +17 -0
  29. ivoryos/routes/design/templates/components/modals/json_modal.html +22 -0
  30. ivoryos/routes/design/templates/components/modals/new_script_modal.html +17 -0
  31. ivoryos/routes/design/templates/components/modals/rename_modal.html +23 -0
  32. ivoryos/routes/design/templates/components/modals/saveas_modal.html +27 -0
  33. ivoryos/routes/design/templates/components/modals.html +6 -0
  34. ivoryos/routes/design/templates/components/python_code_overlay.html +39 -0
  35. ivoryos/routes/design/templates/components/sidebar.html +15 -0
  36. ivoryos/routes/design/templates/components/text_to_code_panel.html +20 -0
  37. ivoryos/routes/design/templates/experiment_builder.html +41 -0
  38. ivoryos/routes/execute/__init__.py +0 -0
  39. ivoryos/routes/execute/execute.py +317 -0
  40. ivoryos/routes/execute/execute_file.py +78 -0
  41. ivoryos/routes/execute/templates/components/error_modal.html +20 -0
  42. ivoryos/routes/execute/templates/components/logging_panel.html +31 -0
  43. ivoryos/routes/execute/templates/components/progress_panel.html +27 -0
  44. ivoryos/routes/execute/templates/components/run_panel.html +9 -0
  45. ivoryos/routes/execute/templates/components/run_tabs.html +17 -0
  46. ivoryos/routes/execute/templates/components/tab_bayesian.html +398 -0
  47. ivoryos/routes/execute/templates/components/tab_configuration.html +98 -0
  48. ivoryos/routes/execute/templates/components/tab_repeat.html +14 -0
  49. ivoryos/routes/execute/templates/experiment_run.html +294 -0
  50. ivoryos/routes/library/__init__.py +0 -0
  51. ivoryos/routes/library/library.py +159 -0
  52. ivoryos/routes/{database/templates/database/scripts_database.html → library/templates/library.html} +30 -22
  53. ivoryos/routes/main/main.py +1 -1
  54. ivoryos/routes/main/templates/{main/home.html → home.html} +4 -4
  55. ivoryos/socket_handlers.py +52 -0
  56. ivoryos/static/js/action_handlers.js +213 -0
  57. ivoryos/static/js/db_delete.js +23 -0
  58. ivoryos/static/js/script_metadata.js +39 -0
  59. ivoryos/static/js/sortable_design.js +89 -56
  60. ivoryos/static/js/ui_state.js +113 -0
  61. ivoryos/templates/base.html +4 -4
  62. ivoryos/utils/bo_campaign.py +179 -3
  63. ivoryos/utils/db_models.py +14 -5
  64. ivoryos/utils/form.py +5 -9
  65. ivoryos/utils/global_config.py +13 -1
  66. ivoryos/utils/py_to_json.py +225 -0
  67. ivoryos/utils/script_runner.py +49 -7
  68. ivoryos/utils/serilize.py +203 -0
  69. ivoryos/utils/task_runner.py +4 -1
  70. ivoryos/version.py +1 -1
  71. {ivoryos-1.0.9.dist-info → ivoryos-1.2.0.dist-info}/METADATA +5 -8
  72. ivoryos-1.2.0.dist-info/RECORD +105 -0
  73. ivoryos/routes/control/templates/control/controllers.html +0 -78
  74. ivoryos/routes/control/templates/control/controllers_home.html +0 -55
  75. ivoryos/routes/control/templates/control/controllers_new.html +0 -89
  76. ivoryos/routes/database/database.py +0 -306
  77. ivoryos/routes/database/templates/database/step_card.html +0 -7
  78. ivoryos/routes/design/templates/design/experiment_builder.html +0 -521
  79. ivoryos/routes/design/templates/design/experiment_run.html +0 -558
  80. ivoryos-1.0.9.dist-info/RECORD +0 -61
  81. /ivoryos/routes/auth/templates/{auth/login.html → login.html} +0 -0
  82. /ivoryos/routes/auth/templates/{auth/signup.html → signup.html} +0 -0
  83. /ivoryos/routes/{database → data}/__init__.py +0 -0
  84. /ivoryos/routes/main/templates/{main/help.html → help.html} +0 -0
  85. {ivoryos-1.0.9.dist-info → ivoryos-1.2.0.dist-info}/LICENSE +0 -0
  86. {ivoryos-1.0.9.dist-info → ivoryos-1.2.0.dist-info}/WHEEL +0 -0
  87. {ivoryos-1.0.9.dist-info → ivoryos-1.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
1
+
2
+ import json
3
+ import os
4
+ from flask import Blueprint, send_file, request, flash, redirect, url_for, current_app
5
+ from werkzeug.utils import secure_filename
6
+ from ivoryos.utils import utils
7
+
8
+ files = Blueprint('design_files', __name__)
9
+
10
+
11
+
12
+ @files.route('/files/script-json', methods=['POST'])
13
+ def load_json():
14
+ """
15
+ .. :quickref: Workflow Design Ext; upload a workflow design file (.JSON)
16
+
17
+ .. http:post:: /files/script-json
18
+
19
+ :form file: workflow design JSON file
20
+ :status 302: load script json and then redirects to :http:get:`/ivoryos/design/draft`
21
+ """
22
+
23
+ if request.method == "POST":
24
+ f = request.files['file']
25
+ if 'file' not in request.files:
26
+ flash('No file part')
27
+ if f.filename.endswith("json"):
28
+ script_dict = json.load(f)
29
+ utils.post_script_file(script_dict, is_dict=True)
30
+ else:
31
+ flash("Script file need to be JSON file")
32
+ return redirect(url_for("design.experiment_builder"))
33
+
34
+ @files.route('/files/script-python')
35
+ def download_python():
36
+ """
37
+ .. :quickref: Workflow Design Ext; export a workflow design file (.py)
38
+
39
+ .. http:post:: /files/script-python
40
+
41
+ :status 302: redirects to :http:get:`/ivoryos/design/script/`
42
+ """
43
+ script = utils.get_script_file()
44
+ run_name = script.name if script.name else "untitled"
45
+ filepath = os.path.join(current_app.config["SCRIPT_FOLDER"], f"{run_name}.py")
46
+ return send_file(os.path.abspath(filepath), as_attachment=True)
47
+
48
+
49
+ @files.route('/files/script-json')
50
+ def download_json():
51
+ """
52
+ .. :quickref: Workflow Design Ext; export a workflow design file (.JSON)
53
+
54
+ .. http:post:: /files/script-json
55
+
56
+ :status 302: redirects to :http:get:`/ivoryos/design/script/`
57
+ """
58
+ script = utils.get_script_file()
59
+ run_name = script.name if script.name else "untitled"
60
+
61
+ script.sort_actions()
62
+ json_object = json.dumps(script.as_dict())
63
+ filepath = os.path.join(current_app.config['SCRIPT_FOLDER'], f"{run_name}.json")
64
+ with open(filepath, "w") as outfile:
65
+ outfile.write(json_object)
66
+ return send_file(os.path.abspath(filepath), as_attachment=True)
67
+
68
+
@@ -0,0 +1,145 @@
1
+ from flask import Blueprint, request, session, flash, redirect, url_for, jsonify, render_template, current_app
2
+ from flask_login import login_required
3
+
4
+ from ivoryos.utils import utils
5
+ from ivoryos.utils.form import create_form_from_action, create_action_button
6
+
7
+ steps = Blueprint('design_steps', __name__)
8
+
9
+
10
+ @steps.get("/draft/steps/<int:uuid>")
11
+ def get_step(uuid: int):
12
+ """
13
+ .. :quickref: Workflow Design Steps; get an action step editing form
14
+
15
+ .. http:get:: /steps/<int:uuid>
16
+
17
+ get the editing form for an action step
18
+
19
+ :param uuid: The step number id
20
+ :type uuid: int
21
+
22
+ :status 200: render template with action step form
23
+ """
24
+ script = utils.get_script_file()
25
+ action = script.find_by_uuid(uuid)
26
+ if request.method == 'GET':
27
+ # forms = create_form_from_action(action, script=script)
28
+ # session['edit_action'] = action
29
+ return render_template("components/edit_action_form.html",
30
+ action=action,
31
+ forms=create_form_from_action(action, script=script))
32
+
33
+
34
+ @steps.post("/draft/steps/<int:uuid>")
35
+ def save_step(uuid: int):
36
+ """
37
+ .. :quickref: Workflow Design Steps; save an action step on canvas
38
+
39
+ .. http:post:: /steps/<int:uuid>
40
+
41
+ save the changes of an action step
42
+
43
+ :param uuid: The step number id
44
+ :type uuid: int
45
+
46
+ :status 200: render template with action step form
47
+ """
48
+ script = utils.get_script_file()
49
+ action = script.find_by_uuid(uuid)
50
+ if action is not None:
51
+ forms = create_form_from_action(action, script=script)
52
+ kwargs = {field.name: field.data for field in forms if field.name != 'csrf_token'}
53
+ if forms and forms.validate_on_submit():
54
+ save_as = kwargs.pop('return', '')
55
+ kwargs = script.validate_variables(kwargs)
56
+ script.update_by_uuid(uuid=uuid, args=kwargs, output=save_as)
57
+ else:
58
+ flash(forms.errors)
59
+ utils.post_script_file(script)
60
+ exec_string = script.compile(current_app.config['SCRIPT_FOLDER'])
61
+ session['python_code'] = exec_string
62
+ design_buttons = {stype: create_action_button(script, stype) for stype in script.stypes}
63
+ return render_template("components/canvas_main.html",
64
+ script=script,
65
+ buttons_dict=design_buttons)
66
+
67
+ @steps.delete("/draft/steps/<int:uuid>")
68
+ def delete_step(uuid: int):
69
+ """
70
+ .. :quickref: Workflow Design Steps; delete an action step on canvas
71
+
72
+ .. http:delete:: /steps/<int:uuid>
73
+
74
+ delete an action step
75
+
76
+ :param uuid: The step number id
77
+ :type uuid: int
78
+
79
+ :status 200: render template with action step form
80
+ """
81
+ script = utils.get_script_file()
82
+ if request.method == 'DELETE':
83
+ script.delete_action(uuid)
84
+ utils.post_script_file(script)
85
+ exec_string = script.compile(current_app.config['SCRIPT_FOLDER'])
86
+ session['python_code'] = exec_string
87
+ design_buttons = {stype: create_action_button(script, stype) for stype in script.stypes}
88
+ return render_template("components/canvas_main.html",
89
+ script=script,
90
+ buttons_dict=design_buttons)
91
+
92
+
93
+ @steps.route("/draft/steps/<int:uuid>/duplicate", methods=["POST"], strict_slashes=False,)
94
+ def duplicate_action(uuid: int):
95
+ """
96
+ .. :quickref: Workflow Design Steps; duplicate an action step on canvas
97
+
98
+ .. http:post:: /draft/steps/<int:uuid>/duplicate
99
+
100
+ :param uuid: The step number uuid
101
+ :type uuid: int
102
+
103
+ :status 200: render new design script template
104
+ """
105
+
106
+ # back = request.referrer
107
+ script = utils.get_script_file()
108
+ script.duplicate_action(uuid)
109
+ utils.post_script_file(script)
110
+ exec_string = script.compile(current_app.config['SCRIPT_FOLDER'])
111
+ session['python_code'] = exec_string
112
+ design_buttons = {stype: create_action_button(script, stype) for stype in script.stypes}
113
+
114
+ return render_template("components/canvas_main.html",
115
+ script=script,
116
+ buttons_dict=design_buttons)
117
+
118
+
119
+ @steps.route("/draft/steps/order", methods=['POST'])
120
+ @login_required
121
+ def update_list():
122
+ """
123
+ .. :quickref: Workflow Design Steps; update the order of steps in the design canvas when reordering steps.
124
+
125
+ .. http:post:: /draft/steps/order
126
+
127
+ Update the order of steps in the design canvas when reordering steps.
128
+
129
+ :form order: A comma-separated string representing the new order of steps.
130
+ :status 200: Successfully updated the order of steps.
131
+ """
132
+ order = request.form['order']
133
+ script = utils.get_script_file()
134
+ script.currently_editing_order = order.split(",", len(script.currently_editing_script))
135
+ script.sort_actions()
136
+
137
+ utils.post_script_file(script)
138
+ exec_string = script.compile(current_app.config['SCRIPT_FOLDER'])
139
+ session['python_code'] = exec_string
140
+
141
+ # Return the updated canvas HTML instead of JSON
142
+ design_buttons = {stype: create_action_button(script, stype) for stype in script.stypes}
143
+ return render_template("components/canvas_main.html",
144
+ script=script,
145
+ buttons_dict=design_buttons)
@@ -0,0 +1,53 @@
1
+ {# Action form component #}
2
+ <div class="accordion-item design-control" draggable="true">
3
+ <h2 class="accordion-header">
4
+ <button class="accordion-button collapsed draggable-action"
5
+ type="button" data-bs-toggle="collapse"
6
+ data-bs-target="#{{name}}" aria-expanded="false"
7
+ aria-controls="collapseExample"
8
+ data-action="{{ name }}">
9
+ {{ name | format_name }}
10
+ </button>
11
+ </h2>
12
+ <div id="{{name}}" class="accordion-collapse collapse" data-bs-parent="#accordionActions">
13
+ <div class="accordion-body">
14
+ <form role="form" method='POST' action="{{ url_for('design.methods_handler', instrument=instrument) }}"
15
+ name="add" id="add-{{name}}" onsubmit="addMethodToDesign(event, this); return false;">
16
+ <div class="form-group">
17
+ {{ form.hidden_tag() }}
18
+ {% for field in form %}
19
+ {% if field.type not in ['CSRFTokenField', 'HiddenField'] %}
20
+ <div class="input-group mb-3">
21
+ <label class="input-group-text">{{ field.label.text | format_name }}</label>
22
+ {% if field.type == "SubmitField" %}
23
+ {{ field(class="btn btn-dark") }}
24
+ {% elif field.type == "BooleanField" %}
25
+ {{ field(class="form-check-input") }}
26
+ {% elif field.type == "FlexibleEnumField" %}
27
+ <input type="text" id="{{ field.id }}" name="{{ field.name }}" value="{{ field.data }}"
28
+ list="{{ field.id }}_options" placeholder="{{ field.render_kw.placeholder if field.render_kw and field.render_kw.placeholder }}"
29
+ class="form-control">
30
+ <datalist id="{{ field.id }}_options">
31
+ {% for key in field.choices %}
32
+ <option value="{{ key }}">{{ key }}</option>
33
+ {% endfor %}
34
+ </datalist>
35
+ {% else %}
36
+ {{ field(class="form-control") }}
37
+ {% endif %}
38
+ </div>
39
+ {% endif %}
40
+ {% endfor %}
41
+ </div>
42
+ <button type="submit" class="btn btn-dark">Add</button>
43
+ {% if 'hidden_name' in form %}
44
+ <i class="bi bi-info-circle ms-2" data-bs-toggle="tooltip" data-bs-placement="top"
45
+ title='{{ form.hidden_name.description or "Docstring is not available" }}'>
46
+ </i>
47
+ {% else %}
48
+ <!-- handle info tooltip for flow control / workflows -->
49
+ {% endif %}
50
+ </form>
51
+ </div>
52
+ </div>
53
+ </div>
@@ -0,0 +1,25 @@
1
+ {# Instrument panel component #}
2
+ <div>
3
+ <div class="d-flex justify-content-between align-items-center " style="margin-bottom: 1vh;margin-top: 1vh;">
4
+ {# <a class="btn btn-primary" role="button" type="button" href="{{url_for('design.experiment_builder')}}"><i class="bi bi-arrow-return-left"></i></a>#}
5
+ <a type="button"
6
+ data-get-url="{{ url_for('design.get_operation_sidebar') }}"
7
+ onclick="updateInstrumentPanel(this)">
8
+ <i class="bi bi-arrow-return-left"></i>
9
+ </a>
10
+ {{ instrument | format_name }}
11
+ </div>
12
+
13
+ {% if script.editing_type == "script" %}
14
+ {# Auto Fill Toggle #}
15
+ {% include 'components/autofill_toggle.html' %}
16
+ {% endif %}
17
+
18
+ {# accordion for instrument #}
19
+ <div class="accordion accordion-flush" id="accordionActions" >
20
+
21
+ {% for name, form in forms.items() %}
22
+ {% include 'components/action_form.html' %}
23
+ {% endfor %}
24
+ </div>
25
+ </div>
@@ -0,0 +1,10 @@
1
+ {# Autofill toggle component #}
2
+ <div class="d-flex justify-content-between align-items-center " style="margin-bottom: 1vh;margin-top: 1vh;">
3
+ <div class="form-check form-switch" data-instrument="{{ instrument }}">
4
+ {# <input type="hidden" id="autofill" name="autofill" value="temp_value">#}
5
+ <input class="form-check-input" type="checkbox" id="autoFillCheck" name="autoFillCheck" onchange="toggleAutoFill()"
6
+ value="temp_value"
7
+ {{ "checked" if session["autofill"] else "" }}>
8
+ <label class="form-check-label" for="autoFillCheck">Auto fill</label>
9
+ </div>
10
+ </div>
@@ -0,0 +1,5 @@
1
+ {% include 'components/canvas_header.html' %}
2
+ <div class="canvas canvas-action-wrapper position-relative" id="canvas-action-wrapper" droppable="true">
3
+ {% include 'components/canvas_main.html' %}
4
+ </div>
5
+ {% include 'components/canvas_footer.html' %}
@@ -0,0 +1,9 @@
1
+ {# Canvas footer component #}
2
+ <div>
3
+ <a class="btn btn-dark {{ 'disabled' if not script.name or script.status == "finalized" else '' }}"
4
+ href="#" data-post-url="{{ url_for('library.workflow_script', script_name=script.name or 'untitled') }}"
5
+ onclick="saveWorkflow(this); return false;">
6
+ Quick Save
7
+ </a>
8
+ <a class="btn btn-dark " href="{{ url_for('execute.experiment_run') }}">Compile and Run</a>
9
+ </div>
@@ -0,0 +1,75 @@
1
+ {# Canvas header component #}
2
+ <div class="d-flex align-items-center justify-content-between">
3
+ <!-- Left: Script Info -->
4
+ <div>
5
+ <span class="fw-bold">{{ script.name or "Untitled Script" }}</span>
6
+ <span class="badge bg-secondary">{{ script.status }}</span>
7
+ </div>
8
+
9
+ <!-- Center: Main Actions -->
10
+ <div class="btn-toolbar" role="toolbar">
11
+ <button class="btn btn-primary btn-sm me-1" data-bs-toggle="modal" data-bs-target="#newScriptModal">New</button>
12
+ <button class="btn btn-secondary btn-sm me-1" data-bs-toggle="modal" data-bs-target="#jsonModal">Import</button>
13
+ <a class="btn btn-secondary btn-sm me-1" href="{{url_for('design.design_files.download_json', filetype='script')}}">Export</a>
14
+ <button class="btn btn-secondary btn-sm me-1" data-bs-toggle="modal" data-bs-target="#saveasModal">Save as</button>
15
+ <div class="btn-group">
16
+ <button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">More</button>
17
+ <ul class="dropdown-menu">
18
+ <li>
19
+ <button class="dropdown-item" data-bs-toggle="modal" data-bs-target="#renameModal">Rename</button>
20
+ </li>
21
+ {% if script.name %}
22
+ <li>
23
+ <a class="dropdown-item {{ 'disabled' if not script.name or script.status == "finalized" else '' }}"
24
+ href="#" data-post-url="{{ url_for('library.workflow_script', script_name=script.name) }}"
25
+ onclick="saveWorkflow(this); return false;">
26
+ Save
27
+ </a>
28
+ </li>
29
+ {% endif %}
30
+ {% if not script.status == 'finalized' %}
31
+ <li>
32
+ <a class="dropdown-item" onclick="lockScriptEditing()">Disable editing</a>
33
+ </li>
34
+ {% endif %}
35
+ </ul>
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+ <!-- Tabs for Info/Prep/Experiment/Cleanup below header -->
41
+ <div class="d-flex align-items-center mt-2 justify-content-between">
42
+ <ul class="nav nav-tabs mb-0">
43
+ <li class="nav-item">
44
+ <a class="nav-link {{ 'active' if script.editing_type == 'prep' else '' }}"
45
+ href="#" onclick="setScriptPhase('prep')">
46
+ Prep
47
+ </a>
48
+ </li>
49
+ <li class="nav-item">
50
+ <a class="nav-link {{ 'active' if script.editing_type == 'script' else '' }}"
51
+ href="#" onclick="setScriptPhase('script')">
52
+ Experiment
53
+ </a>
54
+ </li>
55
+ <li class="nav-item">
56
+ <a class="nav-link {{ 'active' if script.editing_type == 'cleanup' else '' }}"
57
+ href="#" onclick="setScriptPhase('cleanup')">
58
+ Clean up
59
+ </a>
60
+ </li>
61
+ </ul>
62
+
63
+ <div class="d-flex align-items-center ms-auto">
64
+ <div class="form-check form-switch">
65
+ <input class="form-check-input" type="checkbox" id="showPythonCodeSwitch" name="show_code"
66
+ onchange="toggleCodeOverlay()" {% if session.get('show_code') %}checked{% endif %}>
67
+ <label class="form-check-label" for="showPythonCodeSwitch">Preview code</label>
68
+ </div>
69
+ {# <div class="form-check form-switch">#}
70
+ {# <input class="form-check-input" type="checkbox" id="toggleLineNumbers"#}
71
+ {# onchange="toggleLineNumbers()">#}
72
+ {# <label class="form-check-label" for="toggleLineNumbers">Show Line Numbers</label>#}
73
+ {# </div>#}
74
+ </div>
75
+ </div>
@@ -0,0 +1,34 @@
1
+ {# Action list component #}
2
+
3
+ <!-- partials/canvas_content.html -->
4
+
5
+
6
+ <div class="list-group" id="list" style="margin-top: 20px">
7
+ <ul class="reorder">
8
+
9
+ {% if script.editing_type == "prep" %}
10
+ {% set buttons = buttons_dict["prep"] or [] %}
11
+ {% elif script.editing_type == "script" %}
12
+ {% set buttons = buttons_dict["script"] or [] %}
13
+ {% elif script.editing_type == "cleanup" %}
14
+ {% set buttons = buttons_dict["cleanup"] or [] %}
15
+ {% endif %}
16
+
17
+ {% for button in buttons %}
18
+ <li id="{{ button['id'] }}" style="list-style-type: none;">
19
+ <span class="line-number d-none">{{ button['id'] }}.</span>
20
+ <a href="#" onclick="editAction('{{ button['uuid'] }}'); return false;" type="button" class="btn btn-light" style="{{ button['style'] }}">{{ button['label'] }}</a>
21
+ {% if not button["instrument"] in ["if","while","repeat"] %}
22
+ <button onclick="duplicateAction('{{ button['id'] }}')" type="button" class="btn btn-light"><span class="bi bi-copy"></span></button>
23
+
24
+ {% endif %}
25
+ <button onclick="deleteAction('{{ button['id'] }}')" type="button" class="btn btn-light">
26
+ <span class="bi bi-trash"></span>
27
+ </button>
28
+ </li>
29
+ {% endfor %}
30
+ </ul>
31
+ </div>
32
+ <div class="python-code-wrapper" id="python-code-wrapper">
33
+ {% include 'components/python_code_overlay.html' %}
34
+ </div>
@@ -0,0 +1,10 @@
1
+ {# Deck selector component #}
2
+ <div class="input-group mb-3">
3
+ <select class="form-select" name="deck_name" id="deck_name" required onchange="changeDeck(this.value);">
4
+ <option {{ '' if 'pseudo_deck' in session else 'selected' }} disabled hidden style="overflow-wrap: break-word;" name="deck_name" id="deck_name" value=""> -- choose deck --</option>
5
+ {% for connection in history %}
6
+ <option {{ 'selected' if session['pseudo_deck']==connection else '' }} style="overflow-wrap: break-word;" name="deck_name" id="deck_name" value="{{connection}}">{{connection.split('.')[0]}}</option>
7
+ {% endfor %}
8
+ </select>
9
+ </div>
10
+ <hr>
@@ -0,0 +1,38 @@
1
+ {# Edit action form component #}
2
+ <div style="margin-bottom: 1vh;margin-top: 1vh;">
3
+ <a type="button"
4
+ data-get-url="{{ url_for('design.get_operation_sidebar') }}"
5
+ onclick="updateInstrumentPanel(this)">
6
+ <i class="bi bi-arrow-return-left"></i>
7
+ </a>
8
+ </div>
9
+ <h5> {{ action['action'] | format_name }} </h5>
10
+ <form role="form" method='POST' name="{{instrument}}"
11
+ action="{{ url_for('design.design_steps.get_step', uuid=action['uuid']) }}"
12
+ onsubmit="submitEditForm(event); return false;">
13
+ {% if not action['args'] == None %}
14
+ <div class="form-group">
15
+ {% if not action['args'].__class__.__name__ == 'dict' %}
16
+ <div class="input-group mb-3">
17
+ <label class="input-group-text">{{ action['action'] }}</label>
18
+ <input class="form-control" type="text" id="arg" name="arg"
19
+ placeholder="{{ action['arg_types']}}" value="{{ action['args'] }}"
20
+ aria-labelledby="variableHelpBlock">
21
+ </div>
22
+ {% else %}
23
+ {{ forms.hidden_tag() }}
24
+ {% for field in forms %}
25
+ {% if field.type not in ['CSRFTokenField'] %}
26
+ <div class="input-group mb-3">
27
+ <label class="input-group-text">{{ field.label.text }}</label>
28
+ {{ field(class="form-control") }}
29
+ <div class="form-text">{{ field.description }} </div>
30
+ </div>
31
+ {% endif %}
32
+ {% endfor %}
33
+ {% endif %}
34
+ </div>
35
+ {% endif %}
36
+ <button type="submit" class="btn btn-primary">Save</button>
37
+ <button type="button" class="btn btn-primary" id="back">Back</button>
38
+ </form>
@@ -0,0 +1,66 @@
1
+ {# Operations panel component #}
2
+ <div style="margin-bottom: 4vh;"></div>
3
+ <div class="accordion accordion-flush">
4
+ <div class="accordion-item design-control">
5
+ <h5 class="accordion-header">
6
+ <button class="accordion-button" data-bs-toggle="collapse" data-bs-target="#flow" role="button" aria-expanded="false" aria-controls="collapseExample">
7
+ Flow control
8
+ </button>
9
+ </h5>
10
+ <div class="accordion-collapse collapse show" id="flow">
11
+ <ul class="list-group">
12
+ <button class="list-group-item list-group-item-action"
13
+ type="button"
14
+ name="device"
15
+ value="flow_control"
16
+ data-get-url="{{ url_for('design.get_operation_sidebar', instrument='flow_control') }}"
17
+ onclick="updateInstrumentPanel(this)">
18
+ Flow control
19
+ </button>
20
+ </ul>
21
+ </div>
22
+ <h5 class="accordion-header">
23
+ <button class="accordion-button" data-bs-toggle="collapse" data-bs-target="#deck" role="button" aria-expanded="false" aria-controls="collapseExample">
24
+ Instruments
25
+ </button>
26
+ </h5>
27
+ <div class="accordion-collapse collapse show" id="deck">
28
+ <ul class="list-group">
29
+ {% for instrument in defined_variables %}
30
+ <button class="list-group-item list-group-item-action"
31
+ type="button"
32
+ name="device"
33
+ value="{{instrument}}"
34
+ data-get-url="{{ url_for('design.get_operation_sidebar', instrument=instrument) }}"
35
+ onclick="updateInstrumentPanel(this)">
36
+ {{ instrument | format_name }}
37
+ </button>
38
+ {% endfor %}
39
+ </ul>
40
+ </div>
41
+ </div>
42
+
43
+ {% if local_variables %}
44
+ <div class="accordion-item design-control">
45
+ <h5 class="accordion-header">
46
+ <button class="accordion-button" data-bs-toggle="collapse" data-bs-target="#local" role="button" aria-expanded="false" aria-controls="collapseExample">
47
+ Temp instruments
48
+ </button>
49
+ </h5>
50
+ <div class="accordion-collapse collapse show" id="local">
51
+ <ul class="list-group">
52
+ {% for instrument in local_variables %}
53
+ <button class="list-group-item list-group-item-action"
54
+ type="button"
55
+ name="device"
56
+ value="{{instrument}}"
57
+ data-get-url="{{ url_for('design.get_operation_sidebar', instrument=instrument) }}"
58
+ onclick="updateInstrumentPanel(this)">
59
+ {{instrument}}
60
+ </button>
61
+ {% endfor%}
62
+ </ul>
63
+ </div>
64
+ </div>
65
+ {% endif %}
66
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="modal fade" id="dropModal" tabindex="-1" role="dialog">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <h5 class="modal-title" id="dropModalLabel">Configure Action</h5>
6
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
7
+ </div>
8
+ <div class="modal-body">
9
+ <p>Drop Position ID: <strong id="modalDropTarget"></strong></p>
10
+ <div id="modalFormFields"></div>
11
+ </div>
12
+ <div class="modal-footer">
13
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </div>
@@ -0,0 +1,22 @@
1
+ {# JSON import modal component #}
2
+ <div class="modal fade" id="jsonModal" tabindex="-1" aria-labelledby="jsonModal" aria-hidden="true" >
3
+ <div class="modal-dialog">
4
+ <div class="modal-content">
5
+ <div class="modal-header">
6
+ <h1 class="modal-title fs-5" id="jsonModal">Import from JSON</h1>
7
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
8
+ </div>
9
+ <form method="POST" action="{{ url_for('design.design_files.load_json') }}" enctype="multipart/form-data">
10
+ <div class="modal-body">
11
+ <div class="input-group mb-3">
12
+ <input class="form-control" type="file" name="file" required="required">
13
+ </div>
14
+ </div>
15
+ <div class="modal-footer">
16
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
17
+ <button type="submit" class="btn btn-primary"> Upload </button>
18
+ </div>
19
+ </form>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,17 @@
1
+ {# New script modal component #}
2
+ <div class="modal fade" id="newScriptModal" tabindex="-1" aria-labelledby="newScriptModalLabel" aria-hidden="true">
3
+ <div class="modal-dialog">
4
+ <div class="modal-content">
5
+ <div class="modal-header">
6
+ <h1 class="modal-title fs-5" id="newScriptModalLabel">Save your current editing!</h1>
7
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
8
+ </div>
9
+ <div class="modal-body">
10
+ The current editing won't be saved. Are you sure you want to proceed?
11
+ </div>
12
+ <div class="modal-footer">
13
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Continue editing </button>
14
+ <button class="btn btn-danger" onclick="clearDraft()">Already saved, clear all</button> </div>
15
+ </div>
16
+ </div>
17
+ </div>
@@ -0,0 +1,23 @@
1
+ {# Rename modal component #}
2
+ <div class="modal fade" id="renameModal" tabindex="-1" aria-labelledby="renameModal" aria-hidden="true" >
3
+ <div class="modal-dialog">
4
+ <div class="modal-content">
5
+ <div class="modal-header">
6
+ <h1 class="modal-title fs-5" id="renameModal">Rename your script</h1>
7
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
8
+ </div>
9
+ <form name="run_name" onsubmit="editScriptName(event)">
10
+ <div class="modal-body">
11
+ <div class="input-group mb-3">
12
+ <label class="input-group-text" for="new-name">Run Name</label>
13
+ <input class="form-control" type="text" name="new-name" id="new-name" value="{{ script['name'] }}" required="required">
14
+ </div>
15
+ </div>
16
+ <div class="modal-footer">
17
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
18
+ <button type="submit" class="btn btn-primary"> Save</button>
19
+ </div>
20
+ </form>
21
+ </div>
22
+ </div>
23
+ </div>