Contains a set of Page elements and other elements used for display in thumbnail mode. Used to compose the pages without the need to send them directly to the output for asynchronous page filling.
(self, styles=None, theme=None, viewId=None, name=None,
title=None, pages=None, autoPages=1, template=None, templates=None,
startPage=None, sId=None, w=None, h=None, d=None, size=None,
wh=None, whd=None, padding=None, docLib=None, context=None,
path=None, exportPaths=None, **kwargs)
| 67 | DEFAULT_VIEWID = defaultViewClass.viewId |
| 68 | |
| 69 | def __init__(self, styles=None, theme=None, viewId=None, name=None, |
| 70 | title=None, pages=None, autoPages=1, template=None, templates=None, |
| 71 | startPage=None, sId=None, w=None, h=None, d=None, size=None, |
| 72 | wh=None, whd=None, padding=None, docLib=None, context=None, |
| 73 | path=None, exportPaths=None, **kwargs): |
| 74 | """Contains a set of Page elements and other elements used for display |
| 75 | in thumbnail mode. Used to compose the pages without the need to send |
| 76 | them directly to the output for asynchronous page filling.""" |
| 77 | |
| 78 | if whd is not None: |
| 79 | size = whd |
| 80 | elif wh is not None: |
| 81 | # Alternative ways to define size. |
| 82 | size = wh |
| 83 | elif size is not None: |
| 84 | # Also accept size tuples. |
| 85 | w, h, d = point3D(size) # Set |
| 86 | |
| 87 | # If no theme is defined, then use the default theme class to create an |
| 88 | # instance. Themes hold values and colors, combined in a theme.mood |
| 89 | # dictionary that matches functions with parameters. |
| 90 | if theme is None: |
| 91 | theme = DEFAULT_THEME_CLASS() |
| 92 | |
| 93 | self.theme = theme |
| 94 | |
| 95 | # If not defined as separate attribute in **kwargs, Adjusts the default |
| 96 | # self.rootStyle['yAlign'] value based on self.origin. |
| 97 | self.rootStyle = rs = self.makeRootStyle(**kwargs) |
| 98 | |
| 99 | # May overwrite the root style. |
| 100 | self.initializeStyles(styles) |
| 101 | |
| 102 | # Optional source file path of the document, e.g. .sketch file. |
| 103 | self.path = path |
| 104 | self.name = name or title or 'Untitled' |
| 105 | self.title = title or self.name |
| 106 | |
| 107 | # Always needs a value. Take 1000 if 0 or None defined. These values |
| 108 | # overwrite the self.rootStyle['w'] and self.rootStyle['h'] |
| 109 | self.w = w or DEFAULT_DOC_WIDTH |
| 110 | self.h = h or DEFAULT_DOC_HEIGHT |
| 111 | |
| 112 | # In case depth is 0, keep is as value. |
| 113 | self.d = d |
| 114 | |
| 115 | # Optional system ID, used by an external application (e.g. Sketch). |
| 116 | # Can be None. |
| 117 | self.sId = sId |
| 118 | |
| 119 | if padding is not None: |
| 120 | self.padding = padding |
| 121 | |
| 122 | # Initializes the dictionary of pages. Key is pageNumber, Value is row |
| 123 | # list of pages: |
| 124 | # `self.pages[pn][index] = page` |
| 125 | self.pages = {} |
| 126 |
nothing calls this directly
no test coverage detected