コード例 #1
0
class Bar(Foo):
    b = Unicode('gotit', help="The string b.").tag(config=False)
    c = Float(help="The string c.").tag(config=True)
    bset = Set([]).tag(config=True, multiplicity='+')
    bset_values = Set([2,1,5]).tag(config=True, multiplicity='+')
    bdict = Dict().tag(config=True, multiplicity='+')
    bdict_values = Dict({1:'a','0':'b',5:'c'}).tag(config=True, multiplicity='+')
コード例 #2
0
class Bar(Foo):
    b = Unicode("gotit", help="The string b.").tag(config=False)
    c = Float(help="The string c.").tag(config=True)
    bset = Set([]).tag(config=True, multiplicity="+")
    bset_values = Set([2, 1, 5]).tag(config=True, multiplicity="+")
    bdict = Dict().tag(config=True, multiplicity="+")
    bdict_values = Dict({
        1: "a",
        "0": "b",
        5: "c"
    }).tag(config=True, multiplicity="+")
コード例 #3
0
class Bar(Configurable):

    b = Integer(0, help="The integer b.").tag(config=True)
    enabled = Bool(True, help="Enable bar.").tag(config=True)
    tb = Tuple(()).tag(config=True, multiplicity='*')
    aset = Set().tag(config=True, multiplicity='+')
    bdict = Dict().tag(config=True)
コード例 #4
0
class Containers(Configurable):
    lis = List().tag(config=True)
    def _lis_default(self):
        return [-1]

    s = Set().tag(config=True)
    def _s_default(self):
        return {'a'}

    d = Dict().tag(config=True)
    def _d_default(self):
        return {'a' : 'b'}
コード例 #5
0
ファイル: figures.py プロジェクト: whishei/bluesky-browser
class FigureManager(Configurable):
    """
    For a given Viewer, encasulate the matplotlib Figures and associated tabs.
    """
    factories = List([
        LinePlotManager,
        LatestFrameImageManager],
        config=True)
    enabled = Bool(True, config=True)
    exclude_streams = Set([], config=True)

    def __init__(self, add_tab):
        self.update_config(load_config())
        self.add_tab = add_tab
        self._figures = {}

    def get_figure(self, key, label, *args, **kwargs):
        try:
            return self._figures[key]
        except KeyError:
            return self._add_figure(key, label, *args, **kwargs)

    def _add_figure(self, key, label, *args, **kwargs):
        tab = QWidget()
        fig, _ = plt.subplots(*args, **kwargs)
        canvas = FigureCanvas(fig)
        canvas.setMinimumWidth(640)
        canvas.setParent(tab)
        toolbar = NavigationToolbar(canvas, tab)
        tab_label = QLabel(label)
        tab_label.setMaximumHeight(20)

        layout = QVBoxLayout()
        layout.addWidget(tab_label)
        layout.addWidget(canvas)
        layout.addWidget(toolbar)
        tab.setLayout(layout)
        self.add_tab(tab, label)
        self._figures[key] = fig
        return fig

    def __call__(self, name, start_doc):
        if not self.enabled:
            return [], []
        dimensions = start_doc.get('hints', {}).get('dimensions', guess_dimensions(start_doc))
        rr = RunRouter(
            [factory(self, dimensions) for factory in self.factories])
        rr('start', start_doc)
        return [rr], []
コード例 #6
0
class Bar(Foo):
    b = Unicode('gotit', help="The string b.").tag(config=False)
    c = Float(help="The string c.").tag(config=True)
    bset = Set([]).tag(config=True, multiplicity='+')
    bdict = Dict().tag(config=True, multiplicity='+')