Skip to content

Commit 1770342

Browse files
authored
Merge pull request #209 from tableau/jac/merge-mkc
pull in mkc19:master: add shapes to workbook
2 parents ce2da8d + b6b2d30 commit 1770342

File tree

4 files changed

+3372
-3
lines changed

4 files changed

+3372
-3
lines changed

docs/docs/dev-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ layout: docs
6666
1. Make a PR as described [here](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the 'development' branch.
6767

6868
1. Wait for a review and address any feedback.
69-
While we try and stay on top of all issues and PRs it might take a few days for someone to respond. Politely pinging the PR after a few days with no response is OK, we'll try and respond with a timeline as soon as we are able.
69+
While we try and stay on top of all issues and PRs, this isn't under active development so it might take a while for someone to respond. Politely pinging the PR after a few days with no response is OK, we'll try and respond with a timeline as soon as we are able.
7070

7171
1. That's it! When the PR has received :rocket:'s from members of the core team they will merge the PR
7272

tableaudocumentapi/workbook.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ def __init__(self, filename):
2727
self._datasource_index = self._prepare_datasource_index(self._datasources)
2828

2929
self._worksheets = self._prepare_worksheets(
30-
self._workbookRoot, self._datasource_index
31-
)
30+
self._workbookRoot, self._datasource_index)
31+
32+
self._shapes = self._prepare_shapes(self._workbookRoot)
3233

3334
@property
3435
def datasources(self):
@@ -42,6 +43,10 @@ def worksheets(self):
4243
def filename(self):
4344
return self._filename
4445

46+
@property
47+
def shapes(self):
48+
return self._shapes
49+
4550
def save(self):
4651
"""
4752
Call finalization code and save file.
@@ -116,3 +121,16 @@ def _prepare_worksheets(xml_root, ds_index):
116121
datasource.fields[column_name].add_used_in(worksheet_name)
117122

118123
return worksheets
124+
125+
@staticmethod
126+
def _prepare_shapes(xml_root):
127+
shapes = []
128+
worksheets_element = xml_root.find('.//external/shapes')
129+
if worksheets_element is None:
130+
return shapes
131+
132+
for worksheet_element in worksheets_element:
133+
shape_name = worksheet_element.attrib['name']
134+
shapes.append(shape_name)
135+
136+
return shapes

0 commit comments

Comments
 (0)