|
|
@@ -14,17 +14,24 @@ class EcranFondPlateau(QGraphicsScene):
|
|
|
|
|
|
self.connect(self.fenetre.ui.cbt_vue, SIGNAL("resizeEvent()"), self.actu)
|
|
|
self.fenetre.connect(self.fenetre.ui.cbt_vue, SIGNAL("resizeEvent()"), self.actu)
|
|
|
- self.cmdEnCours = CommandeFondPlateau(self, "creer", "img\\cmdVue_cbt.png", "Afficher le dernier combat", 10, 15, 30, 60)
|
|
|
+ self.cmdEnCours = CommandeFondPlateau(self, "creer", "img\\cmdVue_cbt.png", "Afficher le dernier combat", 15, 15, 30, 60)
|
|
|
self.cmdEnCours.creer()
|
|
|
- self.cmdCharger = CommandeFondPlateau(self, "charger", "img\\cmdVue_ouvrir.png", "Charger un combat", 60, 15, 30, 60)
|
|
|
+ self.cmdCharger = CommandeFondPlateau(self, "charger", "img\\cmdVue_ouvrir.png", "Charger un combat", 65, 15, 30, 60)
|
|
|
self.cmdCharger.creer()
|
|
|
- self.cmdCreer = CommandeFondPlateau(self, "enCours", "img\\cmdVue_plus.png", "Créer un nouveau combat", 35, 60, 30, 60)
|
|
|
+ self.cmdCreer = CommandeFondPlateau(self, "enCours", "img\\cmdVue_plus.png", "Créer un nouveau combat", 40, 60, 30, 60)
|
|
|
self.cmdCreer.creer()
|
|
|
|
|
|
self.setSceneRect(QRectF())
|
|
|
self.fenetre.ui.cbt_vue.fitInView(self.sceneRect(), Qt.KeepAspectRatioByExpanding)
|
|
|
|
|
|
-
|
|
|
+ self.txt = QGraphicsTextItem()
|
|
|
+ self.txt.setPos(QPointF(0,0))
|
|
|
+ self.txt.setFont(QFont("Stencil", 18))
|
|
|
+## self.txt.setGraphicsEffect(QGraphicsColorizeEffect())
|
|
|
+ self.txt.setDefaultTextColor(QColor(100,150,200))
|
|
|
+ self.txt.setVisible(False)
|
|
|
+ self.addItem(self.txt)
|
|
|
+
|
|
|
def actu(self):
|
|
|
self.setSceneRect(0, 0, 0.8*self.fenetre.ui.cbt_vue.width(), 0.8*self.fenetre.ui.cbt_vue.height())
|
|
|
self.cmdEnCours.actu()
|
|
|
@@ -41,6 +48,24 @@ class EcranFondPlateau(QGraphicsScene):
|
|
|
print "en cours"
|
|
|
else:
|
|
|
print "Commande invalide"
|
|
|
+
|
|
|
+ def majTexte(self, txt):
|
|
|
+ """affiche la legende en haut de l'ecran lors du surviol d'une commande"""
|
|
|
+ if len(txt) > 0:
|
|
|
+ self.txt.setTextWidth(self.width())
|
|
|
+ self.txt.setPlainText(QString.fromUtf8(txt))
|
|
|
+ self.centrerTxt()
|
|
|
+ self.txt.setVisible((len(txt)>0))
|
|
|
+
|
|
|
+ def centrerTxt(self):
|
|
|
+ """centre le texte affiche"""
|
|
|
+ f = QTextBlockFormat()
|
|
|
+ f.setAlignment(Qt.AlignHCenter)
|
|
|
+ cursor = self.txt.textCursor()
|
|
|
+ cursor.select(QTextCursor.Document)
|
|
|
+ cursor.mergeBlockFormat(f)
|
|
|
+ cursor.clearSelection()
|
|
|
+ self.txt.setTextCursor(cursor)
|
|
|
|
|
|
class CommandeFondPlateau(QGraphicsPixmapItem):
|
|
|
"""bouton image affiche sur l'EcranFondPlateau"""
|
|
|
@@ -55,15 +80,16 @@ class CommandeFondPlateau(QGraphicsPixmapItem):
|
|
|
self.y = y
|
|
|
self.h = h
|
|
|
self.transparence = transparence
|
|
|
- self.effetBleu = QGraphicsBlurEffect()
|
|
|
|
|
|
def actu(self):
|
|
|
"""ajoute une image au fond de l'ecran. """
|
|
|
+ self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
|
|
|
lEcran = self.ecran.width()
|
|
|
hEcran = self.ecran.height()
|
|
|
+
|
|
|
pix = QPixmap()
|
|
|
pix.load(self.img)
|
|
|
- pix = pix.scaledToHeight(((self.h*hEcran)/100))
|
|
|
+ pix = pix.scaledToHeight(((self.h*hEcran)/100), Qt.SmoothTransformation)
|
|
|
|
|
|
self.setPixmap(pix)
|
|
|
self.setPos(((self.x*lEcran)/100), \
|
|
|
@@ -81,10 +107,14 @@ class CommandeFondPlateau(QGraphicsPixmapItem):
|
|
|
self.ecran.clic(self.cmdId)
|
|
|
|
|
|
def hoverEnterEvent(self, event):
|
|
|
- self.setGraphicsEffect(QGraphicsColorizeEffect ())
|
|
|
+ effet = QGraphicsColorizeEffect()
|
|
|
+ effet.setColor(QColor(40, 90, 200))
|
|
|
+ self.setGraphicsEffect(effet)
|
|
|
+ self.ecran.majTexte(self.txt)
|
|
|
|
|
|
def hoverLeaveEvent(self, event):
|
|
|
self.setGraphicsEffect(None)
|
|
|
+ self.ecran.majTexte("")
|
|
|
|
|
|
|
|
|
|