1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
| # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_Gestion_Entite.ui'
#
# Created: Tue Apr 27 23:53:28 2010
# by: PyQt4 UI code generator 4.7
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from ui_Dialog_Recherche_Entite import Ui_Dialog_recherche_entite
from ui_Dialog_Suppr_Entite import Ui_Dialog_Suppr_Entite
from lib_vtek import *
class Ui_Form_gestion_entite(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self.Tag_Btn_modif = "modif"
self.Btn_modif.setEnabled(False)
self.db = DB_Connection()
self.entite = Vtek_Entite()
def setupUi(self, Form_gestion_entite):
Form_gestion_entite.setObjectName("Form_gestion_entite")
Form_gestion_entite.resize(642, 480)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form_gestion_entite.sizePolicy().hasHeightForWidth())
Form_gestion_entite.setSizePolicy(sizePolicy)
self.verticalLayout_2 = QtGui.QVBoxLayout(Form_gestion_entite)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.groupBoxRecherche = QtGui.QGroupBox(Form_gestion_entite)
self.groupBoxRecherche.setObjectName("groupBoxRecherche")
self.gridLayout = QtGui.QGridLayout(self.groupBoxRecherche)
self.gridLayout.setObjectName("gridLayout")
self.labelNom = QtGui.QLabel(self.groupBoxRecherche)
self.labelNom.setObjectName("labelNom")
self.gridLayout.addWidget(self.labelNom, 0, 0, 1, 1)
self.textboxNom = QtGui.QLineEdit(self.groupBoxRecherche)
self.textboxNom.setObjectName("textboxNom")
self.gridLayout.addWidget(self.textboxNom, 0, 1, 1, 1)
self.labelPrenom = QtGui.QLabel(self.groupBoxRecherche)
self.labelPrenom.setObjectName("labelPrenom")
self.gridLayout.addWidget(self.labelPrenom, 0, 2, 1, 1)
self.textboxPrenom = QtGui.QLineEdit(self.groupBoxRecherche)
self.textboxPrenom.setObjectName("textboxPrenom")
self.gridLayout.addWidget(self.textboxPrenom, 0, 3, 1, 1)
self.Btn_Rechercher = QtGui.QPushButton(self.groupBoxRecherche)
self.Btn_Rechercher.setObjectName("Btn_Rechercher")
self.gridLayout.addWidget(self.Btn_Rechercher, 0, 4, 1, 1)
self.verticalLayout.addWidget(self.groupBoxRecherche)
self.line = QtGui.QFrame(Form_gestion_entite)
self.line.setFrameShape(QtGui.QFrame.HLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName("line")
self.verticalLayout.addWidget(self.line)
self.groupeBoxDetail = QtGui.QGroupBox(Form_gestion_entite)
self.groupeBoxDetail.setObjectName("groupeBoxDetail")
self.gridLayout_2 = QtGui.QGridLayout(self.groupeBoxDetail)
self.gridLayout_2.setObjectName("gridLayout_2")
self.labelDetNom = QtGui.QLabel(self.groupeBoxDetail)
self.labelDetNom.setObjectName("labelDetNom")
self.gridLayout_2.addWidget(self.labelDetNom, 0, 0, 1, 1)
self.textbox_nom = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_nom.setEnabled(False)
self.textbox_nom.setObjectName("textbox_nom")
self.gridLayout_2.addWidget(self.textbox_nom, 0, 1, 1, 2)
self.labelDetPrenom = QtGui.QLabel(self.groupeBoxDetail)
self.labelDetPrenom.setObjectName("labelDetPrenom")
self.gridLayout_2.addWidget(self.labelDetPrenom, 0, 3, 1, 1)
self.textbox_prenom = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_prenom.setEnabled(False)
self.textbox_prenom.setObjectName("textbox_prenom")
self.gridLayout_2.addWidget(self.textbox_prenom, 0, 4, 1, 2)
self.label = QtGui.QLabel(self.groupeBoxDetail)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
self.textbox_adresse1 = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_adresse1.setEnabled(False)
self.textbox_adresse1.setObjectName("textbox_adresse1")
self.gridLayout_2.addWidget(self.textbox_adresse1, 1, 1, 1, 5)
self.textbox_adresse2 = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_adresse2.setEnabled(False)
self.textbox_adresse2.setObjectName("textbox_adresse2")
self.gridLayout_2.addWidget(self.textbox_adresse2, 2, 1, 1, 5)
self.labelCP = QtGui.QLabel(self.groupeBoxDetail)
self.labelCP.setObjectName("labelCP")
self.gridLayout_2.addWidget(self.labelCP, 3, 0, 1, 1)
self.textbox_cp = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_cp.setEnabled(False)
self.textbox_cp.setObjectName("textbox_cp")
self.gridLayout_2.addWidget(self.textbox_cp, 3, 1, 1, 2)
self.labelville = QtGui.QLabel(self.groupeBoxDetail)
self.labelville.setObjectName("labelville")
self.gridLayout_2.addWidget(self.labelville, 3, 3, 1, 1)
self.textbox_ville = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_ville.setEnabled(False)
self.textbox_ville.setObjectName("textbox_ville")
self.gridLayout_2.addWidget(self.textbox_ville, 3, 4, 1, 2)
self.label_2 = QtGui.QLabel(self.groupeBoxDetail)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 4, 0, 1, 1)
self.textbox_pays = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_pays.setEnabled(False)
self.textbox_pays.setObjectName("textbox_pays")
self.gridLayout_2.addWidget(self.textbox_pays, 4, 1, 1, 2)
self.label_6 = QtGui.QLabel(self.groupeBoxDetail)
self.label_6.setObjectName("label_6")
self.gridLayout_2.addWidget(self.label_6, 4, 3, 1, 1)
self.textbox_tva = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_tva.setEnabled(False)
self.textbox_tva.setObjectName("textbox_tva")
self.gridLayout_2.addWidget(self.textbox_tva, 4, 4, 1, 2)
self.label_4 = QtGui.QLabel(self.groupeBoxDetail)
self.label_4.setObjectName("label_4")
self.gridLayout_2.addWidget(self.label_4, 5, 0, 1, 1)
self.textbox_tel = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_tel.setEnabled(False)
self.textbox_tel.setObjectName("textbox_tel")
self.gridLayout_2.addWidget(self.textbox_tel, 5, 1, 1, 2)
self.label_5 = QtGui.QLabel(self.groupeBoxDetail)
self.label_5.setObjectName("label_5")
self.gridLayout_2.addWidget(self.label_5, 5, 3, 1, 1)
self.textbox_fax = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_fax.setEnabled(False)
self.textbox_fax.setObjectName("textbox_fax")
self.gridLayout_2.addWidget(self.textbox_fax, 5, 4, 1, 2)
self.label_3 = QtGui.QLabel(self.groupeBoxDetail)
self.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 6, 0, 1, 1)
self.textbox_email = QtGui.QLineEdit(self.groupeBoxDetail)
self.textbox_email.setEnabled(False)
self.textbox_email.setObjectName("textbox_email")
self.gridLayout_2.addWidget(self.textbox_email, 6, 1, 1, 5)
self.label_7 = QtGui.QLabel(self.groupeBoxDetail)
self.label_7.setObjectName("label_7")
self.gridLayout_2.addWidget(self.label_7, 7, 0, 1, 2)
self.texbox_birth = QtGui.QLineEdit(self.groupeBoxDetail)
self.texbox_birth.setEnabled(False)
self.texbox_birth.setObjectName("texbox_birth")
self.gridLayout_2.addWidget(self.texbox_birth, 7, 2, 1, 1)
self.Btn_modif = QtGui.QPushButton(self.groupeBoxDetail)
self.Btn_modif.setObjectName("Btn_modif")
self.gridLayout_2.addWidget(self.Btn_modif, 7, 3, 1, 2)
self.Btn_suppr = QtGui.QPushButton(self.groupeBoxDetail)
self.Btn_suppr.setObjectName("Btn_suppr")
self.Btn_suppr.setEnabled(False)
self.gridLayout_2.addWidget(self.Btn_suppr, 7, 5, 1, 1)
self.verticalLayout.addWidget(self.groupeBoxDetail)
self.groupBoxRole = QtGui.QGroupBox(Form_gestion_entite)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.groupBoxRole.sizePolicy().hasHeightForWidth())
self.groupBoxRole.setSizePolicy(sizePolicy)
self.groupBoxRole.setObjectName("groupBoxRole")
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBoxRole)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.list_role = QtGui.QListView(self.groupBoxRole)
self.list_role.setEnabled(False)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.list_role.sizePolicy().hasHeightForWidth())
self.list_role.setSizePolicy(sizePolicy)
self.list_role.setObjectName("list_role")
self.horizontalLayout_2.addWidget(self.list_role)
self.verticalLayout.addWidget(self.groupBoxRole)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.retranslateUi(Form_gestion_entite)
QtCore.QObject.connect(self.Btn_Rechercher, QtCore.SIGNAL("clicked()"), self.Action_Btn_rechercher)
QtCore.QObject.connect(self.Btn_modif, QtCore.SIGNAL("clicked()"), self.Action_Btn_modif)
self.connect(self.Btn_suppr,QtCore.SIGNAL("clicked()"), self.Action_Btn_suppr)
QtCore.QMetaObject.connectSlotsByName(Form_gestion_entite)
def retranslateUi(self, Form_gestion_entite):
Form_gestion_entite.setWindowTitle(QtGui.QApplication.translate("Form_gestion_entite", "Gestion des entitée", None, QtGui.QApplication.UnicodeUTF8))
self.groupBoxRecherche.setTitle(QtGui.QApplication.translate("Form_gestion_entite", "Recherche", None, QtGui.QApplication.UnicodeUTF8))
self.labelNom.setText(QtGui.QApplication.translate("Form_gestion_entite", "Nom :", None, QtGui.QApplication.UnicodeUTF8))
self.labelPrenom.setText(QtGui.QApplication.translate("Form_gestion_entite", "Prénom :", None, QtGui.QApplication.UnicodeUTF8))
self.Btn_Rechercher.setText(QtGui.QApplication.translate("Form_gestion_entite", "Rechercher...", None, QtGui.QApplication.UnicodeUTF8))
self.groupeBoxDetail.setTitle(QtGui.QApplication.translate("Form_gestion_entite", "Détails", None, QtGui.QApplication.UnicodeUTF8))
self.labelDetPrenom.setText(QtGui.QApplication.translate("Form_gestion_entite", "Prénom :", None, QtGui.QApplication.UnicodeUTF8))
self.labelville.setText(QtGui.QApplication.translate("Form_gestion_entite", "Ville :", None, QtGui.QApplication.UnicodeUTF8))
self.label_6.setText(QtGui.QApplication.translate("Form_gestion_entite", "TVA :", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("Form_gestion_entite", "Fax:", None, QtGui.QApplication.UnicodeUTF8))
self.labelDetNom.setText(QtGui.QApplication.translate("Form_gestion_entite", "Nom :", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("Form_gestion_entite", "Adresse :", None, QtGui.QApplication.UnicodeUTF8))
self.label_7.setText(QtGui.QApplication.translate("Form_gestion_entite", "Date de naissance :", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("Form_gestion_entite", "E-mail :", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Form_gestion_entite", "Tel :", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Form_gestion_entite", "Pays :", None, QtGui.QApplication.UnicodeUTF8))
self.labelCP.setText(QtGui.QApplication.translate("Form_gestion_entite", "CP :", None, QtGui.QApplication.UnicodeUTF8))
self.Btn_modif.setText(QtGui.QApplication.translate("Form_gestion_entite", "Modifier", None, QtGui.QApplication.UnicodeUTF8))
self.Btn_suppr.setText(QtGui.QApplication.translate("Form_gestion_entite", "Supprimer", None, QtGui.QApplication.UnicodeUTF8))
self.groupBoxRole.setTitle(QtGui.QApplication.translate("Form_gestion_entite", "Rôles", None, QtGui.QApplication.UnicodeUTF8))
def Action_Btn_modif(self):
if self.Tag_Btn_modif == "modif":#Si le bouton est en position modifier...
self.Enable_UserControl(True)
self.Btn_modif.setText("Terminer")
self.Tag_Btn_modif = "Term"
else:#Si le bouton est en pousition Terminer
self.entite.setEntite(self.entite.id, self.textbox_nom.text(), self.textbox_prenom.text(), self.textbox_adresse1.text(), self.textbox_adresse2.text(), self.textbox_cp.text(), self.textbox_ville.text(), self.textbox_pays.text(), self.textbox_tva.text(), self.textbox_tel.text(), self.textbox_email.text(), self.texbox_birth.text())
self.db.update_entite(self.entite)
self.Enable_UserControl(False)
self.Btn_modif.setEnabled(True)
self.Btn_modif.setText("Modifier")
self.Tag_Btn_modif = "modif"
def Action_Btn_suppr(self):
dialog_suppr_entite = Ui_Dialog_Suppr_Entite()
if (dialog_suppr_entite.exec_()):
print("Entite supprimee")
self.entite.__init__()# je redefini l'objet entite à zero
self.Charger_entite(self.entite)
self.Enable_UserControl(False)
self.Btn_modif.setText("Modifier")
self.Tag_Btn_modif = "modif"
def Action_Btn_rechercher(self):#Affiche la fenetre de dialogue pour la selection de la rechervhr
dialog_recherche_entite = Ui_Dialog_recherche_entite(self,self.textboxNom.text(), self.textboxPrenom.text())
if (dialog_recherche_entite.exec_()):#j'utilise exec_ car la fenetre est modal, et une fenetre dialogue qui est modal s'apelle ainsi. Rendre la fenetre modal permet de la rendre blocante...
self.Btn_modif.setEnabled(True)
def Enable_UserControl(self, Bool):#Active ou non les widget de la fenetre
self.textbox_nom.setEnabled(Bool)
self.textbox_prenom.setEnabled(Bool)
self.textbox_adresse1.setEnabled(Bool)
self.textbox_adresse2.setEnabled(Bool)
self.textbox_cp.setEnabled(Bool)
self.textbox_ville.setEnabled(Bool)
self.textbox_pays.setEnabled(Bool)
self.textbox_tva.setEnabled(Bool)
self.textbox_tel.setEnabled(Bool)
self.textbox_fax.setEnabled(Bool)
self.textbox_email.setEnabled(Bool)
self.texbox_birth.setEnabled(Bool)
self.list_role.setEnabled(Bool)
self.Btn_modif.setEnabled(Bool)
self.Btn_suppr.setEnabled(Bool)
def Charger_entite(self, entite):#Charge l'entite reçue dans la fenetre
self.entite = entite# je defini l'objet de cette classe par celui recu en parametre
self.textbox_nom.setText(self.entite.nom)#Je defini la valeur des LineEdit
self.textbox_prenom.setText(self.entite.prenom)
self.textbox_adresse1.setText(self.entite.adresse)
self.textbox_adresse2.setText(self.entite.adresse2)
self.textbox_cp.setText(self.entite.cp)
self.textbox_ville.setText(self.entite.ville)
self.textbox_pays.setText(self.entite.pays)
self.textbox_tva.setText(self.entite.tva)
self.textbox_tel.setText(self.entite.telephone)
self.texbox_birth.setText(self.entite.naissance)
self.textbox_email.setText(self.entite.email) |
Partager