From d739a1788d338795039530c2d6503b93ab805161 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Aug 2010 05:21:43 +0000 Subject: small edits to text editor from writing a python editor extension. - rename TextLine.line -> body, ConsoleLine.line -> body - minor speedups when setting the body text, also re-allocate console lines if they are < half the length. - added option to highlight current line in the text editor. --- release/scripts/modules/bpy_types.py | 2 +- release/scripts/op/console_python.py | 10 +++++----- release/scripts/op/console_shell.py | 2 +- release/scripts/ui/space_text.py | 13 +++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 0cd0aaaa3f0..0a796793d01 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -525,7 +525,7 @@ class Text(bpy_types.ID): def as_string(self): """Return the text as a string.""" - return "\n".join(line.line for line in self.lines) + return "\n".join(line.body for line in self.lines) def from_string(self, string): """Replace text with this string.""" diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py index cc0f3673e5c..918c31cff04 100644 --- a/release/scripts/op/console_python.py +++ b/release/scripts/op/console_python.py @@ -131,7 +131,7 @@ def execute(context): is_multiline = False try: - line = line_object.line + line = line_object.body # run the console, "\n" executes a multiline statement line_exec = line if line.strip() else "\n" @@ -212,13 +212,13 @@ def autocomplete(context): try: current_line = sc.history[-1] - line = current_line.line + line = current_line.body # This function isnt aware of the text editor or being an operator # just does the autocomp then copy its results back - current_line.line, current_line.current_character, scrollback = \ + current_line.body, current_line.current_character, scrollback = \ intellisense.expand( - line=current_line.line, + line=current_line.body, cursor=current_line.current_character, namespace=console.locals, private=bpy.app.debug) @@ -233,7 +233,7 @@ def autocomplete(context): # Separate automplete output by command prompts if scrollback != '': - bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT') + bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT') # Now we need to copy back the line from blender back into the # text editor. This will change when we dont use the text editor diff --git a/release/scripts/op/console_shell.py b/release/scripts/op/console_shell.py index e269cc0bb2f..2c5b48acd34 100644 --- a/release/scripts/op/console_shell.py +++ b/release/scripts/op/console_shell.py @@ -47,7 +47,7 @@ def execute(context): sc = context.space_data try: - line = sc.history[-1].line + line = sc.history[-1].body except: return {'CANCELLED'} diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 71ab6540132..d9fce39fee8 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -48,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header): layout.template_ID(st, "text", new="text.new", unlink="text.unlink") row = layout.row(align=True) - row.prop(st, "line_numbers", text="") - row.prop(st, "word_wrap", text="") - row.prop(st, "syntax_highlight", text="") + row.prop(st, "show_line_numbers", text="") + row.prop(st, "show_word_wrap", text="") + row.prop(st, "show_syntax_highlight", text="") if text: row = layout.row() @@ -81,9 +81,10 @@ class TEXT_PT_properties(bpy.types.Panel): st = context.space_data flow = layout.column_flow() - flow.prop(st, "line_numbers") - flow.prop(st, "word_wrap") - flow.prop(st, "syntax_highlight") + flow.prop(st, "show_line_numbers") + flow.prop(st, "show_word_wrap") + flow.prop(st, "show_syntax_highlight") + flow.prop(st, "show_line_highlight") flow.prop(st, "live_edit") flow = layout.column_flow() -- cgit v1.2.3