Closed jmgarcia-iriusrisk closed 2 years ago
Hi - I made a few changes. I was a bit confused by the change to Shape.text, so have removed that and updated the test to check the master shape that has the expected text (which happens to be same as the master page name).
I didn't think that Shape.text should return master name when that master shape really had no text
If I have misunderstood please let me know :)
KInd regards Dave
Hi @dave-howard , thanks for your comment. The change of Shape.text it is due the following behaviour. We are doing something like:
` shapes = vis.pages[0].shapes[0]
for shape in self.page.sub_shapes():
shape.text ` But for the file test_master_multiple_child_shapes.vsdx, the shape.text is empty:
as the master shape child has more than one child and the text is not in the first one:
The library is not retrieving that name correctly, I think that the issue, please, correct me if I'm missing something.
Cordially, Juan.
Hi @jmgarcia-iriusrisk,
I think Shape.text
returning an empty string in this case is correct - if we change the behaviour of Shape.text
to return value of first child Shape with non-empty text, then that will break some other use cases (i.e. Page.find_shapes_by_text() method
)
That said - if it would be useful to have a method of a Shape that returns all text, or first text value.
In the example above - if you get shape by id 7 and check it's text property - you'll get the expected text - but the other peer and patrent shapes have an empty text so that's what gets returned
I've added a new test in da2c7e1a that includes your sample file
Dave
Hi @dave-howard , I have created this pr in order to fix the task Retrieve master page info in Shape object
Thanks for your effort and feel free to reach me in order to do any change.
Cordially, Juan.