@danhachuel/thunderbolt 0.2.96 → 0.2.98
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.
- package/app/main.py +23 -6
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -244,6 +244,14 @@ _OPTION_TRANSLATED_STREAMLIT_METHODS = {"selectbox", "radio", "multiselect", "se
|
|
|
244
244
|
_STREAMLIT_I18N_INSTALLED = False
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
def _translated_option_label(value: Any, selected_language: str, formatter: Any = None) -> str:
|
|
248
|
+
"""Return a valid Streamlit display label without changing the stored option value."""
|
|
249
|
+
formatted = formatter(value) if formatter is not None else value
|
|
250
|
+
if isinstance(formatted, str):
|
|
251
|
+
return ui_text(formatted, selected_language)
|
|
252
|
+
return str(formatted)
|
|
253
|
+
|
|
254
|
+
|
|
247
255
|
def _translate_streamlit_arguments(method_name: str, args: tuple[Any, ...], kwargs: dict[str, Any]) -> tuple[tuple[Any, ...], dict[str, Any]]:
|
|
248
256
|
if not args and "label" not in kwargs:
|
|
249
257
|
return args, kwargs
|
|
@@ -256,12 +264,13 @@ def _translate_streamlit_arguments(method_name: str, args: tuple[Any, ...], kwar
|
|
|
256
264
|
for keyword in ("placeholder", "help"):
|
|
257
265
|
if isinstance(kwargs.get(keyword), str):
|
|
258
266
|
kwargs[keyword] = ui_text(kwargs[keyword], selected_language)
|
|
259
|
-
|
|
267
|
+
has_options = len(translated_args) >= 2 or "options" in kwargs
|
|
268
|
+
if method_name in _OPTION_TRANSLATED_STREAMLIT_METHODS and has_options:
|
|
260
269
|
existing_format_func = kwargs.get("format_func")
|
|
261
270
|
if existing_format_func is None:
|
|
262
|
-
kwargs["format_func"] = lambda value
|
|
271
|
+
kwargs["format_func"] = lambda value, language=selected_language: _translated_option_label(value, language)
|
|
263
272
|
else:
|
|
264
|
-
kwargs["format_func"] = lambda value, formatter=existing_format_func
|
|
273
|
+
kwargs["format_func"] = lambda value, formatter=existing_format_func, language=selected_language: _translated_option_label(value, language, formatter)
|
|
265
274
|
return tuple(translated_args), kwargs
|
|
266
275
|
|
|
267
276
|
|
|
@@ -2827,7 +2836,7 @@ def render_automation():
|
|
|
2827
2836
|
st.info("Ainda não existem vídeos cadastrados.")
|
|
2828
2837
|
for task in tasks:
|
|
2829
2838
|
with st.container(border=True):
|
|
2830
|
-
task_cols = st.columns([2.
|
|
2839
|
+
task_cols = st.columns([2.45, 1.15, 1.15, 1.85])
|
|
2831
2840
|
with task_cols[0]:
|
|
2832
2841
|
st.write(f"**{task.get('topic', 'Sem tópico')}**")
|
|
2833
2842
|
st.caption(f"{task.get('channel_name', 'Canal')} · {task.get('id', '')}")
|
|
@@ -2838,8 +2847,16 @@ def render_automation():
|
|
|
2838
2847
|
st.caption("Estilo")
|
|
2839
2848
|
st.write(task.get("style_wide", "—"))
|
|
2840
2849
|
with task_cols[3]:
|
|
2841
|
-
|
|
2842
|
-
st.
|
|
2850
|
+
state = str(task.get("state") or "")
|
|
2851
|
+
start_col, stop_col = st.columns(2)
|
|
2852
|
+
with start_col:
|
|
2853
|
+
if st.button("Start", key=f"automation_start_{task['id']}", use_container_width=True, disabled=state not in {"to_do", "blocked", "failed"}):
|
|
2854
|
+
transition_task(task["id"], "doing")
|
|
2855
|
+
st.rerun()
|
|
2856
|
+
with stop_col:
|
|
2857
|
+
if st.button("Stop", key=f"automation_stop_{task['id']}", use_container_width=True, disabled=state != "doing"):
|
|
2858
|
+
transition_task(task["id"], "blocked")
|
|
2859
|
+
st.rerun()
|
|
2843
2860
|
|
|
2844
2861
|
|
|
2845
2862
|
def render_upload_direct():
|
package/package.json
CHANGED