From 0a87e92dcf5e2e119af597b574294e5c6ca7505c Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 17 Jan 2025 20:54:06 +1100 Subject: [PATCH] Move geoference visualisation UI into panel header to be consistent. --- .../bonsai/bim/module/georeference/ui.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/georeference/ui.py b/src/bonsai/bonsai/bim/module/georeference/ui.py index f22803758d..8b2dfd43e0 100644 --- a/src/bonsai/bonsai/bim/module/georeference/ui.py +++ b/src/bonsai/bonsai/bim/module/georeference/ui.py @@ -25,12 +25,21 @@ from bonsai.bim.module.georeference.data import GeoreferenceData class BIM_PT_gis(Panel): bl_label = "Georeferencing" bl_idname = "BIM_PT_gis" - bl_options = {"DEFAULT_CLOSED"} + bl_options = {"DEFAULT_CLOSED", "HEADER_LAYOUT_EXPAND"} bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "scene" bl_parent_id = "BIM_PT_tab_geometry" + def draw_header(self, context): + props = context.scene.BIMGeoreferenceProperties + row = self.layout.row(align=True) + icon = "HIDE_OFF" if props.should_visualise else "HIDE_ON" + row.label(text="") # empty text occupies the left of the row + if props.should_visualise: + row.prop(props, "visualization_scale", text="Size", slider=True) + row.prop(props, "should_visualise", icon=icon, text="") + def draw(self, context): self.layout.use_property_split = True self.layout.use_property_decorate = False @@ -87,19 +96,14 @@ class BIM_PT_gis(Panel): if not GeoreferenceData.data["projected_crs"]: row = self.layout.row(align=True) row.label(text="Not Georeferenced", icon="ERROR") - row = self.layout.row(align=True) - row.prop(props, "should_visualise", icon="HIDE_OFF") - row.prop(props, "visualization_scale", text="Size", slider=True) if tool.Ifc.get_schema() != "IFC2X3": + row = self.layout.row(align=True) row.prop(props, "coordinate_operation_class", text="") row.operator("bim.add_georeferencing", icon="ADD", text="") if GeoreferenceData.data["projected_crs"]: row = self.layout.row(align=True) row.label(text="Projected CRS", icon="WORLD") - row = self.layout.row(align=True) - row.prop(props, "should_visualise", icon="HIDE_OFF") - row.prop(props, "visualization_scale", text="Size", slider=True) if tool.Ifc.get_schema() != "IFC2X3": row.operator("bim.enable_editing_georeferencing", icon="GREASEPENCIL", text="") row.operator("bim.remove_georeferencing", icon="X", text="")