PageCore#
Import |
|
Defined in |
|
Install |
|
Since |
0.10 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- class scenet.core.PageCore[source]#
Bases:
CoreModelA fully resolved page: where every panel’s frame is.
The page tier of the same idea as
PanelCore. It holds the frames and nothing drawn: each panel’s contents are its own Panel Core, compiled at its frame’s size, so a page adds no layout decision to a panel and a panel’s Core reads the same whether or not it is on a page.- lettering_height#
The height every panel on the page took its type size from, in place of its own – so that a short panel and a tall one letter alike.
- Type:
- frames#
One per panel, in reading order: tier by tier, left to right, or right to left for a page read that way.
- direction#
Which way the page is read. Left out of the JSON for
ltr, so every page written before it reads and writes as it always did.- Type:
- bleed#
How far the printed sheet runs past the trim on every side, in page units. Left out of the JSON when 0, as
directionis whenltr.- Type:
Example
>>> from scenet import PageCore, compile_book >>> book = compile_book( ... "cast: {a: {reference: alice}}\n" ... "pages: [{tiers: [{panels: [one]}]}]\npanels: {one: {}}" ... ) >>> isinstance(book.pages[0], PageCore) True >>> [(f.panel, f.width) for f in book.pages[0].frames] [('one', 1800.0)]
See also
render_page, to draw it.PanelCore, what each frame holds.- classmethod from_json(text)[source]#
Read a Page Core back in.
- Parameters:
text (
str) – A Page Core document.- Return type:
- Returns:
The parsed page.
- Raises:
CoreSyntaxError – The text is not JSON, or not a Page Core. Also a
ValueError.