Пример #1
0
 def setup_method(self, method):
     self.data = example_data.test_data()
     self.collect = core.data_collection.DataCollection(list(self.data))
     self.hub = self.collect.hub
     self.session = Session(data_collection=self.collect, hub=self.hub)
     self.widget = LayerTreeWidget(session=self.session)
     self.win = QtWidgets.QMainWindow()
     self.win.setCentralWidget(self.widget)
     self.widget.setup(self.collect)
     for key, value in self.widget._actions.items():
         self.__setattr__("%s_action" % key, value)
Пример #2
0
    def __init__(self, data_collection=None, session=None):
        if session is not None:
            self._session = session
            session.application = self
            self._data = session.data_collection
        else:
            self._data = data_collection or DataCollection()
            self._session = Session(data_collection=self._data,
                                    application=self)

        self._hub = self._session.hub
        self._cmds = self._session.command_stack
        self._cmds.add_callback(self._update_undo_redo_enabled)

        self._settings = {}
        for key, value, validator in settings:
            self._settings[key] = [value, validator]
Пример #3
0
from glue.external.qt import get_qapp, QtGui
from glue.core.session import Session
from glue.core import Data, DataCollection

from viewer import ScatterViewer

data = Data(x=[1, 2, 3], y=[1, 3, 2])
dc = DataCollection([data])

app = get_qapp()

session = Session(application=app, data_collection=dc)

viewer = ScatterViewer(session)

window = QtGui.QWidget()

viewer.add_data(data)

vlayout = QtGui.QVBoxLayout()
vlayout.addWidget(viewer._layer_artist_container[0].style_editor)
vlayout.addWidget(viewer.options_widget())
vwidget = QtGui.QWidget()
vwidget.setLayout(vlayout)

hlayout = QtGui.QHBoxLayout()
hlayout.addWidget(vwidget)
hlayout.addWidget(viewer)

window.setLayout(hlayout)