Commit 4450cb6d authored by Maxime Perrotin's avatar Maxime Perrotin

Add antialiasing to MSC graphs

parent 092b282f
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
# */ # */
#****************************************************************************** #******************************************************************************
from PySide.QtCore import Qt from PySide.QtCore import Qt
from PySide.QtGui import QPen from PySide.QtGui import QPen, QPainterPath, QGraphicsPathItem, QPainter
from PySide.QtGui import QPainterPath
from PySide.QtGui import QGraphicsPathItem
class MscArrowHead(QGraphicsPathItem): class MscArrowHead(QGraphicsPathItem):
...@@ -80,3 +78,7 @@ class MscArrowHead(QGraphicsPathItem): ...@@ -80,3 +78,7 @@ class MscArrowHead(QGraphicsPathItem):
self.drawOriginX = self.width self.drawOriginX = self.width
self.drawOriginY = - (self.height / 2.0) self.drawOriginY = - (self.height / 2.0)
self.updatePath() self.updatePath()
def paint(self, painter, option, widget):
painter.setRenderHint(QPainter.Antialiasing, True)
super(MscArrowHead, self).paint(painter, option, widget)
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# Copyright (c) 2012 European Space Agency # Copyright (c) 2012 European Space Agency
# #
#****************************************************************************** #******************************************************************************
from PySide.QtGui import QPainterPath, QPen, QBrush, QColor from PySide.QtGui import QPainterPath, QPen, QBrush, QColor, QPainter
from PySide.QtCore import Qt, Slot, QPointF from PySide.QtCore import Qt, Slot, QPointF
from msccore import MscCondition from msccore import MscCondition
...@@ -133,7 +133,7 @@ class MscGraphCondition(MscGraphItem): ...@@ -133,7 +133,7 @@ class MscGraphCondition(MscGraphItem):
# Paint Functions # Paint Functions
#************************************************************************** #**************************************************************************
def initilizeGraphics(self): def initilizeGraphics(self):
self.color = Qt.blue self.color = Qt.black
self.pen = QPen(self.color, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin) self.pen = QPen(self.color, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)
self.brush = QBrush(QColor(255, 255, 202)) self.brush = QBrush(QColor(255, 255, 202))
...@@ -154,12 +154,22 @@ class MscGraphCondition(MscGraphItem): ...@@ -154,12 +154,22 @@ class MscGraphCondition(MscGraphItem):
Create the path of Timer Create the path of Timer
""" """
self.path = QPainterPath() self.path = QPainterPath()
self.path.addRect(-self.DefaultWidth / 2, 0, self.path.moveTo(5, 0)
self.DefaultWidth, self.DefaultHeight) self.path.lineTo(0, self.DefaultHeight / 2)
self.path.lineTo(5, self.DefaultHeight)
self.path.lineTo(self.DefaultWidth - 5, self.DefaultHeight)
self.path.lineTo(self.DefaultWidth, self.DefaultHeight / 2)
self.path.lineTo(self.DefaultWidth - 5, 0)
self.path.lineTo(5, 0)
self.path.translate(-self.DefaultWidth / 2, 0)
#self.path.addRect(-self.DefaultWidth / 2, 0,
# self.DefaultWidth, self.DefaultHeight)
# Set correct values of x, y, width and height # Set correct values of x, y, width and height
self.updateBounding() self.updateBounding()
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
painter.setPen(self.pen) painter.setPen(self.pen)
painter.setBrush(self.brush) painter.setBrush(self.brush)
painter.setRenderHint(QPainter.Antialiasing, True)
painter.drawPath(self.path) painter.drawPath(self.path)
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
# Copyright (c) 2012 European Space Agency # Copyright (c) 2012 European Space Agency
# #
#****************************************************************************** #******************************************************************************
from PySide.QtGui import QPen, QGraphicsRectItem from PySide.QtGui import QPen, QGraphicsRectItem, QLinearGradient, QPainter
from PySide.QtGui import QLinearGradient
from PySide.QtCore import Qt, QPointF, Slot from PySide.QtCore import Qt, QPointF, Slot
import msccore import msccore
...@@ -322,6 +321,7 @@ class MscGraphInstance(MscGraphItem): ...@@ -322,6 +321,7 @@ class MscGraphInstance(MscGraphItem):
def paint(self, painter, option, widget=None): def paint(self, painter, option, widget=None):
''' Paint the instance Axis Symbol ''' ''' Paint the instance Axis Symbol '''
painter.setPen(QPen(self.pen).setColor(Qt.black)) painter.setPen(QPen(self.pen).setColor(Qt.black))
painter.setRenderHint(QPainter.Antialiasing, True)
painter.drawLine(0, 0, 0, self.bodySize) painter.drawLine(0, 0, 0, self.bodySize)
#************************************************************************** #**************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment