Exemplo n.º 1
0
    def _build_widget_subclass(cls):
        """
        Build the DataViewer subclass for this viewer
        """
        props = CustomWidgetBase._property_set + list(cls.ui.keys())
        widget_dict = {'LABEL': cls.name,
                       'ui': cls.ui,
                       'coordinator_cls': cls,
                       '_property_set': props}
        widget_dict.update(**dict((k, FormDescriptor(k))
                                  for k in cls.ui))
        widget_cls = type('%sWidget' % cls.__name__,
                          (CustomWidgetBase,),
                          widget_dict)

        cls._widget_cls = widget_cls
        qt_client.add(widget_cls)

        # add new classes to module namespace
        # needed for proper state saving/restoring
        for c in [widget_cls, cls]:
            w = getattr(getmodule(ViewerState), c.__name__, None)
            if w is not None:
                raise RuntimeError("Duplicate custom viewer detected %s" % c)

            setattr(getmodule(ViewerState), c.__name__, c)
Exemplo n.º 2
0
def glue_setup():
    try:
        from .external.glue.data_viewer import SpecVizViewer
        from glue.config import qt_client
        qt_client.add(SpecVizViewer)
    except ImportError:
        logging.warning("Failed to import SpecVizViewer; Glue installation not found.")
Exemplo n.º 3
0
def setup():
    """

    """
    from glue.config import qt_client
    from .viewer import SpecvizDataViewer
    qt_client.add(SpecvizDataViewer)
Exemplo n.º 4
0
def setup():
    from .viewers.mos_viewer import MOSVizViewer
    from glue.config import qt_client
    from .plugins.cutout_tool import nIRSpec_cutout_tool
    from .plugins.cutout_tool import general_cutout_tool
    from .plugins.table_generator import nIRSpec_table_gen
    qt_client.add(MOSVizViewer)
Exemplo n.º 5
0
def setup():
    from .viewers.mos_viewer import MOSVizViewer
    from glue.config import qt_client
    from .plugins.cutout_tool import nIRSpec_cutout_tool
    from .plugins.cutout_tool import general_cutout_tool
    from .plugins.table_generator import nIRSpec_table_gen
    from .startup import mosviz_setup
    qt_client.add(MOSVizViewer)
Exemplo n.º 6
0
def setup():
    try:
        from .qt.viewer_widget import GingaWidget
    except ImportError:
        raise ImportError("ginga is required")
    else:
        from glue.config import qt_client
        qt_client.add(GingaWidget)
Exemplo n.º 7
0
def setup():
    try:
        from .qt_widget import GingaWidget
    except ImportError:
        raise ImportError("ginga is required")
    else:
        from glue.config import qt_client
        qt_client.add(GingaWidget)
Exemplo n.º 8
0
    def _build_data_viewer(cls):
        """
        Build the DataViewer subclass for this viewer.
        """

        # At this point, the metaclass has put all the user options in a dict
        # called .ui, so we go over this dictionary and find the widgets and
        # callback properties for each of them.

        widgets = {}
        properties = {}

        for name in sorted(cls.ui):

            value = cls.ui[name]
            prefix, widget, property = FormElement.auto(value).ui_and_state()

            if widget is not None:
                widgets[name] = prefix, widget

            properties[name] = property

        options_cls = type(cls.__name__ + 'OptionsWidget',
                           (BaseCustomOptionsWidget, ), {'_widgets': widgets})

        state_cls = type(cls.__name__ + 'ViewerState',
                         (CustomMatplotlibViewerState, ), properties)

        widget_dict = {
            'LABEL': cls.name,
            'ui': cls.ui,
            '_options_cls': options_cls,
            '_state_cls': state_cls,
            '_coordinator_cls': cls
        }

        viewer_cls = type(cls.__name__ + 'DataViewer',
                          (CustomMatplotlibDataViewer, ), widget_dict)

        cls._viewer_cls = viewer_cls
        qt_client.add(viewer_cls)

        # add new classes to module namespace
        # needed for proper state saving/restoring
        for c in [viewer_cls, cls]:
            mod = getmodule(ViewerUserState)
            w = getattr(mod, c.__name__, None)
            if w is not None:
                raise RuntimeError("Duplicate custom viewer detected %s" % c)
            setattr(mod, c.__name__, c)
            c.__module__ = mod.__name__
