How do I, with python, select the sequencer area which has a view type as preview, to make it active/context? (And not select the "strip" window)
EDIT: My overall goal is to add a windowless, fullscreen, correctly scaled video-preview function to the VSE view menu(shortcuts: alt+F10, alt+F11 and home). In the video-editing workspace, there are two areas which are sequencer areas. One is the view type: sequencer(with strips) and one is view type: preview. When adding the function to the menu with SEQUENCER_MT_view, it is added to both areas, but I only want to make the preview area full screen, not the strip area. So I need help to make sure that the full-screen functions only will make the preview area full screen. How do I do that?
Where I am now(after help from SNU) - But get the working code from Snu further down:
import bpy
class SEQUENCE_MT_true_fullscreen(bpy.types.Operator):
"""True fullscreen preview. Close in upper right corner"""
bl_label = "True Fullscreen"
bl_idname = "sequencer.true_fullscreen"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
scene=bpy.context.scene
if not bpy.context.scene.sequence_editor: #create sequence, if missing
bpy.context.scene.sequence_editor_create()
context = bpy.context
for area in bpy.context.screen.areas:
if area.type == 'SEQUENCE_EDITOR':
if area.spaces[0].view_type == 'PREVIEW':
override = bpy.context.copy()
override['space_data'] = area.spaces.active
override['region'] = area.regions[-1]
override['area'] = area
override['screen'] = context.screen
bpy.ops.screen.screen_full_area(override, use_hide_panels=True)
bpy.ops.wm.window_fullscreen_toggle()
#bpy.ops.sequencer.view_all_preview() #uncomment this to crash
break
return {'FINISHED'}
def menu_append(self, context):
self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname)
def register():
bpy.utils.register_class(SEQUENCE_MT_true_fullscreen)
bpy.types.SEQUENCER_MT_view.append(menu_append) # add to "view" vse header menu
def unregister():
bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen)
bpy.types.SEQUENCER_MT_view.remove(menu_append)
if __name__ == "__main__":
register()
