def __init__(self, size, dynamic, controller): layer.__init__(self,size,dynamic) self.controller = controller self.ready = False dotColor = QColor() dotColor.setNamedColor(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill')) dotColor.setAlphaF(float(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill-opacity'))) self.dotColors = [] i = 0 while i <= 1.0: self.dotColors.append(QColor.fromRgbF(dotColor.redF(),dotColor.greenF(),dotColor.blueF(),i)) i += dotColor.alphaF() self.dotWidth = self.controller.svgLayer.svg.dotPrototype.width() self.dotHeight = self.controller.svgLayer.svg.dotPrototype.height() self.halfDotWidth = self.dotWidth/2 self.halfDotHeight = self.dotHeight/2 self.xoffset = self.controller.scatterBounds[0]-self.halfDotWidth self.yoffset = self.controller.scatterBounds[3]-self.halfDotHeight self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.halfDotWidth self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.halfDotHeight
def __init__(self, size, dynamic, controller, prototypeLine, opaqueBack = False): layer.__init__(self,size,dynamic) self.controller = controller self.points = set() if opaqueBack: self.backgroundColor = Qt.white else: self.backgroundColor = Qt.transparent lineColor = QColor() lineColor.setNamedColor(prototypeLine.getAttribute('stroke')) lineColor.setAlphaF(float(prototypeLine.getAttribute('stroke-opacity'))) self.pen = QPen(lineColor) self.pen.setWidthF(prototypeLine.getAttribute('stroke-width'))
def __init__(self, size, dynamic, controller, prototypeDot): layer.__init__(self,size,dynamic) self.controller = controller self.points = set() self.dotColor = QColor() self.dotColor.setNamedColor(prototypeDot.getAttribute('fill')) self.dotColor.setAlphaF(float(prototypeDot.getAttribute('fill-opacity'))) self.dotWidth = prototypeDot.width() self.xoffset = self.controller.svgLayer.svg.xZeroBar.left()-self.dotWidth/2+1 #self.xoffset = self.controller.scatterBounds[0]-self.dotWidth/2+1 self.dotHeight = prototypeDot.height() self.yoffset = self.controller.svgLayer.svg.yZeroBar.bottom()-self.dotWidth/2+1 #self.yoffset = self.controller.scatterBounds[3]-self.dotHeight/2+1 self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.dotWidth/2 self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.dotHeight/2