Commit d694ec69 authored by Philipp Gast's avatar Philipp Gast
Browse files

next try

parent 4991080b
......@@ -124,27 +124,38 @@ class MyFig(Figure):
# UPDATE ----------------------------------------------------------
def update(self, **kwargs):
# check attributes in keywords
for keyword in kwargs.keys():
# if it is the rawdata use the function
if keyword == 'rawdata':
self.set_rawdata(kwargs['rawdata'])
# For each axes update the keywords
for ax in self.get_axes():
# if it is an attribute
elif keyword in self._attributesToUpdateKeys:
# update value
setattr(self, keyword, kwargs[keyword])
forax={}
elif keyword in self.aliases.keys():
# if it is a alias update only the coresponding axes
alax, alkey = self.aliases[keyword]
alax.update(**{alkey : kwargs[keyword]})
else :
# otherwise update all axes with keyword (not matching keywords are ignored by axes)
for ax in self.get_axes():
ax.update(**{keyword : kwargs[keyword]})
# check attributes in keywords
for keyword in kwargs.keys():
# if it is the rawdata use the function
if keyword == 'rawdata':
self.set_rawdata(kwargs['rawdata'])
# if it is an attribute
elif keyword in self._attributesToUpdateKeys:
# update value
setattr(self, keyword, kwargs[keyword])
# Check if a key of kwargs has an alias for this axes
elif keyword in self.aliases.keys():
alax, alkey = self.aliases[keyword]
# If an alias is found then update axkwargs
if ax == alax:
forax.update(**{alkey: kwargs[keyword]})
# use keyword as it is for the axes
else :
if keyword in ax.keywords.keys() : #not nessesarry. axes takes care of that
forax.update(**{keyword : kwargs[keyword]})
# Then eventually all collected Keywords are updated in one go
ax.update(**forax)
return(True)
# DECLARE ALIASES -------------------------------------------------
......
Markdown is supported
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