mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 16:31:10 +00:00
Disable some tab buttons when no ifc file is loaded
This commit is contained in:
@@ -280,21 +280,22 @@ class BIM_PT_tabs(Panel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
try:
|
try:
|
||||||
|
is_ifc_project = bool(tool.Ifc.get())
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||||
|
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.operator(
|
row.operator(
|
||||||
"bim.set_tab", text="", emboss=False, icon_value=blenderbim.bim.icons["IFC"].icon_id
|
"bim.set_tab", text="", emboss=False, icon_value=blenderbim.bim.icons["IFC"].icon_id
|
||||||
).tab = "PROJECT"
|
).tab = "PROJECT"
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="FILE_3D").tab = "OBJECT"
|
self.draw_tab_entry(row, "FILE_3D", "OBJECT", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="MATERIAL").tab = "GEOMETRY"
|
self.draw_tab_entry(row, "MATERIAL", "GEOMETRY", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="DOCUMENTS").tab = "DRAWINGS"
|
self.draw_tab_entry(row, "DOCUMENTS", "DRAWINGS", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="NETWORK_DRIVE").tab = "SERVICES"
|
self.draw_tab_entry(row, "NETWORK_DRIVE", "SERVICES", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="EDITMODE_HLT").tab = "STRUCTURE"
|
self.draw_tab_entry(row, "EDITMODE_HLT", "STRUCTURE", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="NLA").tab = "SCHEDULING"
|
self.draw_tab_entry(row, "NLA", "SCHEDULING", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="PACKAGE").tab = "FM"
|
self.draw_tab_entry(row, "PACKAGE", "FM", is_ifc_project)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="COMMUNITY").tab = "QUALITY"
|
self.draw_tab_entry(row, "COMMUNITY", "QUALITY", True)
|
||||||
row.operator("bim.set_tab", text="", emboss=False, icon="BLENDER").tab = "BLENDER"
|
self.draw_tab_entry(row, "BLENDER", "BLENDER", True)
|
||||||
row.operator("bim.switch_tab", text="", emboss=False, icon="UV_SYNC_SELECT")
|
row.operator("bim.switch_tab", text="", emboss=False, icon="UV_SYNC_SELECT")
|
||||||
|
|
||||||
# Yes, that's right.
|
# Yes, that's right.
|
||||||
@@ -324,6 +325,11 @@ class BIM_PT_tabs(Panel):
|
|||||||
except:
|
except:
|
||||||
pass # Prior to load_post, we may not have any area properties setup
|
pass # Prior to load_post, we may not have any area properties setup
|
||||||
|
|
||||||
|
def draw_tab_entry(self, row, icon, tab_name, enabled=True):
|
||||||
|
tab_entry = row.row(align=True)
|
||||||
|
tab_entry.operator("bim.set_tab", text="", emboss=False, icon=icon).tab = tab_name
|
||||||
|
tab_entry.enabled = enabled
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_project_info(Panel):
|
class BIM_PT_project_info(Panel):
|
||||||
bl_label = "Project Info"
|
bl_label = "Project Info"
|
||||||
|
|||||||
Reference in New Issue
Block a user