| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #from __future__ import unicode_literals
- # -*- coding: utf-8 -*-
- """Panneau d'affichage des PJ dans l'onglet groupe
- """
- import sys
- from PyQt4.QtCore import *
- from PyQt4.QtGui import *
- from ui.ecran_panneauPj import Ui_pj_panneau
- import regles
- from ui.dm import *
- from EcranEditionCombattant import EcranEditionCombattant
- class FramePj(QFrame):
- """Panneau d'affichage du Pj
- a inserer dans le layout de l'onglet groupe
- de l'ecran principal"""
- def __init__(self, idPj, parent=None):
- super (FramePj, self).__init__(parent)
- self.idPj = idPj
- self._pj = None
- self.enCreation = False
- self.createWidgets()
- def createWidgets(self):
- """construction de l'interface"""
- self.ui = Ui_pj_panneau()
- self.ui.setupUi(self)
- ## self.ui.att_voile.setAttribute(Qt.WA_TransparentForMouseEvents)
- for i in range(0, 6):
- bouton = self.findChild(QPushButton, "pj_afficher_{}".format(i))
- self.connect(bouton, SIGNAL("clicked()"), self.afficherFiche)
- def signalerModif(self):
- """on signale a la fenetre principale que le personnage a ete modifie"""
- self.emit(SIGNAL("pjModifie()"), self.idPj)
- def pj(self):
- """retourne le pj represente"""
- return self._pj
- def chargerPj(self, pj = None):
- """met a jour le contenu avec les donnees du pj en param"""
- if pj:
- self.ui.pj_image.chargerImage(pj.logo)
- self.ui.pj_nom.majTexte(pj.nom)
- for i in range(0, 6):
- bouton = self.findChild(QPushButton, "pj_afficher_{}".format(i))
- bouton.setEnabled(True)
- self._pj = pj
- def reinitialiser(self):
- self.ui.pj_image.majImage("")
- self.ui.pj_nom.majTexte("(Nouveau personnage...)")
- for i in range(0, 6):
- bouton = self.findChild(QPushButton, "pj_afficher_{}".format(i))
- bouton.setEnabled(False)
- def afficherFiche(self):
- """affiche la fiche de perso a la page demandee"""
- emetteur = self.sender().objectName()
- page = int(str(emetteur)[-1:])
- self.editionPj = EcranEditionCombattant(self._pj, page)
- self.editionPj.setAttribute(Qt.WA_DeleteOnClose)
- r = self.editionPj.exec_()
- self._pj = self.editionPj.combattant
- self.signalerModif()
- if __name__ == "__main__":
- app = QApplication(sys.argv)
- ecran = FramePj(0)
- ecran.show()
- r = app.exec_()
- exit(r)
|