Update panel UX
This commit is contained in:
parent
ea2c0fa883
commit
14fa397c1b
@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
from bpy.types import Panel
|
||||
from .funcs import get_scene_workspaces, workspace_ops
|
||||
from .funcs import prop_name, prop_i_name, get_active, get_scene_workspaces, workspace_ops
|
||||
|
||||
class SW_PT_select_scene_workspaces(Panel):
|
||||
bl_idname = "sw.select_scene_workspaces"
|
||||
@ -12,24 +12,23 @@ class SW_PT_select_scene_workspaces(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.label(text="Workspaces linked to this Scene:")
|
||||
box = layout.box()
|
||||
layout.alignment = 'LEFT'
|
||||
layout.label(text="Workspaces linked to this Scene")
|
||||
row = layout.row()
|
||||
sw = get_scene_workspaces()
|
||||
if not sw:
|
||||
box = row.box()
|
||||
box.label(text="There are no workspaces linked right now...")
|
||||
box.operator("sw.link_all")
|
||||
else:
|
||||
i = 0
|
||||
i = get_active()
|
||||
active = sw[i]
|
||||
r = row.box().column(align=True)
|
||||
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}")
|
||||
workspace_ops(row, i, False, w)
|
||||
i += 1
|
||||
box.separator()
|
||||
op = r.operator("sw.select", text=w, icon="RADIOBUT_ON" if active == w else "RADIOBUT_OFF", emboss=active == w)
|
||||
op.workspace = w
|
||||
r = row.column(align=True)
|
||||
workspace_ops(r, i, False, active)
|
||||
|
||||
layout.separator()
|
||||
|
||||
@ -39,7 +38,7 @@ class SW_PT_select_scene_workspaces(Panel):
|
||||
row_count = 0
|
||||
l = [x for x in bpy.data.workspaces if x.name not in sw]
|
||||
for w in l:
|
||||
if row_count > 0 and row_count % 4 == 0:
|
||||
if row_count > 0 and row_count % 3 == 0:
|
||||
row = box2.row()
|
||||
row.operator("sw.link_workspace", text=w.name).workspace = w.name
|
||||
row_count += 1
|
||||
@ -47,4 +46,4 @@ class SW_PT_select_scene_workspaces(Panel):
|
||||
layout.separator()
|
||||
layout.operator("sw.link_all")
|
||||
else:
|
||||
box2.label(text="All workspaces are currently linked.")
|
||||
row.label(text="All workspaces are currently linked.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user