Makes sure that the default styles always exist.
(self, styles)
| 376 | # S T Y L E |
| 377 | |
| 378 | def initializeStyles(self, styles): |
| 379 | """Makes sure that the default styles always exist.""" |
| 380 | |
| 381 | if styles is None: |
| 382 | styles = copy.copy(styleLib['default']) |
| 383 | self.styles = styles # Dictionary of styles. Key is XML tag name value is Style instance. |
| 384 | |
| 385 | # Make sure that the default styles for document and page are always there. |
| 386 | name = 'root' |
| 387 | if name not in self.styles: |
| 388 | self.addStyle(name, self.rootStyle) |
| 389 | name = 'document' |
| 390 | if name not in self.styles: # Default dict styles as placeholder, if nothing is defined. |
| 391 | self.addStyle(name, dict(name=name)) |
| 392 | name = 'page' |
| 393 | if name not in self.styles: # Default dict styles as placeholder, if nothing is defined. |
| 394 | self.addStyle(name, dict(name=name)) |
| 395 | |
| 396 | def makeRootStyle(self, **kwargs): |
| 397 | """Creates a rootStyle, then set the arguments from keyword arguments, |