Example #1
0
 def set_color(self, color):
     if color != self._color:
         self._color = color
         self.emit(QtCore.SIGNAL("colorChanged(QColor)"), self._color)
         pixmap = QtGui.QPixmap(self.iconSize())
         pixmap.fill(color)
         self.setIcon(QtGui.QIcon(pixmap))
Example #2
0
 def set_color(self, color):
     if color != self._color:
         self._color = color
         self.colorChanged.emit(self._color)
         pixmap = QtGui.QPixmap(self.iconSize())
         pixmap.fill(color)
         self.setIcon(QtGui.QIcon(pixmap))
Example #3
0
    def __init__(self, canvas, num):
        FigureManagerBase.__init__(self, canvas, num)
        self.canvas = canvas
        self.window = FigureWindow()
        self.window.closing.connect(canvas.close_event)
        self.window.closing.connect(self._widgetclosed)

        self.window.setWindowTitle("Figure %d" % num)
        image = os.path.join(matplotlib.rcParams['datapath'], 'images',
                             'matplotlib.png')
        self.window.setWindowIcon(QtGui.QIcon(image))

        # Give the keyboard focus to the figure instead of the
        # manager; StrongFocus accepts both tab and click to focus and
        # will enable the canvas to process event w/o clicking.
        # ClickFocus only takes the focus is the window has been
        # clicked
        # on. http://qt-project.org/doc/qt-4.8/qt.html#FocusPolicy-enum or
        # http://doc.qt.digia.com/qt/qt.html#FocusPolicy-enum
        self.canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.canvas.setFocus()

        self.window._destroying = False

        # No toolbar in figure currently
        self.toolbar = None
        tbs_height = 0

        # resize the main window so it will display the canvas with the
        # requested size:
        cs = canvas.sizeHint()
        self._status_and_tool_height = tbs_height
        height = cs.height() + self._status_and_tool_height
        self.window.resize(cs.width(), height)

        self.window.setWidget(self.canvas)

        _on_new_figure(self.window)

        if matplotlib.is_interactive():
            self.window.show()

        def notify_axes_change(fig):
            # This will be called whenever the current axes is changed
            if self.toolbar is not None:
                self.toolbar.update()

        self.canvas.figure.add_axobserver(notify_axes_change)
Example #4
0
File: ToolBar.py Project: uheee/FCY
 def _icon(self, name):
     return QtGui.QIcon(os.path.join(self.basedir, name))
Example #5
0
def get_icon(name):
    import matplotlib
    basedir = osp.join(matplotlib.rcParams['datapath'], 'images')
    return QtGui.QIcon(osp.join(basedir, name))