示例#1
0
    def _resize(self, ctrl, sizer):
        mode = self.defaulttabsize(ctrl)
        sizer.update(**dict(mode, sizing_mode='stretch_both'))

        # pylint: disable=unsubscriptable-object
        borders = ctrl.theme.get("theme", "borders")
        sizer.children[0].height = mode['height'] - borders
        sizer.children[0].width += borders
        sizer.children[1].update(width=mode['width'] - sizer.children[0].width,
                                 height=sizer.children[0].height,
                                 sizing_mode='stretch_both')
        self.__fig.update(
            plot_width=sizer.children[1].width - borders,
            plot_height=sizer.children[1].height - borders,
        )

        table = sizer.children[0].children[-2]
        for i in sizer.children[0].children:
            i.width = table.width

        table.height = (
            sizer.children[0].height - ctrl.theme.get("theme", "figtbheight") -
            sum(i.height
                for i in sizer.children[0].children if i is not table))
        return stretchout(sizer)
示例#2
0
    def _addtodoc(self, ctrl, doc, *_):
        "returns the figure"
        shape = self._createraw()
        self._createhist(doc, self._rawsource.data, shape, self._raw.y_range)
        self._finishraw(shape)
        mode = self.defaultsizingmode()
        sizes = self.defaulttabsize(ctrl)

        widgets = self._createwidget(ctrl)
        # pylint: disable=unsubscriptable-object
        widgets.children[0].width = (sizes['width'] -
                                     sum(i.width
                                         for i in widgets.children[1:]))
        for i in widgets.children[0].children:
            i.width = widgets.children[0].width - ctrl.theme.get(
                "theme", "borders")

        widgets.width = sizes['width']
        parent = self._keyedlayout(ctrl, self._raw, self._hist)
        for i in [parent] + parent.children:
            i.update(width=sizes['width'],
                     height=sizes['height'] - widgets.height)
        self._raw.update(plot_width=parent.width - self._hist.plot_width,
                         plot_height=parent.height -
                         ctrl.theme.get("theme", "figtbheight"))
        self._hist.plot_height = self._raw.height
        return stretchout(layouts.column([parent, widgets], **mode, **sizes),
                          strategy=0)
示例#3
0
    def _addtodoc(self, ctrl, doc, *_):
        "returns the figure"
        plots = [i.create() for i in self.plots]
        self._duration.setpeaks(self._scatter.peaks)
        self._rate    .setpeaks(self._scatter.peaks)
        def _update_cb(attr, old, new):
            if self.isactive():
                self._duration.reset(False)
                self._rate.reset(False)
        self._scatter.peaks.selected.on_change('indices', _update_cb)

        mode  = self.defaultsizingmode()
        wbox  = self._widgets.addtodoc(self, ctrl, doc)
        loc   = ctrl.theme.get(HairpinGroupScatterTheme, 'toolbar')['location']
        hists = layouts.gridplot([plots[1:]], toolbar_location = loc, **mode)
        # pylint: disable=not-an-iterable
        tbar  = next(i for i in hists.children if isinstance(i, ToolbarBox))
        tbar.toolbar.logo = None
        out   = layouts.column(
            [
                layouts.row([plots[0]],    **mode),
                layouts.row([hists, wbox], **mode)
            ],
            **mode
        )
        self.__resize(ctrl, out, plots)
        return stretchout(out)
示例#4
0
    def addtodoc(self, ctrl, doc):
        "sets the plot up"
        itms = sum((i.addtodoc(ctrl, doc) for i in self._items[:-1]), [])
        itms.extend(self._items[-1].addtodoc(self._items[1:3], ctrl, doc))

        mode = self.defaultsizingmode()
        sizes = self.defaulttabsize(ctrl)
        brds = ctrl.theme.get("main", "borders", 5)
        itms[0].update(plot_width=sizes['width'],
                       plot_height=int(sizes['height'] *
                                       (itms[0].plot_height /
                                        (sum(i.plot_height
                                             for i in itms[:2]) + brds))))
        itms[1].update(
            plot_width=sizes['width'] - brds - itms[3].width,
            plot_height=sizes['height'] - brds - itms[0].plot_height,
            visible=False,
        )
        itms[2].update(plot_width=sizes['width'] - brds - itms[3].width,
                       plot_height=sizes['height'] - brds -
                       itms[0].plot_height)
        return stretchout(
            layouts.column([
                itms[0],
                layouts.row(itms[1:],
                            **dict(sizes, height=itms[1].plot_height, **mode))
            ], **sizes, **mode))
示例#5
0
    def _addtodoc(self, ctrl, doc, *_):  # pylint: disable=unused-argument
        self.__src = [
            ColumnDataSource(data=i) for i in self.__data(None, None, None)
        ]
        label = (self._theme.ylabel if self._theme.dataformat != "norm" else
                 self._theme.ylabelnormalized)
        self.__fig = fig = self.figure(y_range=Range1d,
                                       x_range=Range1d,
                                       y_axis_label=label,
                                       name='Ramp:Cycles')
        for i, j in zip(("beadarea", "beadline"), self.__src):
            self.addtofig(fig, i, x='zmag', y='zbead', source=j)
        for i, j in zip(("consensusarea", "consensusline", "beadcycles"),
                        self.__src):
            self.addtofig(fig, i, x='zmag', y='z', source=j)
        self.addtofig(fig, "frames", x='zmag', y='z', source=self.__src[-1])
        self.linkmodeltoaxes(fig)

        left = self.__widgets.create(self, ctrl, fig, self._theme.widgetwidth)
        out = self._keyedlayout(ctrl, fig)
        out.width = fig.plot_width
        out.height = fig.plot_height
        return stretchout(
            layouts.row([left, Spacer(width=20, height=left.height), out],
                        width=left.width + out.width + 20,
                        height=max(left.height, out.height),
                        **self.defaultsizingmode()))
示例#6
0
 def _addtodoc(self, ctrl, doc, *_):
     "returns the figure"
     mode = self.defaultsizingmode()
     widgets = self._widgets.addtodoc(self, ctrl, mode)
     grid = self._plots.addtodoc(self._ctrl, doc, mode)
     out = layouts.row(grid, widgets, **mode)
     self.__resize(ctrl, out)
     return stretchout(out)
示例#7
0
 def _addtodoc(self, ctrl, doc, *_):
     "returns the figure"
     hist = self._hist.create(ctrl, doc)
     scatter = self._scatter.create(self._hist.events)
     mode = self.defaultsizingmode()
     widg = self._widgets.addtodoc(self, ctrl, doc, self._hist.peaks)
     out = layouts.row(layouts.column(hist, **mode),
                       layouts.column(scatter, widg, **mode), **mode)
     self.__resize(ctrl, out)
     return stretchout(out)