Exemplo n.º 9
0
def setup():

    from . import loaders
    from . import subset_ops
    from . import viewers
    from . import tools
    from . import clients

    from glue.config import qt_client
    from .qt.spectra_widget import SpectraWindow
    qt_client.add(SpectraWindow)

    from .qt.table_widget import TableWindow
    qt_client.add(TableWindow)
Exemplo n.º 10
0
    def _build_data_viewer(cls):
        """
        Build the DataViewer subclass for this viewer.
        """

        # At this point, the metaclass has put all the user options in a dict
        # called .ui, so we go over this dictionary and find the widgets and
        # callback properties for each of them.

        widgets = {}
        properties = {}

        for name in sorted(cls.ui):

            value = cls.ui[name]
            prefix, widget, property = FormElement.auto(value).ui_and_state()

            if widget is not None:
                widgets[name] = prefix, widget

            properties[name] = property

        options_cls = type(cls.__name__ + 'OptionsWidget',
                           (BaseCustomOptionsWidget,), {'_widgets': widgets})

        state_cls = type(cls.__name__ + 'ViewerState', (CustomMatplotlibViewerState,), properties)

        widget_dict = {'LABEL': cls.name,
                       'ui': cls.ui,
                       '_options_cls': options_cls,
                       '_state_cls': state_cls,
                       '_coordinator_cls': cls}

        viewer_cls = type(cls.__name__ + 'DataViewer',
                          (CustomMatplotlibDataViewer,),
                          widget_dict)

        cls._viewer_cls = viewer_cls
        qt_client.add(viewer_cls)

        # add new classes to module namespace
        # needed for proper state saving/restoring
        for c in [viewer_cls, cls]:
            mod = getmodule(ViewerUserState)
            w = getattr(mod, c.__name__, None)
            if w is not None:
                raise RuntimeError("Duplicate custom viewer detected %s" % c)
            setattr(mod, c.__name__, c)
            c.__module__ = mod.__name__
Exemplo n.º 11
0
def glue_setup():
    try:
        import glue  # noqa
    except ImportError:
        logging.warning("Failed to import SpecVizViewer; Glue installation "
                        "not found.")
        return

    # Check that the version of glue is recent enough
    from distutils.version import LooseVersion
    from glue import __version__
    if LooseVersion(__version__) < LooseVersion('0.10.2'):
        raise Exception("glue 0.10.2 or later is required for the specviz "
                        "plugin")

    from .third_party.glue.data_viewer import SpecVizViewer
    from glue.config import qt_client
    qt_client.add(SpecVizViewer)
Exemplo n.º 12
0
def setup():
    from glue.config import qt_client
    qt_client.add(HistogramViewer)
Exemplo n.º 13
0
def setup():
    from glue.config import qt_client
    qt_client.add(DendrogramViewer)
Exemplo n.º 14
0
def setup():
    from .isosurface_viewer import VispyIsosurfaceViewer
    from glue.config import qt_client
    qt_client.add(VispyIsosurfaceViewer)
Exemplo n.º 15
0
        super(TutorialLayerStateWidget, self).__init__()

        self.checkbox = QCheckBox('Fill markers')
        layout = QVBoxLayout()
        layout.addWidget(self.checkbox)
        self.setLayout(layout)

        self.layer_state = layer_artist.state
        connect_checkable_button(self.layer_state, 'fill', self.checkbox)


