Exporting now uses custom people and organisations defined from the UI. See #875.

This commit is contained in:
Dion Moult
2020-07-13 15:29:06 +10:00
parent bdbe988dc7
commit fa1926fa84
7 changed files with 309 additions and 136 deletions
+37 -15
View File
@@ -854,11 +854,17 @@ class BIM_PT_owner(Panel):
scene = context.scene
props = scene.BIMProperties
row = layout.row()
row.prop(props, 'person')
if not props.person:
layout.label(text="No people found.")
else:
row = layout.row()
row.prop(props, 'person')
row = layout.row()
row.prop(props, 'organisation')
if not props.organisation:
layout.label(text="No organisations found.")
else:
row = layout.row()
row.prop(props, 'organisation')
class BIM_PT_people(Panel):
@@ -879,7 +885,7 @@ class BIM_PT_people(Panel):
row.operator('bim.add_person')
if props.people:
layout.template_list('BIM_UL_topics', '',
layout.template_list('BIM_UL_generic', '',
props, 'people', props, 'active_person_index')
if props.active_person_index < len(props.people):
@@ -897,11 +903,9 @@ class BIM_PT_people(Panel):
row.prop(person, 'prefix_titles')
row = layout.row()
row.prop(person, 'suffix_titles')
row = layout.row()
row.prop(person, 'roles')
layout.label(text="Roles:")
draw_roles_ui(layout, person, 'person')
layout.label(text="Addresses:")
draw_addresses_ui(layout, person, 'person')
@@ -923,7 +927,7 @@ class BIM_PT_organisations(Panel):
row.operator('bim.add_organisation')
if props.organisations:
layout.template_list('BIM_UL_topics', '',
layout.template_list('BIM_UL_generic', '',
props, 'organisations', props, 'active_organisation_index')
if props.active_organisation_index < len(props.organisations):
@@ -933,20 +937,38 @@ class BIM_PT_organisations(Panel):
row.operator('bim.remove_organisation', icon='X', text='').index = props.active_organisation_index
row = layout.row()
row.prop(organisation, 'description')
row = layout.row()
row.prop(organisation, 'roles')
layout.label(text="Roles:")
draw_roles_ui(layout, organisation, 'organisation')
layout.label(text="Addresses:")
draw_addresses_ui(layout, organisation, 'organisation')
def draw_roles_ui(layout, parent, parent_type):
row = layout.row()
row.operator(f'bim.add_{parent_type}_role')
if parent.roles:
layout.template_list('BIM_UL_generic', '',
parent, 'roles', parent, 'active_role_index')
if parent.active_role_index < len(parent.roles):
role = parent.roles[parent.active_role_index]
row = layout.row()
row.prop(role, 'name')
row.operator(f'bim.remove_{parent_type}_role', icon='X', text='').index = parent.active_role_index
if role.name == 'USERDEFINED':
row = layout.row()
row.prop(role, 'user_defined_role')
row = layout.row()
row.prop(role, 'description')
def draw_addresses_ui(layout, parent, parent_type):
row = layout.row()
row.operator(f'bim.add_{parent_type}_address')
if parent.addresses:
layout.template_list('BIM_UL_topics', '',
layout.template_list('BIM_UL_generic', '',
parent, 'addresses', parent, 'active_address_index')
if parent.active_address_index < len(parent.addresses):