Skip to content

Commit

Permalink
Export the row_tags and col_tags for table items (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
margalva authored May 23, 2024
1 parent 43e6a80 commit e2c6f15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions codegen/pyadritem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ class Item:
self.item_table = None
"""Table values (Must be in a numpy array)"""
self.table_dict = {}
self.row_tags = []
"""List of tags for each table row"""
self.col_tags = []
"""List of tags for each table column"""
self.item = self.serverobj.create_item(name=self.obj_name, source=self.source)

@property
Expand Down
5 changes: 4 additions & 1 deletion codegen/read_prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def generate() -> None:
list_table_attr.append(subelem.attrib["attribute"])
for i_attr, name_attr in enumerate(list_table_attr):
if i_attr == (len(list_table_attr) - 1):
new_file.write(' "' + name_attr + '"\n')
# row_tags and col_tags are not exposed in the template editor
new_file.write(
' "' + name_attr + '",\n "row_tags",\n "col_tags"\n'
)
else:
new_file.write(' "' + name_attr + '",\n')

Expand Down
2 changes: 2 additions & 0 deletions tests/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def test_create_table(adr_service_create) -> bool:
my_table.table_wrap_content = 0
my_table.table_default_col_labels = 1
my_table.table_cond_format = ""
my_table.row_tags = ["dp=0", "dp=2"]
my_table.col_tags = ["a", "b", "c", "d", "e", "f"]
new_table_items = adr_service_create.query(query_type="Item", filter=filter_str)
adr_service_create.stop()
assert len(new_table_items) == (len(table_items) + 1)
Expand Down

0 comments on commit e2c6f15

Please sign in to comment.