File tree 3 files changed +17
-0
lines changed 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 3
3
from . import _api
4
4
5
5
6
+ def artist_property (kwdoc ):
7
+ """
8
+ Decorator to be applied to artist property setters.
9
+
10
+ The given text is stored in a privat variable ``_kwdoc`` on the method.
11
+ It is used for generating the kwdoc list for artists.
12
+ """
13
+ def decorator (func ):
14
+ func ._kwdoc = kwdoc
15
+ return func
16
+ return decorator
17
+
18
+
6
19
class Substitution :
7
20
"""
8
21
A decorator that performs %-substitution on an object's docstring.
Original file line number Diff line number Diff line change @@ -1433,6 +1433,9 @@ def get_valid_values(self, attr):
1433
1433
raise AttributeError ('%s has no function %s' % (self .o , name ))
1434
1434
func = getattr (self .o , name )
1435
1435
1436
+ if hasattr (func , '_kwdoc' ):
1437
+ return func ._kwdoc
1438
+
1436
1439
docstring = inspect .getdoc (func )
1437
1440
if docstring is None :
1438
1441
return 'unknown'
Original file line number Diff line number Diff line change @@ -1268,6 +1268,7 @@ def set_fontproperties(self, fp):
1268
1268
self ._fontproperties = FontProperties ._from_any (fp ).copy ()
1269
1269
self .stale = True
1270
1270
1271
+ @_docstring .artist_property (kwdoc = "bool, default: :rc:`text.usetex`" )
1271
1272
def set_usetex (self , usetex ):
1272
1273
"""
1273
1274
Parameters
You can’t perform that action at this time.
0 commit comments