Exemple #1
0
    def preparePrinting(self):
        self.ui.pages_list.setEnabled(False)
        pages = self.ui.pages_list.getCheckedPages()
        content_table = ContentTable(self.printer)

        # Build the list of fetching pages, and ask each fragments
        # to fetch data.
        self.fetching_pages = []
        for page in pages:
            content_table.newPage()
            content_table.addSection(page.title)

            page_args = copy(page.args)
            page_args.update(self.args)

            frag_widgets = []
            i = 0
            for frame in page.frames:
                for fragname, fragment in frame.frags:

                    frag_widget = FragmentFrame(fragment, page_args, self.client)
                    if not frag_widget.getView().isPrintable():
                        continue

                    frag_widget.updateData()
                    frag_widgets.append(frag_widget)

                    if i > 0 and not i % 2:
                        content_table.newPage()
                    content_table.addFragment(fragment.title)
                    i += 1

            self.fetching_pages.append((page, frag_widgets))

        if self.ui.contentTableBox.isChecked():
            content_table.draw()

        # Timer will call the checkFragments() method.
        self.timer.start(500)
        self.update()