if (BPY_run_python_script( C, NULL, text ))
return OPERATOR_FINISHED;
- BKE_report(op->reports, RPT_ERROR, "Python script fail, look in the console for now...");
+ /* Dont report error messages while live editing */
+ if(!CTX_wm_space_text(C)->live_edit)
+ BKE_report(op->reports, RPT_ERROR, "Python script fail, look in the console for now...");
+
return OPERATOR_CANCELLED;
#endif
}
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ /* run the script while editing, evil but useful */
+ if(CTX_wm_space_text(C)->live_edit)
+ run_script_exec(C, op);
+
return OPERATOR_FINISHED;
}
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ /* run the script while editing, evil but useful */
+ if(CTX_wm_space_text(C)->live_edit)
+ run_script_exec(C, op);
+
return OPERATOR_FINISHED;
}
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ /* run the script while editing, evil but useful */
+ if(CTX_wm_space_text(C)->live_edit)
+ run_script_exec(C, op);
+
return OPERATOR_FINISHED;
}
static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
char str[2];
-
+ int ret;
/* XXX old code from winqreadtextspace, is it still needed somewhere? */
/* smartass code to prevent the CTRL/ALT events below from not working! */
/*if(qual & (LR_ALTKEY|LR_CTRLKEY))
str[1]= '\0';
RNA_string_set(op->ptr, "text", str);
-
- return insert_exec(C, op);
+ ret = insert_exec(C, op);
+
+ /* run the script while editing, evil but useful */
+ if(ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
+ run_script_exec(C, op);
+
+ return ret;
}
void TEXT_OT_insert(wmOperatorType *ot)
prop= RNA_def_property(srna, "overwrite", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them.");
RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "live_edit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing.");
prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "tabnumber");