[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56992] trunk/blender: disable auto indent when pasting text into the python console.
Campbell Barton
ideasman42 at gmail.com
Fri May 24 03:04:39 CEST 2013
Revision: 56992
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56992
Author: campbellbarton
Date: 2013-05-24 01:04:37 +0000 (Fri, 24 May 2013)
Log Message:
-----------
disable auto indent when pasting text into the python console.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/console_python.py
trunk/blender/release/scripts/startup/bl_operators/console.py
trunk/blender/source/blender/editors/space_console/space_console.c
Modified: trunk/blender/release/scripts/modules/console_python.py
===================================================================
--- trunk/blender/release/scripts/modules/console_python.py 2013-05-24 00:30:22 UTC (rev 56991)
+++ trunk/blender/release/scripts/modules/console_python.py 2013-05-24 01:04:37 UTC (rev 56992)
@@ -126,7 +126,7 @@
PROMPT_MULTI = '... '
-def execute(context):
+def execute(context, is_interactive):
sc = context.space_data
try:
@@ -190,9 +190,12 @@
if is_multiline:
sc.prompt = PROMPT_MULTI
- indent = line[:len(line) - len(line.lstrip())]
- if line.rstrip().endswith(":"):
- indent += " "
+ if is_interactive:
+ indent = line[:len(line) - len(line.lstrip())]
+ if line.rstrip().endswith(":"):
+ indent += " "
+ else:
+ indent = ""
else:
sc.prompt = PROMPT
indent = ""
Modified: trunk/blender/release/scripts/startup/bl_operators/console.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/console.py 2013-05-24 00:30:22 UTC (rev 56991)
+++ trunk/blender/release/scripts/startup/bl_operators/console.py 2013-05-24 01:04:37 UTC (rev 56992)
@@ -20,7 +20,9 @@
import bpy
from bpy.types import Operator
-from bpy.props import StringProperty
+from bpy.props import (BoolProperty,
+ StringProperty,
+ )
def _lang_module_get(sc):
@@ -34,6 +36,10 @@
bl_idname = "console.execute"
bl_label = "Console Execute"
+ interactive = BoolProperty(
+ options={'SKIP_SAVE'},
+ )
+
@classmethod
def poll(cls, context):
return (context.area and context.area.type == 'CONSOLE')
@@ -44,8 +50,8 @@
module = _lang_module_get(sc)
execute = getattr(module, "execute", None)
- if execute:
- return execute(context)
+ if execute is not None:
+ return execute(context, self.interactive)
else:
print("Error: bpy.ops.console.execute_%s - not found" %
sc.language)
Modified: trunk/blender/source/blender/editors/space_console/space_console.c
===================================================================
--- trunk/blender/source/blender/editors/space_console/space_console.c 2013-05-24 00:30:22 UTC (rev 56991)
+++ trunk/blender/source/blender/editors/space_console/space_console.c 2013-05-24 01:04:37 UTC (rev 56992)
@@ -319,8 +319,10 @@
WM_keymap_add_item(keymap, "CONSOLE_OT_clear_line", RETKEY, KM_PRESS, KM_SHIFT, 0);
#ifdef WITH_PYTHON
- WM_keymap_add_item(keymap, "CONSOLE_OT_execute", RETKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
- WM_keymap_add_item(keymap, "CONSOLE_OT_execute", PADENTER, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_execute", RETKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "interactive", true);
+ kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_execute", PADENTER, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "interactive", true);
//WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", TABKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */
More information about the Bf-blender-cvs
mailing list