diff options
author | Ian Thompson <quornian@googlemail.com> | 2008-08-09 22:11:40 +0400 |
---|---|---|
committer | Ian Thompson <quornian@googlemail.com> | 2008-08-09 22:11:40 +0400 |
commit | 83bcb9deffb5eef2cbbb883c21f700840175d3fc (patch) | |
tree | 608a86dcbfc124ec5b8d18d357088be7b0079b24 /source/blender/src/drawtext.c | |
parent | 4c89ee7838c3162bca9045db857593b05fb42419 (diff) |
Python errors originating in the active text are now displayed at the top of the text area. Errors in other files/scripts still pop up a message as before and all errors are still printed to the console. This removes the need to switch to the console for local errors.
Diffstat (limited to 'source/blender/src/drawtext.c')
-rw-r--r-- | source/blender/src/drawtext.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c index ccb5767d7e7..bc30a52f126 100644 --- a/source/blender/src/drawtext.c +++ b/source/blender/src/drawtext.c @@ -2014,6 +2014,18 @@ void txt_find_panel(SpaceText *st, int again, int flags) } } +static void txt_print_error(SpaceText *st, char* str) +{ + if (curarea->spacetype != SPACE_TEXT) return; + drawtextspace(curarea, st); + glColor3ub(128, 16, 16); + glRecti(22, curarea->winy-2, curarea->winx-2, curarea->winy-st->lheight-3); + glColor3ub(255, 32, 32); + glRasterPos2i(22, curarea->winy-st->lheight); + BMF_DrawString(spacetext_get_font(st), str); + curarea->win_swap= WIN_BACK_OK; +} + void run_python_script(SpaceText *st) { char *py_filename; @@ -2029,16 +2041,17 @@ void run_python_script(SpaceText *st) if (!st->text) return; if (!strcmp(py_filename, st->text->id.name+2)) { - error_pyscript( ); + //error_pyscript( ); if (lineno >= 0) { txt_move_toline(text, lineno-1, 0); txt_sel_line(text); pop_space_text(st); - } + } + txt_print_error(st, BPY_Err_getMessage()); } else { error("Error in other (possibly external) file, "\ "check console"); - } + } } } @@ -2862,7 +2875,6 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case PKEY: if (G.qual == LR_ALTKEY) { run_python_script(st); - do_draw= 1; } break; /* BREAK P */ case QKEY: |