Skip to content

Commit

Permalink
Fix style list wrapper calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
kevancress committed Apr 23, 2024
1 parent 744d1ca commit 6e04a1e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions gitcommit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prev_commit='d3ae97b'
date='2024-03-09'
prev_commit='da68b54'
date='2024-03-13'
branch=''

28 changes: 28 additions & 0 deletions measureit_arch_baseclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def recalc_index(self, context):
id_l = 0
id_a = 0
id_d = 0

# Check Count of items to wrap
total_dims_wrapped = len(StyleGen.alignedDimensions)
total_lines_wrapped = len(StyleGen.line_groups)
total_annos_wrapped = len(StyleGen.annotations)


for style in wrapper:
if style.itemType == 'line_groups':
style.itemIndex = id_l
Expand All @@ -31,6 +38,27 @@ def recalc_index(self, context):
style.name = StyleGen.annotations[id_a].name
id_a += 1

while total_lines_wrapped > id_l:
new_wrapper = wrapper.add()
new_wrapper.itemType = 'line_groups'
new_wrapper.itemIndex = id_l
new_wrapper.name = StyleGen.line_groups[id_l].name
id_l += 1

while total_dims_wrapped > id_d:
new_wrapper = wrapper.add()
new_wrapper.itemType = 'alignedDimensions'
new_wrapper.itemIndex = id_d
new_wrapper.name = StyleGen.line_groups[id_d].name
id_d += 1

while total_annos_wrapped > id_a:
new_wrapper = wrapper.add()
new_wrapper.itemType = 'annotations'
new_wrapper.itemIndex = id_a
new_wrapper.name = StyleGen.line_groups[id_a].name
id_a += 1


class StyleWrapper(PropertyGroup):
itemType: EnumProperty(
Expand Down
11 changes: 6 additions & 5 deletions measureit_arch_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,17 @@ def execute(self, context):

Generator.wrapper.remove(wrapperTag)

if self.is_style:
recalc_index(self, context)
else:
recalc_dimWrapper_index(self, context)

DeletePropButton.tag = self.tag
DeletePropButton.genPath = self.genPath
DeletePropButton.item_type = self.item_type
DeletePropButton.is_style = self.is_style
DeletePropButton.execute(self, context)

if self.is_style:
recalc_index(self, context)
else:
recalc_dimWrapper_index(self, context)

return {'FINISHED'}


Expand Down

0 comments on commit 6e04a1e

Please sign in to comment.