black format

This commit is contained in:
Andrej730
2023-03-16 16:06:41 +05:00
parent 35e748089b
commit fe0a98a44f
6 changed files with 9 additions and 17 deletions
+2 -2
View File
@@ -32,11 +32,11 @@ from blenderbim.bim.ifc import IfcStore
def draw_attributes(props, layout, copy_operator=None, popup_active_attribute=None): def draw_attributes(props, layout, copy_operator=None, popup_active_attribute=None):
"""you can set attribute active in popup with `active_attribute` """you can set attribute active in popup with `active_attribute`
meaning you will be able to type into attribute's field without having to click meaning you will be able to type into attribute's field without having to click
on it first on it first
""" """
for attribute in props: for attribute in props:
row = layout.row(align=True) row = layout.row(align=True)
if attribute == popup_active_attribute: if attribute == popup_active_attribute:
row.activate_init = True row.activate_init = True
@@ -1392,7 +1392,7 @@ class EditTextPopup(bpy.types.Operator):
split = rows[i].split(factor=0.1, align=False) split = rows[i].split(factor=0.1, align=False)
split.column() split.column()
split.label(text=text_lines[i]) split.label(text=text_lines[i])
def cancel(self, context): def cancel(self, context):
# disable editing when dialog is closed # disable editing when dialog is closed
bpy.ops.bim.disable_editing_text() bpy.ops.bim.disable_editing_text()
@@ -1407,7 +1407,7 @@ class EditTextPopup(bpy.types.Operator):
return context.window_manager.invoke_props_dialog(self) return context.window_manager.invoke_props_dialog(self)
else: else:
bpy.ops.bim.edit_text() bpy.ops.bim.edit_text()
return {'FINISHED'} return {"FINISHED"}
class EditText(bpy.types.Operator, Operator): class EditText(bpy.types.Operator, Operator):
@@ -424,7 +424,7 @@ class BIMTextProperties(PropertyGroup):
attributes: CollectionProperty(name="Attributes", type=Attribute) attributes: CollectionProperty(name="Attributes", type=Attribute)
test_prop: StringProperty(name="test_prop", default="TEXT") test_prop: StringProperty(name="test_prop", default="TEXT")
# Current text value with evaluated experessions stored in `value`. # Current text value with evaluated experessions stored in `value`.
# The original (Literal) value stored in `attributes['Literal']` # The original (Literal) value stored in `attributes['Literal']`
# and can be accessed with `get_text()` # and can be accessed with `get_text()`
value: StringProperty(name="Value", default="TEXT") value: StringProperty(name="Value", default="TEXT")
font_size: EnumProperty( font_size: EnumProperty(
@@ -444,7 +444,7 @@ class BIMTextProperties(PropertyGroup):
) )
def get_text(self): def get_text(self):
text_attribute = self.attributes.get('Literal', None) text_attribute = self.attributes.get("Literal", None)
return text_attribute.string_value if text_attribute else self.text return text_attribute.string_value if text_attribute else self.text
@@ -385,7 +385,6 @@ class BIM_PT_text(Panel):
row.label(text=props.value) row.label(text=props.value)
class BIM_PT_annotation_utilities(Panel): class BIM_PT_annotation_utilities(Panel):
bl_idname = "BIM_PT_annotation_utilities" bl_idname = "BIM_PT_annotation_utilities"
bl_label = "Annotation" bl_label = "Annotation"
@@ -334,14 +334,11 @@ class BimToolUI:
row.label(text="", icon="EVENT_SHIFT") row.label(text="", icon="EVENT_SHIFT")
row.label(text="", icon="EVENT_E") row.label(text="", icon="EVENT_E")
row.operator("bim.hotkey", text="Edit Roof Path").hotkey = "S_E" row.operator("bim.hotkey", text="Edit Roof Path").hotkey = "S_E"
elif ( elif (TextData.is_loaded or not TextData.load()) and TextData.data["attributes"]:
(TextData.is_loaded or not TextData.load())
and TextData.data["attributes"]
):
row = cls.layout.row(align=True) row = cls.layout.row(align=True)
row.label(text="", icon="EVENT_SHIFT") row.label(text="", icon="EVENT_SHIFT")
row.label(text="", icon="EVENT_E") row.label(text="", icon="EVENT_E")
row.operator("bim.hotkey", text="Edit text").hotkey = "S_E" row.operator("bim.hotkey", text="Edit text").hotkey = "S_E"
row = cls.layout.row(align=True) row = cls.layout.row(align=True)
row.label(text="", icon="EVENT_SHIFT") row.label(text="", icon="EVENT_SHIFT")
@@ -577,10 +574,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.context.object.select_set(True) bpy.context.object.select_set(True)
bpy.ops.bim.enable_editing_roof_path() bpy.ops.bim.enable_editing_roof_path()
elif ( elif (TextData.is_loaded or not TextData.load()) and TextData.data["attributes"]:
(TextData.is_loaded or not TextData.load())
and TextData.data["attributes"]
):
bpy.context.object.select_set(True) bpy.context.object.select_set(True)
bpy.ops.bim.edit_text_popup() bpy.ops.bim.edit_text_popup()
@@ -564,7 +564,6 @@ class Drawing(blenderbim.core.tool.Drawing):
# or if the current font size is not present in classes # or if the current font size is not present in classes
# (except regular font size because it's default) # (except regular font size because it's default)
if different_font_sizes or (font_size_str not in classes_split and font_size_str != "regular"): if different_font_sizes or (font_size_str not in classes_split and font_size_str != "regular"):
classes_split = [c for c in classes_split if c not in FONT_SIZES] + [font_size_str] classes_split = [c for c in classes_split if c not in FONT_SIZES] + [font_size_str]
classes = " ".join(classes_split) classes = " ".join(classes_split)