Example #1
0
 def __init__(self, *args):
     self.seleccionado = False
     self.velocity = random.randint(1, 10)
     QGraphicsPixmapItem.__init__(self, *args)
     self.setPixmap(
         QPixmap("sprites/" + str(random.randint(1, 45)) + ".png"))
     self.setTransformOriginPoint(self.boundingRect().width() / 2.0,
                                  self.boundingRect().height() / 2.0)
     self.setZValue(10)
     ##menu contextual
     self.menu = QMenu()
     self.Actions = []  #arreglo de acciones
     self.Actions.append(self.menu.addAction("Seguir"))
     self.Actions.append(self.menu.addAction("Editar"))
     self.Actions.append(self.menu.addAction("girar clockwise"))
     self.Actions.append(self.menu.addAction("girar anti-clockwise"))
     self.Actions.append(self.menu.addAction("Colisiones"))
     self.Actions.append(self.menu.addAction("Duplicar"))
     self.Actions.append(self.menu.addAction("Eliminar"))
     self.menu.triggered[QAction].connect(self.test)
     ##offset para el arrastre
     self.offset = QPointF(0, 0)
     ##poligono de vision
     poligono = QPolygonF()
     poligono.append(QPointF(-1, 10))
     poligono.append(QPointF(-1, 20))
     poligono.append(QPointF(-30, 40))
     poligono.append(QPointF(-40, 15))
     poligono.append(QPointF(-30, -10))
     self.vision = QGraphicsPolygonItem(poligono, self, self.scene())
     self.vision.setBrush(QColor(255, 255, 0, 100))
     self.vision.setPen(QColor(255, 255, 0))
Example #2
0
 def __init__(self, *args):
       self.seleccionado = False
       self.velocity = random.randint(1,10)
       QGraphicsPixmapItem.__init__(self, *args)
       self.setPixmap(QPixmap("sprites/"+str(random.randint(1,45))+".png"))
       self.setTransformOriginPoint(self.boundingRect().width()/2.0,self.boundingRect().height()/2.0)
       self.setZValue(10)
       ##menu contextual
       self.menu = QMenu()
       self.Actions =[] #arreglo de acciones 
       self.Actions.append( self.menu.addAction("Seguir") )
       self.Actions.append( self.menu.addAction("Editar") )
       self.Actions.append( self.menu.addAction("girar clockwise") )
       self.Actions.append( self.menu.addAction("girar anti-clockwise") )
       self.Actions.append( self.menu.addAction("Colisiones") )
       self.Actions.append( self.menu.addAction("Duplicar") )
       self.Actions.append( self.menu.addAction("Eliminar") )
       self.menu.triggered[QAction].connect(self.test)
       ##offset para el arrastre
       self.offset= QPointF(0,0)
       ##poligono de vision
       poligono = QPolygonF()
       poligono.append(QPointF(-1,10))
       poligono.append(QPointF(-1,20))
       poligono.append(QPointF(-30,40))
       poligono.append(QPointF(-40,15))
       poligono.append(QPointF(-30,-10))
       self.vision = QGraphicsPolygonItem(poligono,self,self.scene())
       self.vision.setBrush(QColor(255, 255, 0,100))
       self.vision.setPen(QColor(255, 255, 0))