class TutorialDataViewer(DataViewer):

    LABEL = 'Tutorial viewer'
    _state_cls = TutorialViewerState
    _options_cls = TutorialViewerStateWidget
    _layer_style_widget_cls = TutorialLayerStateWidget
    _data_artist_cls = TutorialLayerArtist
    _subset_artist_cls = TutorialLayerArtist

    def __init__(self, *args, **kwargs):
        super(TutorialDataViewer, self).__init__(*args, **kwargs)
        self.axes = plt.subplot(1, 1, 1)
        self.setCentralWidget(self.axes.figure.canvas)

    def get_layer_artist(self, cls, layer=None, layer_state=None):
        return cls(self.axes, self.state, layer=layer, layer_state=layer_state)


qt_client.add(TutorialDataViewer)
Exemplo n.º 16
0
def setup():
    from glue.config import qt_client
    from .qt import TableViewer
    qt_client.add(TableViewer)
Exemplo n.º 17
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import HistogramViewer
    qt_client.add(HistogramViewer)
Exemplo n.º 18
0
def setup():
    from glue.config import qt_client
    from .qt.viewer_widget import DendroWidget
    from .data_factory import load_dendro

    qt_client.add(DendroWidget)
Exemplo n.º 19
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import DendrogramViewer
    from .data_factory import load_dendro  # noqa
    qt_client.add(DendrogramViewer)
Exemplo n.º 20
0
def setup():
    from .scatter_viewer import VispyScatterViewer
    from glue.config import qt_client
    qt_client.add(VispyScatterViewer)
Exemplo n.º 21
0
def setup():
    from .viewer.data_viewer import WWTDataViewer
    from glue.config import qt_client
    qt_client.add(WWTDataViewer)
Exemplo n.º 22
0
def setup():
    from .data_viewer import SpecVizViewer, MOSVizViewer
    from glue.config import qt_client
    qt_client.add(SpecVizViewer)
    qt_client.add(MOSVizViewer)
Exemplo n.º 23
0
# from circularTree import CircularTree
from document4 import Window
import sys
import networkx as nx
from PyQt4 import QtGui, QtCore


class MyGlueWidget(DataViewer):
    LABEL = "My first data viewer"

    def __init__(self, session, parent=None):
        super(MyGlueWidget, self).__init__(session, parent=parent)
        self.my_widget = Window()
        self.my_widget.show()
        # self.setCentralWidget(self.my_widget)
        # self.add_data()

    def add_data(self):
        print("here?\n")
        self.my_widget.setWindowTitle("MyWindow")
        # self.my_widget.dummyFunc()
        self.my_widget.show()
        print("here????\n")
        return True


# Register the viewer with glue
from glue.config import qt_client

qt_client.add(MyGlueWidget)
Exemplo n.º 24
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import ScatterViewer
    qt_client.add(ScatterViewer)
Exemplo n.º 25
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import ImageViewer
    qt_client.add(ImageViewer)
Exemplo n.º 26
0
def setup():
    from .volume_viewer import VispyVolumeViewer
    from glue.config import qt_client
    qt_client.add(VispyVolumeViewer)
Exemplo n.º 27
0
def setup():
    from glue.config import qt_client
    qt_client.add(ScatterViewer)
Exemplo n.º 28
0
def setup():
    from glue.config import qt_client
    qt_client.add(ImageViewer)
Exemplo n.º 29
0
def setup():
    from .data_viewer import MyViewer
    from glue.config import qt_client
    qt_client.add(MyViewer)
Exemplo n.º 30
0
def setup():
    from .viewer import OpenSpaceDataViewer
    from glue.config import qt_client
    qt_client.add(OpenSpaceDataViewer)
Exemplo n.º 31
0
from __future__ import absolute_import, division, print_function

from glue import custom_viewer
from glue.viewers.custom.qt import CustomViewer
import lasagna.glueviz
from glue.viewers.table.qt import TableWidget
from glue.config import qt_client

qt_client.add(TableWidget)

"""Declare any extra link functions like this"""
# @link_function(info='translates A to B', output_labels=['b'])
# def a_to_b(a):
#    return a * 3


"""Data factories take a filename as input and return a Data object"""
# @data_factory('JPEG Image')
# def jpeg_reader(file_name):
#    ...
#    return data


