示例#1
0
    def _make_levels(self, irrad, progress=None):
        irradname = irrad.name

        flowables = []
        if self.options.only_selected_level:
            levels = [l for l in irrad.levels if l.name == self.selected_level]
        else:
            # make coversheet
            summary = self._make_summary(irrad)
            summary_table = self._make_summary_table(irrad)

            flowables = [
                summary,
                self._vspacer(1), summary_table,
                self._page_break()
            ]

            levels = sorted(irrad.levels, key=lambda x: x.name)

        for level in levels:
            if progress is not None:
                progress.change_message('Making {}{}'.format(
                    irradname, level.name))

            c = self._make_canvas(level)
            fs = self._make_level_table(irrad, level, c)
            if c:
                c = ComponentFlowable(c)
                flowables.append(self._make_table_title(irrad, level))
                flowables.append(c)
                flowables.append(self._page_break())

            flowables.extend(fs)

        return flowables
示例#2
0
    def _make_time_series(
        self,
        analysis_type,
    ):

        opt = getattr(self.options, '{}s_series_options_manager'.format(
            analysis_type)).selected_options

        ag = self._get_analyses(analysis_type)
        name = ' '.join((a.capitalize() for a in analysis_type.split('_')))
        pb = self._page_break()
        if ag:
            s = SeriesEditor(plotter_options=opt)
            s.set_items(ag.analyses)
            s.component.use_backbuffer = False

            table = self._make_summary_table(ag, opt)

            title = self._new_paragraph(name, s='Heading1')
            comp = ComponentFlowable(s.component, bounds=self.options.bounds)
            if getattr(self.options,
                       '{}s_table_enabled'.format(analysis_type)):
                s = (title, table, comp, pb)
            else:
                s = (title, comp, pb)
        else:
            s = (self._new_paragraph('No {}s'.format(name)), pb)

        return s, ag
示例#3
0
    def _make_ideogram(self, analysis_type, ag):
        opt = getattr(self.options, '{}s_ideogram_options_manager'.format(
            analysis_type)).selected_options
        # name = ' '.join((a.capitalize() for a in analysis_type.split('_')))
        pb = self._page_break()

        s = IdeogramEditor(plotter_options=opt)
        s.set_items(ag.analyses)
        s.component.use_backbuffer = False

        comp = ComponentFlowable(s.component, bounds=self.options.bounds)
        return comp, pb
示例#4
0
    def _build(self, doc, ans, component):

        flowables = [
            ComponentFlowable(component=component),
            PageBreak(),
        ]
        ts = self._make_tables(ans)

        for i in range(len(ts) - 1, 0, -1):
            ts.insert(i, self._vspacer(0.25))

        flowables.extend(ts)
        templates = None
        return flowables, templates
    def _build(self, doc, positions, grouped_positions, component, meta):

        n = len(grouped_positions)
        if n > 5:
            idx = int(round(n / 2.))
            p1 = grouped_positions[:idx]
            p2 = grouped_positions[idx:]
        else:
            p1 = grouped_positions
            p2 = []

        #
        meta = self._make_meta_table(meta)
        t1 = self._make_table(p1)
        t2 = self._make_table(p2)

        t3 = self._make_notes_table(positions)

        flowables = [
            meta,
            Spacer(0, 5 * mm),
            ComponentFlowable(component=component),
            FrameBreak(),
            Spacer(0, 5 * mm), t1,
            FrameBreak(),
            Spacer(0, 5 * mm), t2,
            FrameBreak(), t3
        ]

        # make 3 frames top, lower-left, lower-right
        lm = doc.leftMargin
        bm = doc.bottomMargin + doc.height * .333

        fw = doc.width
        fh = doc.height * 0.666
        top = Frame(lm, bm, fw, fh)

        fw = doc.width / 2.
        fh = doc.height * 0.333
        bm = doc.bottomMargin

        lbottom = Frame(lm, bm, fw, fh)
        rbottom = Frame(lm + doc.width / 2., bm, fw, fh)

        frames = [top, lbottom, rbottom]
        template = self._new_page_template(frames)

        return flowables, (template, )
    def _build(self, doc, component, unknowns, blanks, collate=True):
        '''
            needs to return 
                flowables, templates
                
            flowables: Flowable list
            templates: PageTemplate list
        '''
        flowables = [
            ComponentFlowable(component),
            PageBreak(),
        ]
        ts = self._new_style(header_line_idx=1, header_line_width=2)
        ts.add('SPAN', (0, 0), (-1, 0))

        if collate:
            unknowns.extend(blanks)
            ans = sorted(unknowns, key=lambda x: x.timestamp)

            bidx = [
                i for i, ai in enumerate(ans)
                if ai.analysis_type.startswith('blank')
            ]

            for bi in bidx:
                ts.add('BACKGROUND', (0, bi + 2), (-1, bi + 2),
                       colors.lightgrey)

            ai = unknowns[0]
            title = ' '.join(map(str.capitalize, ai.analysis_type.split('_')))
            t = self._make_table(ans, ts, title)
            flowables.append(t)

        else:
            for ans in (unknowns, blanks):
                ai = ans[0]
                title = ' '.join(
                    map(str.capitalize, ai.analysis_type.split('_')))
                t = self._make_table(ans, ts, title)

                flowables.append(t)
                flowables.append(self._new_spacer(0, 0.5))

#         frames = [self._default_frame(doc)]
#         template = self._new_page_template(frames)

        return flowables, None
    def _make_levels(self, irrad, progress=None):
        flowables = []
        irradname = irrad.name

        for level in sorted(irrad.levels, key=lambda x: x.name):
            if progress is not None:
                progress.change_message('Making {}{}'.format(
                    irradname, level.name))

            c = self._make_canvas(level)
            fs = self._make_level_table(irrad, level, c)
            if c:
                c = ComponentFlowable(c, bounds=(200, 200), fixed_scale=True)
                flowables.append(c)

            flowables.extend(fs)

        return flowables, None
    def _make_levels(self, irrad, progress=None):
        irradname = irrad.name

        p = self._make_summary(irrad)
        flowables = [p, self._page_break()]
        for level in sorted(irrad.levels, key=lambda x: x.name):
            if progress is not None:
                progress.change_message('Making {}{}'.format(irradname, level.name))

            c = self._make_canvas(level)
            fs = self._make_level_table(irrad, level, c)
            if c:
                c = ComponentFlowable(c)
                flowables.append(self._make_table_title(irrad, level))
                flowables.append(c)
                flowables.append(self._page_break())

            flowables.extend(fs)

        return flowables, None