2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2009-07-16 00:50:27 +00:00
|
|
|
import bpy
|
2011-09-22 19:50:41 +00:00
|
|
|
from bpy.types import Header, Menu
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class CONSOLE_HT_header(Header):
|
2009-10-31 13:31:23 +00:00
|
|
|
bl_space_type = 'CONSOLE'
|
2009-10-29 20:55:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2012-12-09 05:18:56 +00:00
|
|
|
layout = self.layout.row()
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2011-08-13 17:52:13 +00:00
|
|
|
layout.template_header()
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2014-01-27 07:38:53 +00:00
|
|
|
CONSOLE_MT_editor_menus.draw_collapsible(context, layout)
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2011-09-21 15:18:38 +00:00
|
|
|
layout.operator("console.autocomplete", text="Autocomplete")
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2014-01-27 07:38:53 +00:00
|
|
|
class CONSOLE_MT_editor_menus(Menu):
|
|
|
|
bl_idname = "CONSOLE_MT_editor_menus"
|
|
|
|
bl_label = ""
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
self.draw_menus(self.layout, context)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def draw_menus(layout, context):
|
|
|
|
layout.menu("CONSOLE_MT_console")
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class CONSOLE_MT_console(Menu):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Console"
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2009-10-29 20:55:45 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2011-08-22 09:01:49 +00:00
|
|
|
|
2012-06-04 07:24:19 +00:00
|
|
|
layout.operator("console.indent")
|
|
|
|
layout.operator("console.unindent")
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("console.clear")
|
2012-05-09 14:58:57 +00:00
|
|
|
layout.operator("console.clear_line")
|
2012-06-04 07:24:19 +00:00
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
|
2012-08-19 21:32:18 +00:00
|
|
|
layout.operator("console.copy_as_script")
|
2009-11-23 00:27:30 +00:00
|
|
|
layout.operator("console.copy")
|
|
|
|
layout.operator("console.paste")
|
|
|
|
layout.menu("CONSOLE_MT_language")
|
2009-12-04 17:54:48 +00:00
|
|
|
|
2009-12-03 16:28:50 +00:00
|
|
|
layout.separator()
|
2009-12-04 17:54:48 +00:00
|
|
|
|
2009-12-03 16:28:50 +00:00
|
|
|
layout.operator("screen.area_dupli")
|
2014-10-14 18:05:44 +00:00
|
|
|
layout.operator("screen.screen_full_area", text="Toggle Maximize Area")
|
|
|
|
layout.operator("screen.screen_full_area").use_hide_panels = True
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2009-12-04 17:54:48 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class CONSOLE_MT_language(Menu):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Languages..."
|
2009-11-06 23:53:40 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2009-11-17 12:21:41 +00:00
|
|
|
import sys
|
2009-11-21 00:05:43 +00:00
|
|
|
|
2009-11-06 23:53:40 +00:00
|
|
|
layout = self.layout
|
|
|
|
layout.column()
|
2009-11-07 22:07:46 +00:00
|
|
|
|
2009-11-17 12:21:41 +00:00
|
|
|
# Collect modules with 'console_*.execute'
|
2009-11-06 23:53:40 +00:00
|
|
|
languages = []
|
2009-11-17 12:21:41 +00:00
|
|
|
for modname, mod in sys.modules.items():
|
|
|
|
if modname.startswith("console_") and hasattr(mod, "execute"):
|
2012-07-04 21:41:05 +00:00
|
|
|
languages.append(modname.split("_", 1)[-1])
|
2009-11-07 22:07:46 +00:00
|
|
|
|
2009-11-06 23:53:40 +00:00
|
|
|
languages.sort()
|
2009-11-07 22:07:46 +00:00
|
|
|
|
2009-11-06 23:53:40 +00:00
|
|
|
for language in languages:
|
2013-02-08 16:41:02 +00:00
|
|
|
layout.operator("console.language",
|
|
|
|
text=language.title(),
|
|
|
|
translate=False).language = language
|
2009-07-19 00:49:44 +00:00
|
|
|
|
2009-11-14 13:35:44 +00:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
def add_scrollback(text, text_type):
|
2012-07-04 21:41:05 +00:00
|
|
|
for l in text.split("\n"):
|
2013-04-20 13:23:53 +00:00
|
|
|
bpy.ops.console.scrollback_append(text=l.expandtabs(4),
|
2012-10-08 08:28:05 +00:00
|
|
|
type=text_type)
|
2009-10-29 20:55:45 +00:00
|
|
|
|
2011-04-04 10:13:04 +00:00
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
bpy.utils.register_module(__name__)
|