Commit 87001341 authored by Yori Fournier's avatar Yori Fournier
Browse files

Merge branch 'commenting-renaming' into 'dev'

Commenting renaming

See merge request !16
parents a3cc352e 1d2a35f5
......@@ -83,19 +83,25 @@ class MyFig_base(Figure):
# CONSTRUCTOR --------------------------------------------------------
def __init__(self, rawdata, *args, **kwargs):
self._userAttributesKeys = ['fignum', 'reformat','debug','formatted']
# for the update function
self._attributesToUpdateKeys = ['fignum', 'reformat', 'debug', 'formatted']
# initialise the attribute default values and remove them from kwargs
self.fignum = kwargs.pop('fignum', -1) # need to be hard coded for interactive mode
self.reformat = kwargs.pop('reformat', D_REFORMAT)
self.debug = kwargs.pop('debug', D_DEBUG)
self.formatted = kwargs.pop('formatted', D_FORMATTED)
if hasattr(self,"keywords") :
# update the keywords with there values
if hasattr(self, "keywords") :
self.update(**kwargs)
for key in self.keywords.keys() :
kwargs.pop(key,None) # remove key if exists
# remove key if exists
for keyword in self.keywords.keys() :
kwargs.pop(keyword, None)
else:
self.keywords = {}
# initialise the rawdata
self.rawdata = rawdata
# add figsize in the kwargs for Figure.__init__
......@@ -126,13 +132,13 @@ class MyFig_base(Figure):
# UPDATE -------------------------------------------------------------
def update(self, **kwargs):
rdict = dict()
rest = dict()
# check attributes in keywords
for keyword in kwargs.keys():
# if it is an attribute
if keyword in self._userAttributesKeys:
if keyword in self._attributesToUpdateKeys:
# update value
setattr(self, keyword, kwargs[keyword])
......@@ -146,10 +152,12 @@ class MyFig_base(Figure):
self.set_rawdata(kwargs[keyword])
else:
rdict.update({keyword : kwargs[keyword]})
rest.update({keyword : kwargs[keyword]})
if (self.debug) :
print(DBUG + "These keywords have not been updated: " + str(rdict))
if (self.debug and rest != {}) :
print(DBUG + "These keywords have not been updated: " + str(rest))
return(True)
# PRINT 2 FILE -------------------------------------------------------
......
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