Exemple #1
0
    def paintEvent(self, e):
        center = e.rect().center()
        painter = qg.QPainter(self)
        painter.save()
        painter.setWorldTransform(self.flipy)
        try:
            data = mt2beachball(self.moment_tensor,
                                size=self.height() / 2.2,
                                position=(center.x(), center.y()),
                                color_t=self.color,
                                color_p=qc.Qt.white,
                                edgecolor=qc.Qt.black)
            for pdata in data:
                paths, fill, edges, thickness = pdata

                pen = qg.QPen(edges)
                pen.setWidthF(3)
                if fill != 'none':
                    brush = qg.QBrush(fill)
                    painter.setBrush(brush)

                polygon = qg.QPolygonF()
                polygon = make_QPolygonF(*paths.T)
                painter.setRenderHint(qg.QPainter.Antialiasing)
                painter.setPen(pen)
                painter.drawPolygon(polygon)
        except BeachballError as e:
            logger.exception(e)
        finally:
            painter.restore()
Exemple #2
0
    def paintEvent(self, e):
        center = e.rect().center()
        painter = qg.QPainter(self)
        painter.save()
        painter.setWorldTransform(self.flipy)
        try:
            data = mt2beachball(
                self.moment_tensor, size=self.height()/2.2,
                position=(center.x(), center.y()),
                color_t=self.color, color_p=qc.Qt.white, edgecolor=qc.Qt.black)
            for pdata in data:
                paths, fill, edges, thickness = pdata

                pen = qg.QPen(edges)
                pen.setWidthF(3)
                if fill != 'none':
                    brush = qg.QBrush(fill)
                    painter.setBrush(brush)

                polygon = qg.QPolygonF()
                polygon = make_QPolygonF(*paths.T)
                painter.setRenderHint(qg.QPainter.Antialiasing)
                painter.setPen(pen)
                painter.drawPolygon(polygon)
        except BeachballError as e:
            logger.exception(e)
        finally:
            painter.restore()
Exemple #3
0
 def paintEvent(self, e):
     center = e.rect().center()
     painter = qg.QPainter(self)
     painter.save()
     painter.setMatrix(self.flipy)
     try:
         data = mt2beachball(self.moment_tensor, size=self.height()/2.2,
                             position=(center.x(), center.y()))
         for pdata in data:
             paths, fill, edges, thickness = pdata
             brush, pen = self.brushs_pens[fill]
             polygon = qg.QPolygonF()
             polygon = make_QPolygonF(*paths.T)
             painter.setRenderHint(qg.QPainter.Antialiasing)
             painter.setBrush(brush)
             painter.setPen(pen)
             painter.drawPolygon(polygon)
     except BeachballError as e:
         logger.exception(e)
     finally:
         painter.restore()
Exemple #4
0
 def paintEvent(self, e):
     center = e.rect().center()
     painter = qg.QPainter(self)
     painter.save()
     painter.setMatrix(self.flipy)
     try:
         data = mt2beachball(self.moment_tensor,
                             size=self.height() / 2.2,
                             position=(center.x(), center.y()))
         for pdata in data:
             paths, fill, edges, thickness = pdata
             brush, pen = self.brushs_pens[fill]
             polygon = qg.QPolygonF()
             polygon = make_QPolygonF(*paths.T)
             painter.setRenderHint(qg.QPainter.Antialiasing)
             painter.setBrush(brush)
             painter.setPen(pen)
             painter.drawPolygon(polygon)
     except BeachballError as e:
         logger.exception(e)
     finally:
         painter.restore()