示例#1
0
 def __init__(self, model, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.model = model
     layout = QHBoxLayout()
     self.setLayout(layout)
     layout.addWidget(QtSearchListWithButton(model.searches))
     layout.addWidget(QtFigures(model.viewer.figures))
示例#2
0
 def __init__(self, model, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.model = model
     layout = QHBoxLayout()
     self.setLayout(layout)
     layout.addWidget(QtSearchWithButton(model.search))
     plot_layout = QVBoxLayout()
     plot_layout.addWidget(QtAddCustomPlot(self.model))
     plot_layout.addWidget(QtFigures(model.auto_plot_builder.figures))
     layout.addLayout(plot_layout)
示例#3
0
 def __init__(self, model, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.model = model
     layout = QHBoxLayout()
     self.setLayout(layout)
     layout.addWidget(QtSearchWithButton(model.search))
     plot_layout = QVBoxLayout()
     plot_layout.addWidget(QtAddCustomPlot(self.model))
     # How would this work with a list of auto plot builders?
     for auto_plot_builder in self.model.auto_plot_builders:
         plot_layout.addWidget(QtFigures(auto_plot_builder.figures))
     layout.addLayout(plot_layout)
 def __init__(self, parent):
     BaseWidget.__init__(self, parent)
     #self.searches = SearchListWithButton()
     #QtSearchListWithButton.__init__(self, self.searches)
     QtFigures.__init__(self, FigureSpecList(), parent=parent)
示例#5
0
"""
Use within IPython like

ipython --gui=qt

In [1]: %run -m bluesky_widgets.examples.ipy_qt_images
"""
from bluesky_widgets.examples.utils.generate_msgpack_data import get_catalog
from bluesky_widgets.models.auto_plot_builders import AutoImages
from bluesky_widgets.qt.figures import QtFigures

catalog = get_catalog()
counts = catalog.search({"plan_name": "count"})
run = counts[-1]

model = AutoImages()

model.add_run(run)
view = QtFigures(model.figures)
view.show()
示例#6
0
def main():
    # First, some boilerplate to make a super-minimal Qt application that we want
    # to add some bluesky-widgets components into.
    app = QApplication(["Some App"])
    window = QMainWindow()
    central_widget = QWidget(window)
    window.setCentralWidget(central_widget)
    central_widget.setLayout(QVBoxLayout())
    central_widget.layout().addWidget(QLabel("This is part of the 'original' app."))
    window.show()

    # *** INTEGRATION WITH BLUESKY-WIDGETS STARTS HERE. ***

    # Ensure that any background workers started by bluesky-widgets stop
    # gracefully when the application closes.
    from bluesky_widgets.qt.threading import wait_for_workers_to_quit

    app.aboutToQuit.connect(wait_for_workers_to_quit)

    # Model a list of figures.
    # This will generate line plot automatically based on the structure (shape)
    # of the data and its hints. Other models could be used for more explicit
    # control of what gets plotted. See the examples in
    # http://blueskyproject.io/bluesky-widgets/reference.html#plot-builders
    from bluesky_widgets.models.auto_plot_builders import AutoLines

    model = AutoLines(max_runs=3)

    # Feed it data from the RunEngine. In actual practice, the RunEngine should
    # be in a separate process and we should be receiving these documents
    # over a network via publish--subscribe. See
    # bluesky_widgets.examples.advanced.qt_viewer_with_search for an example of
    # that. Here, we keep it simple.
    from bluesky_widgets.utils.streaming import stream_documents_into_runs
    from bluesky import RunEngine

    RE = RunEngine()
    RE.subscribe(stream_documents_into_runs(model.add_run))

    # Add a tabbed pane of figures to the app.
    from bluesky_widgets.qt.figures import QtFigures

    view = QtFigures(model.figures)  # view is a QWidget
    central_widget.layout().addWidget(view)

    # When the model receives data or is otherwise updated, any changes to
    # model.figures will be reflected in changes to the view.

    # Just for this example, generate some data before starting this app.
    # Again, in practice, this should happen in a separate process and send
    # the results over a network.

    from bluesky.plans import scan
    from ophyd.sim import motor, det

    def plan():
        for i in range(1, 5):
            yield from scan([det], motor, -1, 1, 1 + 2 * i)

    RE(plan())

    # *** INTEGRATION WITH BLUESKY-WIDGETS ENDS HERE. ***

    # Run the app.
    app.exec_()
示例#7
0
def start_dichro_plot(monitor='Ion Ch 4', detector='Ion Ch 5', fluo=True):
    model = AutoDichroPlot(monitor=monitor, detector=detector, fluo=fluo)
    view = QtFigures(model.figures)
    view.show()
    RE.subscribe(stream_documents_into_runs(model.add_run))
    return model, view