text stringlengths 0 828 |
|---|
Properties of the %s |
Specify the font properties of the figure title manually. |
Possible types |
-------------- |
dict |
Items may be any valid text property |
See Also |
-------- |
%s, %s, %s"""""" % (label_name, base.key, base.key + 'size', |
base.key + 'weight') |
children = [base.key, base.key + 'size', base.key + 'weight'] + \ |
cl_children |
parents = cl_parents |
dependencies = cl_dependencies |
group = 'labels' |
name = 'Font properties of ' + (base.name or base.key) |
def __init__(self, *args, **kwargs): |
super(LabelProps, self).__init__(*args, **kwargs) |
self.default_props = {} |
self._todefault = False |
def set_value(self, value, validate=True, todefault=False): |
self._todefault = todefault |
super(LabelProps, self).set_value(value, validate, todefault) |
def update(self, fontprops): |
fontprops = fontprops.copy() |
# store default font properties |
try: |
text = next(iter(getattr(self, base.key).texts)) |
except StopIteration: |
return |
# TODO: This handling of the default management is not really |
# satisfying because you run into troubles when using alternate |
# property names (e.g. if you use 'ha' and 'horizontalalignment' |
# at the same time) |
if not self._todefault: |
for key in fontprops: |
if key == 'bbox': |
default = dict(facecolor='none', edgecolor='none') |
else: |
default = getattr(text, 'get_' + key)() |
self.default_props.setdefault(key, default) |
else: |
fontprops = self.default_props.copy() |
self.default_props.clear() |
if 'size' not in fontprops and 'fontsize' not in fontprops: |
fontprops['size'] = getattr(self, base.key + 'size').value |
if 'weight' not in fontprops and 'fontweight' not in fontprops: |
fontprops['weight'] = getattr(self, base.key + 'weight').value |
for text in getattr(self, base.key).texts: |
text.update(fontprops) |
self._todefault = False |
def get_fmt_widget(self, parent, project): |
""""""Get a widget with the different font weights"""""" |
from psy_simple.widgets.texts import FontPropertiesWidget |
return FontPropertiesWidget( |
parent, self, next(iter(getattr(self, base.key).texts), None), |
base) |
return LabelProps(base.key + 'props')" |
1564,"def replace(self, s, data, attrs=None): |
"""""" |
Replace the attributes of the plotter data in a string |
%(replace_note)s |
Parameters |
---------- |
s: str |
String where the replacements shall be made |
data: InteractiveBase |
Data object from which to use the coordinates and insert the |
coordinate and attribute informations |
attrs: dict |
Meta attributes that shall be used for replacements. If None, it |
will be gained from `data.attrs` |
Returns |
------- |
str |
`s` with inserted informations"""""" |
# insert labels |
s = s.format(**self.rc['labels']) |
# replace attributes |
attrs = attrs or data.attrs |
if hasattr(getattr(data, 'psy', None), 'arr_name'): |
attrs = attrs.copy() |
attrs['arr_name'] = data.psy.arr_name |
s = safe_modulo(s, attrs) |
# replace datetime.datetime like time informations |
if isinstance(data, InteractiveList): |
data = data[0] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.