Copy relevant info from template: w, h, elements, style, conditions when element is created. Don't call later. >>> from pagebot.toolbox.units import mm, pt >>> from pagebot.elements.template import Template >>> e = Element(name='TestElement') >>> t = Template
(self, template, elements=None)
| 4908 | # Apply template. |
| 4909 | |
| 4910 | def applyTemplate(self, template, elements=None): |
| 4911 | """Copy relevant info from template: w, h, elements, style, conditions |
| 4912 | when element is created. Don't call later. |
| 4913 | |
| 4914 | >>> from pagebot.toolbox.units import mm, pt |
| 4915 | >>> from pagebot.elements.template import Template |
| 4916 | >>> e = Element(name='TestElement') |
| 4917 | >>> t = Template(xy=pt(11, 12), size=(100, mm(200))) |
| 4918 | >>> e.applyTemplate(t) |
| 4919 | >>> e.x, e.y, e.w, e.h |
| 4920 | (11pt, 12pt, 100pt, 200mm) |
| 4921 | """ |
| 4922 | # Set template value by property call, copying all template elements |
| 4923 | # and attributes. |
| 4924 | self.template = template |
| 4925 | |
| 4926 | if elements is not None: |
| 4927 | # Add optional list of additional elements. |
| 4928 | for e in elements or []: |
| 4929 | # Add cross reference searching for eId of elements. |
| 4930 | self.appendElement(e) |
| 4931 | |
| 4932 | def _get_template(self): |
| 4933 | """Property get/set for e.template. |
no test coverage detected