from bpy.types import Panel from .funcs import get_scene_workspaces, draw_workspace_ops class WBS_PT_select_scene_workspaces(Panel): bl_idname = "wbs.select_scene_workspaces" bl_label = "Scene Workspaces" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "scene" def draw(self, context): layout = self.layout layout.label(text="Workspaces linked to this Scene:") sw = get_scene_workspaces() box = layout.box() if not sw: box.label(text="There are no workspaces linked right now...") else: i = 0 for w in sw: box.scale_y = .4 box2 = box.box() row = box2.row(align=True) row.scale_y = 2.1 row.label(text=f"{w}") draw_workspace_ops(row, i, False, w) i += 1 box.separator() layout.separator() layout.label(text="Link other workspaces") l = [x for x in bpy.data.workspaces if x.name not in sw] box2 = layout.box().split() box2.label(text="All workspaces are currently linked.") for w in l: row = box2.column() row.operator("wbs.sel_workspace", text=w.name).workspace = w.name if l: layout.separator() layout.operator("wbs.sel_all")