brown.core.page

classes

A document page.

All manually created GraphicObjects will have a Page as their ancestor. All Pages are children of the global document.

Page objects are automatically created by Document and should not be manually created or manipulated.

This class shares many properties and methods with GraphicObject, but notably is not a subclass of it.

Add an object to self.children.

Args: child (GraphicObject): The object to add

Returns: None

Remove an object from self.children.

Args: child (GraphicObject): The object to remove

Returns: None

Render every object in the page.

Returns: None

__init__ (pos, document, page_index, paper) permalink view source

arguments:

pos (Point or init tuple): The position of the top left corner of this page in canvas space. Note that this refers to the real corner of the page, not the corner of its live area within the paper margins.

document (Document): The global document. This is used as the Page object's parent.

page_index (int): The index of this page. This should be the same index this Page can be found at in the document's PageSupplier. This should be a positive number.

paper (Paper): The type of paper this page uses.

properties

parent: Document The document this page belongs in. permalink view source

read-only.

descendants: iter[GraphicObject] All of the objects in the children subtree. permalink view source

This recursively searches all of the object's children (and their children, etc.) and provides an iterator over them.

The current implementation performs a simple recursive DFS over the tree, and has the potential to be rather slow.

read-only.

page_index: The index of this page in its managing PageSupplier object. permalink view source

read-only.

methods

descendants_with_class_or_subclass (graphic_object_class) permalink view source

Yield all child descendants with a given class or its subclasses.

Args: graphic_object_class (type): The type to search for. This should be a subclass of GraphicObject.

Yields: GraphicObject

descendants_with_exact_class (graphic_object_class) permalink view source

Yield all child descendants with a given class.

Args: graphic_object_class (type): The type to search for. This should be a subclass of GraphicObject.

Yields: GraphicObject