Example #3
0
 def __init__(self, data, encoding, x0, y0, x1, y1, xsize, ysize):
     p = QPixmap()
     p.loadFromData(data, encoding, Qt.AutoColor)
     w, h = p.width(), p.height()
     p = p.copy(x0, y0, min(w, x1-x0), min(h, y1-y0))
     if p.width() != xsize or p.height() != ysize:
         p = p.scaled(xsize, ysize, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
     QGraphicsPixmapItem.__init__(self, p)
     self.height, self.width = ysize, xsize
     self.setTransformationMode(Qt.SmoothTransformation)
     self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
Example #4
0
 def __init__(self, data, encoding, x0, y0, x1, y1, xsize, ysize):
     p = QPixmap()
     p.loadFromData(data, encoding, Qt.AutoColor)
     w, h = p.width(), p.height()
     p = p.copy(x0, y0, min(w, x1 - x0), min(h, y1 - y0))
     if p.width() != xsize or p.height() != ysize:
         p = p.scaled(xsize, ysize, Qt.IgnoreAspectRatio,
                      Qt.SmoothTransformation)
     QGraphicsPixmapItem.__init__(self, p)
     self.height, self.width = ysize, xsize
     self.setTransformationMode(Qt.SmoothTransformation)
     self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
Example #5
0
 def __init__(o, parent, pieceid, w, h, dominant_colors):
     QGraphicsPixmapItem.__init__(o, parent=parent)
     o.id = pieceid
     o.dominant_colors = dominant_colors
     o.angle_deg = 0
     o.img = None
     o._got_image = False
     # create dummy pixmap, transparent
     pxm = QPixmap(w, h)
     pxm.fill(QColor(0, 0, 0, 0))
     o.setPixmap(pxm)
     o.setTransformationMode(Qt.SmoothTransformation)
Example #6
0
 def __init__(self, *args):
       QGraphicsPixmapItem.__init__(self, *args)
       self.setPixmap(QPixmap("sprites/calle/centro.png"))
       self.setTransformOriginPoint(self.boundingRect().width()/2.0,self.boundingRect().height()/2.0)
       self.setZValue(1)
       self.menu = QMenu()
       self.Actions =[] #arreglo de acciones 
       self.Actions.append( self.menu.addAction("girar clockwise") )
       self.Actions.append( self.menu.addAction("girar anti-clockwise") )
       self.Actions.append( self.menu.addAction("Duplicar") )
       self.Actions.append( self.menu.addAction("Eliminar") )
       self.menu.triggered[QAction].connect(self.test)
       self.offset=QPointF(0,0)
Example #7
0
 def __init__(self, power, color, bot):
     QGraphicsPixmapItem.__init__(self)
     #graphics
     self.maskColor = QtGui.QColor(255, 128, 0)
     self.pixmap = QtGui.QPixmap(os.getcwd() + "/robotImages/blast.png")
     self.setPixmap(self.pixmap)
     self.setColour(color)
     self.isfired = False
     #physics
     self.width = self.boundingRect().width()
     self.height = self.boundingRect().height()
     if power <= 0.5:
         power = 0.5
     elif power >= 10:
         power = 10
     self.power = power
     bsize = power
     if power < 3:
         bsize = 4
     self.pixmap = self.pixmap.scaled(bsize, bsize)
     self.setPixmap(self.pixmap)
     self.robot = bot
Example #8
0
 def __init__(self, face, node, pixmap):
     QGraphicsPixmapItem.__init__(self, pixmap)
     _ActionDelegator.__init__(self)
     self.node = node
Example #9
0
 def __init__(self, face, node, pixmap):
     QGraphicsPixmapItem.__init__(self, pixmap)
     _ActionDelegator.__init__(self)
     self.node = node
 def __init__(self, pathway, objects, *args, **kwargs):
     QGraphicsPixmapItem.__init__(self, *args)
     self.setTransformationMode(Qt.SmoothTransformation)
     self.setPathway(pathway)
     self.setMarkedObjects(objects,
                           name_mapper=kwargs.get("name_mapper", {}))
Example #11
0
 def __init__(self, face, pixmap):
     QGraphicsPixmapItem.__init__(self, pixmap)
Example #12
0
 def __init__(self, pathway, objects, *args, **kwargs):
     QGraphicsPixmapItem.__init__(self, *args)
     self.setTransformationMode(Qt.SmoothTransformation)
     self.setPathway(pathway)
     self.setMarkedObjects(objects,
                           name_mapper=kwargs.get("name_mapper", {}))
Example #13
0
 def __init__(self, icon=None, parent=None):
     QGraphicsPixmapItem.__init__(self, QPixmap(":" + icon), parent)
     self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
     self.setFlag(QGraphicsItem.ItemIsSelectable, True)
     self._moveCheckpoint = None
     self._lines = []