예제 #1
0
    def __init__(self, collect, default=None, parent=None):
        """Create a new dialog for subset faceting

        :param collect: The :class:`~glue.core.data_collection.DataCollection` to use
        :param default: The default dataset in the collection (optional)
        """

        super(SubsetFacet, self).__init__(parent=parent)

        self.ui = load_ui('subset_facet.ui',
                          self,
                          directory=os.path.dirname(__file__))
        self.ui.setWindowTitle("Subset Facet")
        self._collect = collect

        self.ui.component_selector.setup(self._collect)
        if default is not None:
            self.ui.component_selector.data = default

        val = QtGui.QDoubleValidator(-1e100, 1e100, 4, None)
        self.ui.component_selector.component_changed.connect(self._set_limits)

        combo = self.ui.color_scale
        for cmap in [cm.cool, cm.RdYlBu, cm.RdYlGn, cm.RdBu, cm.Purples]:
            combo.addItem(QtGui.QIcon(cmap2pixmap(cmap)), cmap.name, cmap)
예제 #2
0
파일: helpers.py 프로젝트: PennyQ/glue
def layer_artist_icon(artist):
    """Create a QtGui.QIcon for a LayerArtist instance"""

    # TODO: need a test for this

    from glue.viewers.scatter.layer_artist import ScatterLayerArtist

    color = artist.get_layer_color()

    if isinstance(color, Colormap):
        pm = cmap2pixmap(color)
    else:
        if isinstance(artist, ScatterLayerArtist):
            bm = QtGui.QBitmap(icon_path(POINT_ICONS.get(artist.layer.style.marker,
                                                         'glue_circle_point')))
        else:
            bm = QtGui.QBitmap(icon_path('glue_box_point'))
        color = mpl_to_qt4_color(color)
        pm = tint_pixmap(bm, color)

    return QtGui.QIcon(pm)
예제 #3
0
파일: helpers.py 프로젝트: dhomeier/glue
def layer_artist_icon(artist):
    """Create a QtGui.QIcon for a LayerArtist instance"""

    # TODO: need a test for this

    from glue.viewers.scatter.layer_artist import ScatterLayerArtist

    color = artist.get_layer_color()

    if isinstance(color, Colormap):
        pm = cmap2pixmap(color)
    else:
        if isinstance(artist, ScatterLayerArtist):
            bm = QtGui.QBitmap(icon_path(POINT_ICONS.get(artist.layer.style.marker,
                                                         'glue_circle_point')))
        else:
            bm = QtGui.QBitmap(icon_path('glue_box_point'))
        color = mpl_to_qt_color(color)
        pm = tint_pixmap(bm, color)

    return QtGui.QIcon(pm)
예제 #4
0
파일: subset_facet.py 프로젝트: rguter/glue
    def __init__(self, collect, default=None, parent=None):
        """Create a new dialog for subset faceting

        :param collect: The :class:`~glue.core.data_collection.DataCollection` to use
        :param default: The default dataset in the collection (optional)
        """
        self.ui = load_ui('subset_facet.ui', None,
                          directory=os.path.dirname(__file__))
        self.ui.setWindowTitle("Subset Facet")
        self._collect = collect

        self.ui.component_selector.setup(self._collect)
        if default is not None:
            self.ui.component_selector.data = default

        val = QtGui.QDoubleValidator(-1e100, 1e100, 4, None)
        self.ui.component_selector.component_changed.connect(self._set_limits)

        combo = self.ui.color_scale
        for cmap in [cm.cool, cm.RdYlBu, cm.RdYlGn, cm.RdBu, cm.Purples]:
            combo.addItem(QtGui.QIcon(cmap2pixmap(cmap)), cmap.name, cmap)
예제 #5
0
 def __init__(self, label, cmap, parent):
     super(ColormapAction, self).__init__(label, parent)
     self.cmap = cmap
     pm = cmap2pixmap(cmap)
     self.setIcon(QtGui.QIcon(pm))
예제 #6
0
 def __init__(self, label, cmap, parent):
     super(ColormapAction, self).__init__(label, parent)
     self.cmap = cmap
     pm = cmap2pixmap(cmap)
     self.setIcon(QtGui.QIcon(pm))