How can I detect and/or change the active tab in the current editor via Python?
Is this doable? I have been digging through bpy.context.region/screen and not yet found a way to list the active tab.
How can I detect and/or change the active tab in the current editor via Python?
Is this doable? I have been digging through bpy.context.region/screen and not yet found a way to list the active tab.
This isn't currently exposed to the API (but we can expose it if it's useful).
If you mean that you want to turn, let's say, your current editor to the UV Image Editor, you could use the following code:
bpy.context.area.type = 'IMAGE_EDITOR'
Here are the rest of the strings you put for different screens:
3D Object Editor - 'VIEW_3D'
Timeline editor - 'TIMELINE'
Graph Editor - 'GRAPH_EDITOR'
Dopesheet Editor - 'DOPESHEET_EDITOR'
NLA Editor - 'NLA_EDITOR'
UV Image Editor - 'IMAGE_EDITOR'
Sequence Editor - 'SEQUENCE_EDITOR'
Clip Editor - 'CLIP_EDITOR'
Text Editor - 'TEXT_EDITOR'
Node Editor - 'NODE_EDITOR'
Game Logic Editor - 'LOGIC_EDITOR'
Properties Panel - 'PROPERTIES_EDITOR'
Outliner - 'OUTLINER'
User Preferences Screen - 'USER_PREFERENCES'
Info Panel - 'INFO'
File Browser - 'FILE_BROWSER'
Python Console - 'CONSOLE'
(The colours above don't mean anything)
So if you want to switch to the file browser, you would do:
bpy.context.area.type = 'FILE_BROWSER'
:)
[(item.identifier, item.name, item.description) for item in bpy.types.Area.bl_rna.properties['type'].enum_items]
$\endgroup$