UI: expand on console menus
authorCampbell Barton <ideasman42@gmail.com>
Fri, 9 Aug 2019 09:05:15 +0000 (19:05 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 9 Aug 2019 09:16:35 +0000 (19:16 +1000)
Some features weren't exposed anywhere in the interface.

D5443 by @tintwotin

release/scripts/startup/bl_ui/space_console.py
source/blender/editors/space_console/console_ops.c

index 2e1d0fd2eba7ff9c9c50455f6e78183532ea91ba..071c6959db4aee360e7c2c720cc23dd19f2a74b1 100644 (file)
@@ -31,8 +31,6 @@ class CONSOLE_HT_header(Header):
 
         CONSOLE_MT_editor_menus.draw_collapsible(context, layout)
 
-        layout.operator("console.autocomplete", text="Autocomplete")
-
 
 class CONSOLE_MT_editor_menus(Menu):
     bl_idname = "CONSOLE_MT_editor_menus"
@@ -40,28 +38,32 @@ class CONSOLE_MT_editor_menus(Menu):
 
     def draw(self, _context):
         layout = self.layout
+        layout.menu("CONSOLE_MT_view")
         layout.menu("CONSOLE_MT_console")
 
 
-class CONSOLE_MT_console(Menu):
-    bl_label = "Console"
+class CONSOLE_MT_view(Menu):
+    bl_label = "View"
 
     def draw(self, _context):
         layout = self.layout
 
-        layout.operator("console.indent")
-        layout.operator("console.unindent")
+        props = layout.operator("wm.context_cycle_int", text="Zoom In")
+        props.data_path = 'space_data.font_size'
+        props.reverse = False
+        props = layout.operator("wm.context_cycle_int", text="Zoom Out")
+        props.data_path = 'space_data.font_size'
+        props.reverse = True
 
         layout.separator()
 
-        layout.operator("console.clear")
-        layout.operator("console.clear_line")
+        layout.operator("console.move", text="Move to Previous Word").type = 'PREVIOUS_WORD'
+        layout.operator("console.move", text="Move to Next Word").type = 'NEXT_WORD'
+        layout.operator("console.move", text="Move to Line Begin").type = 'LINE_BEGIN'
+        layout.operator("console.move", text="Move to Line End").type = 'LINE_END'
 
         layout.separator()
 
-        layout.operator("console.copy_as_script")
-        layout.operator("console.copy")
-        layout.operator("console.paste")
         layout.menu("CONSOLE_MT_language")
 
         layout.separator()
@@ -92,17 +94,49 @@ class CONSOLE_MT_language(Menu):
                             translate=False).language = language
 
 
+class CONSOLE_MT_console(Menu):
+    bl_label = "Console"
+
+    def draw(self, _context):
+        layout = self.layout
+
+        layout.operator("console.clear")
+        layout.operator("console.clear_line")
+        layout.operator("console.delete", text="Delete Previous Word").type = 'PREVIOUS_WORD'
+        layout.operator("console.delete", text="Delete Next Word").type = 'NEXT_WORD'
+
+        layout.separator()
+
+        layout.operator("console.copy_as_script", text="Copy as Script")
+        layout.operator("console.copy", text="Copy")
+        layout.operator("console.paste", text="Paste")
+
+        layout.separator()
+
+        layout.operator("console.indent")
+        layout.operator("console.unindent")
+
+        layout.separator()
+
+        layout.operator("console.history_cycle", text="Backward in History").reverse = True
+        layout.operator("console.history_cycle", text="Forward in History").reverse = False
+
+        layout.separator()
+
+        layout.operator("console.autocomplete", text="Autocomplete")
+
+
 def add_scrollback(text, text_type):
     for l in text.split("\n"):
-        bpy.ops.console.scrollback_append(text=l.expandtabs(4),
-                                          type=text_type)
+        bpy.ops.console.scrollback_append(text=l.expandtabs(4), type=text_type)
 
 
 classes = (
     CONSOLE_HT_header,
     CONSOLE_MT_editor_menus,
-    CONSOLE_MT_console,
+    CONSOLE_MT_view,
     CONSOLE_MT_language,
+    CONSOLE_MT_console,
 )
 
 if __name__ == "__main__":  # only for live edit.
index fc0adb655b7e3e1be5f94dc22982a0fe45bb4eed..faf613482a30001c8b93d204046cd6e5df4d83fe 100644 (file)
@@ -742,7 +742,7 @@ static int console_clear_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_clear(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Clear";
+  ot->name = "Clear All";
   ot->description = "Clear text by type";
   ot->idname = "CONSOLE_OT_clear";