Exemple #1
0
    def insert_new_page_at(self, index, bg_source=None):
        """
        Insert a new page at the given index.

        Parameters:
          index     -- Index/site number that this page will have.

          bg_source -- The bg_source for this page. None results in a blank page.
        """
        if bg_source is None:
            bg_source = Backgrounds.empty_background()

        new_page = DocumentPage(self, index, bg_source)
        if new_page.boundingRect().width() > self.max_width:
           self.max_width = new_page.boundingRect().width()

        self.pages.insert(index, new_page)

        # Move all pages after this down to accommodate it.
        for i in range(index + 1, len(self.pages)):
            self.pages[i].page_number = i
            self.pages[i].update_bounding_rect()

        self.refresh_viewport_size()
Exemple #2
0
 def plain_bg(self):
     """ Set the background to plain. """
     parent = self.parentItem()
     parent.bg_source = Backgrounds.empty_background(size=parent.bg_source.sizeF())
     parent.background_is_dirty = True