def __init__(self, application, parent=None): """ :param application: The Glue application to which this is attached :type application: :class:`~glue.app.qt.application.GlueApplication` """ super(GlueMdiArea, self).__init__(parent) self._application = application self.setAcceptDrops(True) self.setAttribute(Qt.WA_DeleteOnClose) self.setBackground(QtGui.QBrush(QtGui.QColor(250, 250, 250))) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
def status_pixmap(attention=False): """ A small icon to grab attention :param attention: If True, return attention-grabbing pixmap """ color = Qt.red if attention else Qt.lightGray pm = QtGui.QPixmap(15, 15) p = QtGui.QPainter(pm) b = QtGui.QBrush(color) p.fillRect(-1, -1, 20, 20, b) return pm
def get_painter(self, canvas): p = QtGui.QPainter(canvas) facecolor = mpl_to_qt4_color(self.plot_opts['facecolor'], self.plot_opts['alpha']) edgecolor = mpl_to_qt4_color(self.plot_opts['edgecolor'], self.plot_opts['alpha']) pen = QtGui.QPen(edgecolor) pen.setWidth(self.plot_opts.get('edgewidth', 0)) p.setPen(pen) p.setBrush(QtGui.QBrush(facecolor)) return p