diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-15 18:51:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-15 18:51:37 +0400 |
commit | bab7b47a719b0660666d60b48a7a87e2347bbf75 (patch) | |
tree | 6257ab1f55530ddf2d3bec44ab3e0dac82223183 /release/scripts | |
parent | 20a37ba8f87f2d68a509f75c87bcdf61cb607278 (diff) |
code cleanup: minor edits, use function for getting console module.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_operators/console.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py index 8afcdf5f67e..099cb02564d 100644 --- a/release/scripts/startup/bl_operators/console.py +++ b/release/scripts/startup/bl_operators/console.py @@ -23,15 +23,19 @@ from bpy.types import Operator from bpy.props import StringProperty +def _lang_module_get(sc): + return __import__("console_" + sc.language) + + class ConsoleExec(Operator): - '''Execute the current console line as a python expression''' + """Execute the current console line as a python expression""" bl_idname = "console.execute" bl_label = "Console Execute" def execute(self, context): sc = context.space_data - module = __import__("console_" + sc.language) + module = _lang_module_get(sc) execute = getattr(module, "execute", None) if execute: @@ -50,7 +54,7 @@ class ConsoleAutocomplete(Operator): def execute(self, context): sc = context.space_data - module = __import__("console_" + sc.language) + module = _lang_module_get(sc) autocomplete = getattr(module, "autocomplete", None) if autocomplete: @@ -62,7 +66,7 @@ class ConsoleAutocomplete(Operator): class ConsoleBanner(Operator): - '''Print a message when the terminal initializes''' + """Print a message when the terminal initializes""" bl_idname = "console.banner" bl_label = "Console Banner" @@ -73,7 +77,7 @@ class ConsoleBanner(Operator): if not sc.language: sc.language = 'python' - module = __import__("console_" + sc.language) + module = _lang_module_get(sc) banner = getattr(module, "banner", None) if banner: @@ -85,7 +89,7 @@ class ConsoleBanner(Operator): class ConsoleLanguage(Operator): - '''Set the current language for this console''' + """Set the current language for this console""" bl_idname = "console.language" bl_label = "Console Language" |