Skip to content

Commit 448f925

Browse files
feat(ui): optimize node parameter defaults and text handling
* Restrict default parameter enablement to the first valid parameter of each node. * Ensure `text` and `tex_strings` parameters are always enabled and unescaped by default. * Force `text` and `tex_strings` to use string input boxes, overriding numeric type detection. * Update LaTeX helper to apply unescaped formatting when injecting code into nodes.
1 parent d6faeeb commit 448f925

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from PySide6.QtCore import QObject, QSettings, QStandardPaths, Signal
1010

1111
APP_NAME = "EfficientManim"
12-
APP_VERSION = "2.3.0"
12+
APP_VERSION = "2.3.1"
1313
PROJECT_EXT = ".efp" # EfficientManim Project (Zip)
1414
LIGHT_MODE = True
1515

ui/panels/node_panel.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def apply_to_node(self):
401401
node.data.params[target_param] = formatted_code
402402

403403
# Configure Metadata
404-
node.data.set_escape_string(target_param, True)
404+
node.data.set_escape_string(target_param, False)
405405
node.data.set_param_enabled(target_param, True)
406406

407407
node.update()
@@ -581,6 +581,7 @@ def set_node(self, node_item: "NodeItem | None"):
581581
node_item.node_data.params[param_name] = default_val
582582

583583
# Create Rows
584+
first_param = True
584585
for name, param in sig.parameters.items():
585586
if name in ["self", "args", "kwargs", "mobject"]:
586587
continue
@@ -590,11 +591,17 @@ def set_node(self, node_item: "NodeItem | None"):
590591
if val is inspect.Parameter.empty:
591592
val = None
592593

593-
# FIX: Disable 'tex_strings' by default if not explicitly set
594-
if name == "tex_strings":
595-
# Only disable if it wasn't manually enabled by user previously
596-
if name not in node_item.node_data.param_metadata:
597-
node_item.node_data.set_param_enabled(name, False)
594+
# Handle default enablement and escaping
595+
if name not in node_item.node_data.param_metadata:
596+
if name in ("tex_strings", "text"):
597+
node_item.node_data.set_param_enabled(name, True)
598+
# Ensure these are NOT escaped by default
599+
node_item.node_data.set_escape_string(name, False)
600+
else:
601+
node_item.node_data.set_param_enabled(name, first_param)
602+
603+
# Mark that we've processed the first valid parameter
604+
first_param = False
598605

599606
row_widget = self.create_parameter_row(name, val, param.annotation)
600607
# FIX: Actually add the row to the form layout
@@ -787,7 +794,12 @@ def pick_color():
787794
return btn
788795

789796
# 4. NUMERIC
790-
if TypeSafeParser.is_numeric_param(key) or annotation in (float, int):
797+
is_numeric = TypeSafeParser.is_numeric_param(key) or annotation in (float, int)
798+
# EXCEPTION: 'text' and 'tex_strings' must ALWAYS be treated as strings, never numeric
799+
if key in ("text", "tex_strings"):
800+
is_numeric = False
801+
802+
if is_numeric:
791803
# ... (Keep existing numeric logic) ...
792804
if annotation is float or isinstance(value, float):
793805
sb = QDoubleSpinBox()

0 commit comments

Comments
 (0)