Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yori Fournier
myplotlib
Commits
87001341
Commit
87001341
authored
Jan 30, 2017
by
Yori Fournier
Browse files
Merge branch 'commenting-renaming' into 'dev'
Commenting renaming See merge request
!16
parents
a3cc352e
1d2a35f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
myFig.py
View file @
87001341
...
...
@@ -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
):
r
dic
t
=
dict
()
r
es
t
=
dict
()
# check attributes in keywords
for
keyword
in
kwargs
.
keys
():
# if it is an attribute
if
keyword
in
self
.
_
userA
ttributesKeys
:
if
keyword
in
self
.
_
a
ttributes
ToUpdate
Keys
:
# update value
setattr
(
self
,
keyword
,
kwargs
[
keyword
])
...
...
@@ -146,10 +152,12 @@ class MyFig_base(Figure):
self
.
set_rawdata
(
kwargs
[
keyword
])
else
:
r
dic
t
.
update
({
keyword
:
kwargs
[
keyword
]})
r
es
t
.
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 -------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment