Commit 1b4c9bf4 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

BUG - Here I found an issue due to a test on the Axes object given to add_axes

If the Axes is of type MyAxes but deriving from Another class It won't pass the
isinstance(ax, MyAxes) test

However it will pass
issubclass(ax.__class__, MyAxes)

But if ax is derived from MyAxes from another namespace:
ax.__class__ = some_namespace.MyAxes
MyAxes = some_other_namespace.MyAxes
It won't pass neither...

Therefore I commented this test before I find a solution
parent dac983f2
......@@ -179,11 +179,11 @@ class MyFig(Figure):
# This overwrites MPL add_axes. It gives a name to the axis added so that it is easier to refer to
def add_axes(self, ax, name) :
if isinstance(name, str) and isinstance(ax, MyAxes):
ax.name = name
else:
print(SEVR + " there is an error with the input type of add_axes()")
return False
# if isinstance(name, str) and issubclass(ax.__class__, MyAxes): # This lead to an error is ax is not in the same namespace
ax.name = name
# else:
# print(SEVR + " there is an error with the input type of add_axes()")
# return False
# test if an axes with that name is already present
for pax in self.get_axes() :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment