From 7fef81c0b93c1cdfb76b656d8d2d1f8d67cda14b Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 28 Oct 2024 11:11:39 +0500 Subject: [PATCH] black . --- src/bonsai/bonsai/bim/module/pset/ui.py | 8 +++++--- src/bonsai/bonsai/bim/module/search/operator.py | 11 ++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/pset/ui.py b/src/bonsai/bonsai/bim/module/pset/ui.py index 6afcd5fa78..a55afeae83 100644 --- a/src/bonsai/bonsai/bim/module/pset/ui.py +++ b/src/bonsai/bonsai/bim/module/pset/ui.py @@ -103,9 +103,7 @@ def draw_psetqto_ui( filter_keyword: str = "", ) -> None: - active_operator = context.active_operator - filter_keyword = filter_keyword.lower() box = layout.box() @@ -204,7 +202,11 @@ def draw_psetqto_ui( if active_operator: if active_operator.bl_idname == "BIM_OT_select_similar": calculated_sum = getattr(active_operator, "calculated_sum", 0.0) - if op.key == active_operator.key and calculated_sum != 0 and isinstance(float(nominal_value), (int, float)): + if ( + op.key == active_operator.key + and calculated_sum != 0 + and isinstance(float(nominal_value), (int, float)) + ): row.label(text=f"(Sum: {calculated_sum})") if not has_props_displayed: row = box.row() diff --git a/src/bonsai/bonsai/bim/module/search/operator.py b/src/bonsai/bonsai/bim/module/search/operator.py index ae73aa961a..d6e68f3224 100644 --- a/src/bonsai/bonsai/bim/module/search/operator.py +++ b/src/bonsai/bonsai/bim/module/search/operator.py @@ -696,13 +696,12 @@ class SelectSimilar(Operator, tool.Ifc.Operator): bl_idname = "bim.select_similar" bl_label = "Select Similar" bl_options = {"REGISTER", "UNDO"} - bl_description = ( - "Select objects with a similar value\n\n" - + "SHIFT+CLICK display the sum of all selected objects" - ) + bl_description = "Select objects with a similar value\n\n" + "SHIFT+CLICK display the sum of all selected objects" key: bpy.props.StringProperty() - calculate_sum: bpy.props.BoolProperty(name="Calculate Sum of Selected Objects", default=False, options={"SKIP_SAVE"}) + calculate_sum: bpy.props.BoolProperty( + name="Calculate Sum of Selected Objects", default=False, options={"SKIP_SAVE"} + ) calculated_sum: bpy.props.FloatProperty(name="Calculated Sum", default=0.0) def invoke(self, context, event): @@ -719,7 +718,6 @@ class SelectSimilar(Operator, tool.Ifc.Operator): key = "predefined_type" value = ifcopenshell.util.selector.get_element_value(element, key) - if self.calculate_sum and isinstance(value, (int, float)): total = 0 for obj in context.selected_objects: @@ -740,4 +738,3 @@ class SelectSimilar(Operator, tool.Ifc.Operator): continue if ifcopenshell.util.selector.get_element_value(element, key) == value: obj.select_set(True) -