"""Extra qt clients"""
# qt_client(ClientClass)


# placeholder due to glue's bizarre import and introspection scheme
# allows live updates to callbacks by reloading lasagna.glueviz

class Fiji(CustomViewer):
Exemplo n.º 32
0
def setup():
    from .volume_viewer import VispyVolumeViewer
    from glue.config import qt_client
    qt_client.add(VispyVolumeViewer)
Exemplo n.º 33
0
def setup():
    from glue.config import qt_client
    from .qt import HistogramWidget
    qt_client.add(HistogramWidget)
Exemplo n.º 34
0
def setup():
    from glue.config import qt_client
    qt_client.add(ProfileViewer)
Exemplo n.º 35
0
def setup():
    from glue.config import qt_client
    from .qt import ImageWidget
    qt_client.add(ImageWidget)
Exemplo n.º 36
0
def setup():
    from .data_viewer import SpecvizViewer
    from glue.config import qt_client
    qt_client.add(SpecvizViewer)
Exemplo n.º 37
0
def setup():
    from .data_viewer import PyspeckitViewer
    from glue.config import qt_client
    qt_client.add(PyspeckitViewer)
Exemplo n.º 38
0
def setup():
    from .viewers.mos_viewer import MOSVizViewer
    from glue.config import qt_client
    qt_client.add(MOSVizViewer)
Exemplo n.º 39
0
def setup():
    from glue.config import qt_client
    from .qt import TableWidget
    qt_client.add(TableWidget)
Exemplo n.º 40
0
def setup():
    from glue.config import qt_client
    from .qt.viewer_widget import DendroWidget
    from .data_factory import load_dendro
    qt_client.add(DendroWidget)
Exemplo n.º 41
0
def setup():
    from .qt_widget import DendroWidget
    from glue.config import qt_client
    qt_client.add(DendroWidget)
Exemplo n.º 42
0
def setup():
    from .data_viewer import AladinLiteViewer
    from glue.config import qt_client
    qt_client.add(AladinLiteViewer)
Exemplo n.º 43
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import ProfileViewer
    qt_client.add(ProfileViewer)
Exemplo n.º 44
0
import loaders
import subset_ops
import viewers
import tools

from glue.config import qt_client
from cube_tools.qt.spectra_widget import SpectraWindow
qt_client.add(SpectraWindow)
Exemplo n.º 45
0
def setup():
    from .viewer.data_viewer import WWTDataViewer
    from glue.config import qt_client
    qt_client.add(WWTDataViewer)
Exemplo n.º 46
0
        super(TutorialLayerStateWidget, self).__init__()

        self.checkbox = QCheckBox('Fill markers')
        layout = QVBoxLayout()
        layout.addWidget(self.checkbox)
        self.setLayout(layout)

        self.layer_state = layer_artist.state
        connect_checkable_button(self.layer_state, 'fill', self.checkbox)


class TutorialDataViewer(DataViewer):

    LABEL = 'Tutorial viewer'
    _state_cls = TutorialViewerState
    _options_cls = TutorialViewerStateWidget
    _layer_style_widget_cls = TutorialLayerStateWidget
    _data_artist_cls = TutorialLayerArtist
    _subset_artist_cls = TutorialLayerArtist

    def __init__(self, *args, **kwargs):
        super(TutorialDataViewer, self).__init__(*args, **kwargs)
        self.axes = plt.subplot(1, 1, 1)
        self.setCentralWidget(self.axes.figure.canvas)

    def get_layer_artist(self, cls, layer=None, layer_state=None):
        return cls(self.axes, self.state, layer=layer, layer_state=layer_state)


qt_client.add(TutorialDataViewer)
Exemplo n.º 47
0
def setup():
    from glue.config import qt_client
    from .qt.data_viewer import HistogramViewer_mod
    qt_client.add(HistogramViewer_mod)
Exemplo n.º 48
0
def setup():
    from glue.config import qt_client
    from .qt import ScatterWidget
    qt_client.add(ScatterWidget)