setta 0.0.13__py3-none-any.whl → 0.0.14__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.
- setta/__init__.py +1 -1
- setta/code_gen/export_selected.py +8 -1
- setta/database/export_db/export_readable.py +6 -6
- setta/routers/interactive.py +24 -6
- setta/static/constants/Settings.json +1 -0
- setta/static/constants/constants.json +1 -0
- setta/static/constants/defaultValues.json +0 -1
- setta/static/frontend/assets/index-DG_u-B1j.css +32 -0
- setta/static/frontend/assets/{index-BXPxPFVr.js → index-Dt5OgkJW.js} +181 -181
- setta/static/frontend/index.html +2 -2
- setta/tasks/tasks.py +128 -40
- setta/tasks/utils.py +28 -8
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/METADATA +6 -16
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/RECORD +18 -18
- setta/static/frontend/assets/index-xJaZMJy2.css +0 -32
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/LICENSE +0 -0
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/WHEEL +0 -0
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/entry_points.txt +0 -0
- {setta-0.0.13.dist-info → setta-0.0.14.dist-info}/top_level.txt +0 -0
setta/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.0.
|
1
|
+
__version__ = "0.0.14"
|
@@ -554,6 +554,7 @@ class ExporterForInMemoryFn:
|
|
554
554
|
C.DRAW,
|
555
555
|
C.CHAT,
|
556
556
|
C.GLOBAL_VARIABLES,
|
557
|
+
C.TEXT_BLOCK,
|
557
558
|
],
|
558
559
|
)
|
559
560
|
for id in list(self.p["projectConfig"]["children"].keys()):
|
@@ -594,7 +595,9 @@ class ExporterForInMemoryFn:
|
|
594
595
|
value = {"image": img}
|
595
596
|
self.create_var_mapping((id, "image"), f'{name}["image"]')
|
596
597
|
elif type == C.DRAW:
|
597
|
-
value = {
|
598
|
+
value = {
|
599
|
+
"drawing": get_drawing(self.p, id),
|
600
|
+
}
|
598
601
|
self.create_var_mapping((id, "drawing"), f'{name}["drawing"]')
|
599
602
|
elif type == C.CHAT:
|
600
603
|
latestChatMessage = get_chat_message(self.p, id)
|
@@ -608,6 +611,10 @@ class ExporterForInMemoryFn:
|
|
608
611
|
elif type == C.GLOBAL_VARIABLES:
|
609
612
|
self.output.update(self.export_section_params(id, "", is_global=True))
|
610
613
|
value_is_returned = False
|
614
|
+
elif type == C.TEXT_BLOCK:
|
615
|
+
variant = get_selected_section_variant(self.p, id)
|
616
|
+
value = {"text": variant["description"]}
|
617
|
+
self.create_var_mapping((id, "text"), f'{name}["text"]')
|
611
618
|
else:
|
612
619
|
raise ValueError
|
613
620
|
return value, value_is_returned
|
@@ -232,11 +232,11 @@ def get_exporter_fn(config, section_id):
|
|
232
232
|
return export_param_sweep_section
|
233
233
|
elif stype == C.GLOBAL_PARAM_SWEEP:
|
234
234
|
return export_global_param_sweep_section
|
235
|
-
elif stype == C.DRAW:
|
236
|
-
|
237
|
-
elif stype == C.IMAGE:
|
238
|
-
|
235
|
+
# elif stype == C.DRAW:
|
236
|
+
# return export_canvas_rendered_value
|
237
|
+
# elif stype == C.IMAGE:
|
238
|
+
# return export_image_section
|
239
239
|
elif stype == C.SOCIAL:
|
240
240
|
return export_social_section
|
241
|
-
elif stype == C.CHART:
|
242
|
-
|
241
|
+
# elif stype == C.CHART:
|
242
|
+
# return export_canvas_rendered_value
|
setta/routers/interactive.py
CHANGED
@@ -18,6 +18,7 @@ from setta.code_gen.export_selected import (
|
|
18
18
|
)
|
19
19
|
from setta.code_gen.find_placeholders import parse_template_var
|
20
20
|
from setta.tasks.fns.utils import replace_template_vars_with_random_names
|
21
|
+
from setta.tasks.tasks import construct_subprocess_key
|
21
22
|
from setta.utils.constants import C
|
22
23
|
from setta.utils.utils import multireplace
|
23
24
|
|
@@ -35,6 +36,22 @@ class FormatCodeRequest(BaseModel):
|
|
35
36
|
candidateTemplateVars: dict
|
36
37
|
|
37
38
|
|
39
|
+
@router.post(C.ROUTE_SEND_PROJECT_TO_INTERACTIVE_CODE)
|
40
|
+
async def route_send_project_to_interactive_code(
|
41
|
+
x: UpdateInteractiveCodeRequest,
|
42
|
+
tasks=Depends(get_tasks),
|
43
|
+
):
|
44
|
+
to_run = []
|
45
|
+
for idx, p in enumerate(x.projects):
|
46
|
+
exporter_obj_in_memory = export_for_in_memory_fn(p)
|
47
|
+
to_run.append(
|
48
|
+
tasks.call_in_memory_subprocess_fn_with_new_exporter_obj(
|
49
|
+
p["projectConfig"]["id"], idx, exporter_obj_in_memory
|
50
|
+
)
|
51
|
+
)
|
52
|
+
return await process_returned_content_from_multiple_tasks(tasks, to_run)
|
53
|
+
|
54
|
+
|
38
55
|
@router.post(C.ROUTE_UPDATE_INTERACTIVE_CODE)
|
39
56
|
async def route_update_interactive_code(
|
40
57
|
x: UpdateInteractiveCodeRequest,
|
@@ -46,13 +63,12 @@ async def route_update_interactive_code(
|
|
46
63
|
update_interactive_code(p, tasks, lsp_writers, idx)
|
47
64
|
for idx, p in enumerate(x.projects)
|
48
65
|
]
|
66
|
+
return await process_returned_content_from_multiple_tasks(tasks, update_tasks)
|
49
67
|
|
50
|
-
# Run all updates in parallel and gather results
|
51
|
-
all_content = await asyncio.gather(*update_tasks)
|
52
68
|
|
53
|
-
|
69
|
+
async def process_returned_content_from_multiple_tasks(tasks, to_run):
|
70
|
+
all_content = await asyncio.gather(*to_run)
|
54
71
|
content = [item for sublist in all_content for item in sublist]
|
55
|
-
|
56
72
|
inMemorySubprocessInfo = tasks.getInMemorySubprocessInfo()
|
57
73
|
return {"inMemorySubprocessInfo": inMemorySubprocessInfo, "content": content}
|
58
74
|
|
@@ -106,7 +122,9 @@ async def update_interactive_code(p, tasks, lsp_writers, idx):
|
|
106
122
|
code_graph.append(
|
107
123
|
{
|
108
124
|
"imports": imports,
|
109
|
-
"subprocess_key":
|
125
|
+
"subprocess_key": construct_subprocess_key(
|
126
|
+
project_config_id, section_id, idx
|
127
|
+
),
|
110
128
|
"subprocessStartMethod": p["sections"][section_id][
|
111
129
|
"subprocessStartMethod"
|
112
130
|
],
|
@@ -115,7 +133,7 @@ async def update_interactive_code(p, tasks, lsp_writers, idx):
|
|
115
133
|
|
116
134
|
initialContent = await tasks.add_custom_fns(
|
117
135
|
code_graph,
|
118
|
-
|
136
|
+
exporter_obj=exporter_obj_in_memory,
|
119
137
|
)
|
120
138
|
|
121
139
|
return initialContent
|
@@ -42,6 +42,7 @@
|
|
42
42
|
"showProjectOverviewTabShortcut": "O",
|
43
43
|
"runCodeShortcut": "Mod + Enter",
|
44
44
|
"runAllCodeShortcut": "Mod + Shift + Enter",
|
45
|
+
"sendProjectToAllInteractiveCode": "Alt + I",
|
45
46
|
"paramSelect": "Mod + Shift",
|
46
47
|
"formatCode": "Shift + Alt + F",
|
47
48
|
"selectionKeyCode": "Shift",
|
@@ -70,6 +70,7 @@
|
|
70
70
|
"ROUTE_SAVE_CODE_INFO": "/codeInfo/save",
|
71
71
|
"ROUTE_COPY_SECTIONS": "/copySections",
|
72
72
|
"ROUTE_UPDATE_INTERACTIVE_CODE": "/updateInteractiveCode",
|
73
|
+
"ROUTE_SEND_PROJECT_TO_INTERACTIVE_CODE": "/sendProjectTointeractiveCode",
|
73
74
|
"ROUTE_FORMAT_CODE": "/formatCode",
|
74
75
|
"ROUTE_SEND_ARTIFACT": "/sendArtfiact",
|
75
76
|
"ROUTE_LOAD_ARTIFACTS": "/loadArtifacts",
|