This commit is contained in:
sidya82 2015-02-05 01:21:43 +01:00
parent 2a1099c450
commit b7b6a84643
22 changed files with 460 additions and 316 deletions

View File

@ -1,14 +1,10 @@
import sqlite3
from src.c.Main import Main from src.c.Main import Main
from src.m.connexionBDD import connexionBDD
__author__ = 'sidya' __author__ = 'sidya'
if __name__ == "__main__": if __name__ == "__main__":
#c = connexionBDD() # c = connexionBDD()
#c.initialisationBDD() #c.initialisationBDD()
#c.seDeconnecter() #c.seDeconnecter()
# lancement du controleur principal # lancement du controleur principal

View File

@ -1,4 +1,4 @@
from PyQt4 import QtGui from PyQt4 import QtGui, QtCore
from src.c.Teleporteur import Teleporteur from src.c.Teleporteur import Teleporteur
from src.m.Parking import Placement from src.m.Parking import Placement
@ -18,9 +18,9 @@ class Borne:
Controleur de la vue des bornes permettant l'accès au parking Controleur de la vue des bornes permettant l'accès au parking
""" """
bornes = [] bornes = []
@staticmethod @staticmethod
def MajBornes(): def MajBornes():
print(Borne.bornes)
for b in Borne.bornes: for b in Borne.bornes:
b.MajBorne() b.MajBorne()
@ -28,9 +28,10 @@ class Borne:
self.__ui.lcdNumber.display(self.__parking.nbPlacesLibresParking) self.__ui.lcdNumber.display(self.__parking.nbPlacesLibresParking)
def __init__(self, main, parking): def __init__(self, main, parking):
self.__nomBorne = "Borne " + str(len(self.bornes) + 1)
self.__parking = parking self.__parking = parking
self.__main = main self.__main = main
self.__main.activity("Affichage Borne", self.__main.lvl.INFO) self.__main.activity("Affichage " + self.__nomBorne, self.__main.lvl.INFO)
self.__w = MyQWidget(self.__main) self.__w = MyQWidget(self.__main)
self.__ui = Ui_Borne() self.__ui = Ui_Borne()
@ -48,14 +49,18 @@ class Borne:
# Validator # Validator
validatorText = QtGui.QRegExpValidator(QtCore.QRegExp('^([a-zA-Z\'àâéèêôùûçñãõÀÂÉÈÔÙÛÑÃÕÇ\s-]{2,30})$'))
validatorCB = QtGui.QRegExpValidator(QtCore.QRegExp('^([0-9]*)$'))
self.__ui.nomLineEdit.setValidator(validatorText)
self.__ui.prenomLineEdit.setValidator(validatorText)
self.__ui.lieuLineEdit_2.setValidator(validatorText)
self.__ui.numeroCarteLineEdit.setValidator(validatorCB)
self.__ui.label_aff.setStyleSheet("qproperty-alignment: AlignCenter; font-size: 28px") self.__ui.label_aff.setStyleSheet("qproperty-alignment: AlignCenter; font-size: 28px")
self.__ui.nomParking.setStyleSheet("qproperty-alignment: AlignCenter; font-size: 28px") self.__ui.nomParking.setStyleSheet("qproperty-alignment: AlignCenter; font-size: 28px")
self.nonVoiture() self.nonVoiture()
self.showWindow() self.showWindow()
self.__ui.nomParking.setText("Borne " + str(len(self.bornes)+1) + " - Parking : " +parking.nom) self.__ui.nomParking.setText(self.__nomBorne + " - Parking : " + parking.nom)
Borne.bornes.append(self) Borne.bornes.append(self)
Borne.MajBornes() Borne.MajBornes()
@ -75,6 +80,7 @@ class Borne:
Met en etat initial de départ sans voiture Met en etat initial de départ sans voiture
:return: :return:
""" """
self.__main.activity(self.__nomBorne + " : En Attente d'une voiture", self.__main.lvl.INFO)
self.__ui.label_aff.setText("Dream park") self.__ui.label_aff.setText("Dream park")
self.__c = None self.__c = None
self.__ui.box_abo.setDisabled(True) self.__ui.box_abo.setDisabled(True)
@ -101,6 +107,7 @@ class Borne:
""" """
self.__ui.btn_Voiture.setDisabled(True) self.__ui.btn_Voiture.setDisabled(True)
self.__v_actuel = Camera.donnerVoiture() self.__v_actuel = Camera.donnerVoiture()
self.__main.activity(self.__nomBorne + " : Arrivee : " + str(self.__v_actuel), self.__main.lvl.INFO)
self.__ui.box_abo.setDisabled(False) self.__ui.box_abo.setDisabled(False)
self.__ui.box_garer.setDisabled(False) self.__ui.box_garer.setDisabled(False)
self.__ui.box_id.setDisabled(False) self.__ui.box_id.setDisabled(False)
@ -113,16 +120,24 @@ class Borne:
Gestion de l'identification a partir d'un abo a partir de son id (lineedit) Gestion de l'identification a partir d'un abo a partir de son id (lineedit)
:return: :return:
""" """
try : try:
self.__c = Client(self.__ui.lineEdit_id.text()) self.__c = Client(self.__ui.lineEdit_id.text())
self.__ui.label_aff.setText("Bonjour " + str(self.__c.nom) + " " + str(self.__c.prenom)) self.__ui.label_aff.setText("Bonjour " + str(self.__c.nom) + " " + str(self.__c.prenom))
self.__ui.labIdClient.setText("Vous étes identifier") self.__ui.labIdClient.setText("Vous étes identifier")
self.__ui.box_id.setDisabled(True) self.__ui.box_id.setDisabled(True)
self.__ui.box_service.setDisabled(False) self.__ui.box_service.setDisabled(False)
self.__ui.btn_desabo.setDisabled(False) self.__ui.btn_desabo.setDisabled(False)
except Exception : self.__v_actuel.setClient(self.__c)
self.__main.activity(self.__nomBorne + " : Mise a jour : " + str(self.__v_actuel), self.__main.lvl.INFO)
self.__main.activity(self.__nomBorne + " : Identification : " + str(self.__c), self.__main.lvl.INFO)
except IndexError:
self.__ui.label_aff.setText("Echec identification") self.__ui.label_aff.setText("Echec identification")
self.__ui.labIdClient.setText("Non identifier") self.__ui.labIdClient.setText("Non identifier")
self.__main.activity(self.__nomBorne + " : Identifiant Invalide", self.__main.lvl.INFO)
except Exception as e:
self.error("Une erreur est survenu lors de votre identification")
self.__main.activity(self.__nomBorne + " : Erreur lors de l'indentification " + str(e),
self.__main.lvl.FAIL)
def abo(self): def abo(self):
""" """
@ -135,6 +150,7 @@ class Borne:
"", "",
TypeAbonnement.SUPER_ABONNE) TypeAbonnement.SUPER_ABONNE)
self.__ui.label_aff.setText("Mise a jour de votre abonnement effectué") self.__ui.label_aff.setText("Mise a jour de votre abonnement effectué")
self.__main.activity(self.__nomBorne + " : Mise à jour : " + str(self.__c), self.__main.lvl.INFO)
else: else:
if self.__ui.checkBox.isChecked(): if self.__ui.checkBox.isChecked():
self.__c = Client(None, self.__c = Client(None,
@ -148,16 +164,18 @@ class Borne:
str(self.__ui.prenomLineEdit.text()), str(self.__ui.prenomLineEdit.text()),
"", "",
TypeAbonnement.ABONNE) TypeAbonnement.ABONNE)
self.__ui.label_aff.setText("Votre id membre est : " + self.__c.id) self.identification()
self.__main.activity(self.__nomBorne + " : Ajout : " + str(self.__c), self.__main.lvl.INFO)
self.__ui.label_aff.setText("Votre id membre est : " + self.__c.id)
self.__ui.lineEdit_id.setText(self.__c.id) self.__ui.lineEdit_id.setText(self.__c.id)
self.identification()
def garer(self): def garer(self):
""" """
Gestion de la validation de garer son vehicule Gestion de la validation de garer son vehicule
:return: :return:
""" """
id = None placement = None
if self.__c is None: if self.__c is None:
p = self.__parking.recherchePlace(self.__v_actuel) p = self.__parking.recherchePlace(self.__v_actuel)
if p is not None: if p is not None:
@ -165,21 +183,27 @@ class Borne:
else: else:
if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE: if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE:
p = self.__parking.recherchePlace(self.__v_actuel) p = self.__parking.recherchePlace(self.__v_actuel)
if p is not None : if p is not None:
placement = Teleporteur.teleporterVoiture(self.__v_actuel, p) placement = Teleporteur.teleporterVoiture(self.__v_actuel, p)
if self.__ui.checkBox_Livraison_2.isChecked(): if self.__ui.checkBox_Livraison_2.isChecked():
Service(None, self.__c, placement, TypeService.LIVRAISON) s = Service(None, self.__c, placement, TypeService.LIVRAISON)
self.__main.activity(self.__nomBorne + " : Nouveau : " + str(s), self.__main.lvl.INFO)
if self.__ui.checkBox_Entretien_2.isChecked(): if self.__ui.checkBox_Entretien_2.isChecked():
Service(None, self.__c, placement, TypeService.ENTRETIEN) s = Service(None, self.__c, placement, TypeService.ENTRETIEN)
self.__main.activity(self.__nomBorne + " : Nouveau : " + str(s), self.__main.lvl.INFO)
if self.__ui.checkBox_Maintenance_2.isChecked(): if self.__ui.checkBox_Maintenance_2.isChecked():
Service(None, self.__c, placement, TypeService.MAINTENANCE) s = Service(None, self.__c, placement, TypeService.MAINTENANCE)
self.__main.activity(self.__nomBorne + " : Nouveau : " + str(s), self.__main.lvl.INFO)
else: else:
placement = Teleporteur.teleporterVoitureSuperAbonne(self.__v_actuel, self.__parking) placement = Teleporteur.teleporterVoitureSuperAbonne(self.__v_actuel, self.__parking)
if placement is not None: if placement is not None:
self.nonVoiture() self.nonVoiture()
self.ticketDepot(placement.id) self.ticketDepot(placement.id)
self.__main.activity(self.__nomBorne + " : Nouveau : " + str(placement), self.__main.lvl.INFO)
else: else:
self.__ui.label_aff.setText("Aucune Place Correspondante. Devenez Super Abonné!") self.__ui.label_aff.setText("Aucune Place Correspondante. Devenez Super Abonné!")
self.__main.activity(self.__nomBorne + " : Pas de place dispo pour " + str(self.__v_actuel),
self.__main.lvl.INFO)
def recuperer(self): def recuperer(self):
@ -187,26 +211,58 @@ class Borne:
Essaie de recuperer une voiture avec le numero de ticket (lineedit) Essaie de recuperer une voiture avec le numero de ticket (lineedit)
:return: :return:
""" """
try : p = None
p = Placement.get(self.__ui.numeroTicketLineEdit.text()) try:
Teleporteur.teleporterVersSortie(p) p = Placement(self.__ui.numeroTicketLineEdit.text())
self.nonVoiture()
self.ticketDepot(id)
except IndexError: except IndexError:
self.__ui.label_aff.setText("Mauvais numero de ticket") self.__ui.label_aff.setText("Mauvais numero de ticket")
self.__main.activity(self.__nomBorne + " : Mauvais numero de ticket", self.__main.lvl.INFO)
try:
Teleporteur.teleporterVersSortie(p)
except Exception:
self.__ui.label_aff.setText("Voiture déjà recuperé")
self.__main.activity(self.__nomBorne + " : Recuperation déjà effectué : " + str(p), self.__main.lvl.INFO)
if p is not None:
self.nonVoiture()
self.ticketRetrait(p, Service.getAllServicePlacement(p))
self.__main.activity(self.__nomBorne + " : Recuperation : " + str(p), self.__main.lvl.INFO)
def ticketDepot(self, id): def ticketDepot(self, id):
QtGui.QMessageBox.information(self.__w, QtGui.QMessageBox.information(self.__w,
"Ticket", "Ticket",
"Votre numero ticket : " + str(id) "Votre numero ticket : " + str(id)
) )
def ticketRetrait(self): def ticketRetrait(self, placement, services):
if placement.voiture.client == "NULL":
prix = placement.place.typePlace.prix
s = "Prix : " + str(prix) + "" + \
"\nMerci de votre confiance! Bonne journée !"
else:
prix = placement.place.typePlace.prix - placement.place.typePlace.prix * 10 / 100
s = "Prix : " + str(placement.place.typePlace.prix) + "- 10% = " + \
str(prix) + ""
for service in services:
if service.typeService == TypeService.MAINTENANCE:
name = "Maintenance"
elif service.typeService == TypeService.ENTRETIEN:
name = "Entretien"
else:
name = "Autre Service"
if service.estRealiser():
s += "\nService : " + name + " + 2€"
else:
s += "\nNous n'avons pas pu réaliser le service" + name + "."
s += "\nVeuillez nous excuser de la gène ocassionée."
s += "Le Montant sera débiter automatiquement sur votre compte."
s += "\nMerci de votre confiance! Bonne journée !"
QtGui.QMessageBox.information(self.__w, QtGui.QMessageBox.information(self.__w,
"Ticket", "Ticket",
"Merci de votre confiance! Bonne journée !" str(s)
) )
def showWindow(self): def showWindow(self):
""" """
Gestion affichage de la vue borne Gestion affichage de la vue borne
@ -221,16 +277,16 @@ class Borne:
Gestion de sortie de la vue borne Gestion de sortie de la vue borne
:return: :return:
""" """
self.__main.activity(self.__nomBorne + " : Quitter", self.__main.lvl.INFO)
self.__main.showWindow() self.__main.showWindow()
def error(self): def error(self, msg):
""" """
Qdialog message erreur Qdialog message erreur
:return: :return:
""" """
QtGui.QMessageBox.warning(self.__w, QtGui.QMessageBox.warning(self._w,
"Erreur ...", "Erreur ...",
"Une erreur est survenue ...") msg
self.__w.hide() )
self.__main.showWindow()

View File

@ -1,4 +1,4 @@
from PyQt4 import QtGui from PyQt4 import QtGui, QtCore
from src.m.Parking import Parking, TypePlace from src.m.Parking import Parking, TypePlace
from src.v.MyQWidget import MyQWidget from src.v.MyQWidget import MyQWidget
@ -12,6 +12,7 @@ class CreaParking:
""" """
Controleur de cretion de parking Controleur de cretion de parking
""" """
def __init__(self, main): def __init__(self, main):
self._main = main self._main = main
self._main.activity("Debut Creation Parking", self._main.lvl.INFO) self._main.activity("Debut Creation Parking", self._main.lvl.INFO)
@ -27,17 +28,12 @@ class CreaParking:
self._ui.btn_annuler.clicked.connect(self.annuler) self._ui.btn_annuler.clicked.connect(self.annuler)
# Validator # Validator
#self._ui.lineEdit_nbNiv.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]*'))) self._ui.lineEdit_nom.setValidator(
QtGui.QRegExpValidator(QtCore.QRegExp('^([0-9a-zA-Z\'àâéèêôùûçñãõÀÂÉÈÔÙÛÑÃÕÇ\s-]{2,30})$')))
self._ui.tableWidget.insertRow(self._ui.tableWidget.rowCount()) self._ui.tableWidget.insertRow(self._ui.tableWidget.rowCount())
self.showWindow() self.showWindow()
def majNbPlaceTotal(self):
nb = 0
for i in range(0, self._ui.tableWidget.rowCount()):
nb += int(self._ui.tableWidget.itemAt(i, 3).text())
self._ui.nbPlacesTotal.setText(str(nb))
def addRow(self): def addRow(self):
""" """
Ajoute une ligne de creation de place Ajoute une ligne de creation de place
@ -65,7 +61,7 @@ class CreaParking:
if result == QtGui.QMessageBox.Yes: if result == QtGui.QMessageBox.Yes:
self._main.activity("Annulation Creation Parking", self._main.lvl.INFO) self._main.activity("Annulation Creation Parking", self._main.lvl.INFO)
#self._w.hide() self._w.hide()
self._main.showWindow() self._main.showWindow()
def valider(self): def valider(self):
@ -73,21 +69,25 @@ class CreaParking:
Gestion validation de formulaire de creation de parking. Gestion validation de formulaire de creation de parking.
:return: :return:
""" """
# try: if self._ui.lineEdit_nom.text() == "":
l = [] self._main.activity("Erreur lors de la creations du Parking. Nom Invalide.\n", self._main.lvl.FAIL)
for i in range(0, self._ui.tableWidget.rowCount()): self.error("Nom Invalide!")
l.append(TypePlace(None, int(self._ui.tableWidget.item(i, 0).text()), else:
int(self._ui.tableWidget.item(i, 1).text()), try:
int(self._ui.tableWidget.item(i, 2).text()), l = []
float(self._ui.tableWidget.item(i, 3).text()), for i in range(0, self._ui.tableWidget.rowCount()):
int(self._ui.tableWidget.item(i, 4).text()))) l.append(TypePlace(None, int(self._ui.tableWidget.item(i, 0).text()),
p = Parking(None, self._ui.lineEdit_nom.text(), l) int(self._ui.tableWidget.item(i, 1).text()),
self._main.activity("Ajout:" + str(p), self._main.lvl.INFO) int(self._ui.tableWidget.item(i, 2).text()),
self._w.hide() float(self._ui.tableWidget.item(i, 4).text()),
self._main.showWindow() int(self._ui.tableWidget.item(i, 3).text())))
#except Exception as e: p = Parking(None, self._ui.lineEdit_nom.text(), l)
# self._main.activity("Erreur lors de la creations du Parking \n" + str(e), self._main.lvl.FAIL) self._main.activity("Ajout:" + str(p), self._main.lvl.INFO)
# self.error() self._w.hide()
self._main.showWindow()
except Exception as e:
self._main.activity("Erreur lors de la creations du Parking \n" + str(e), self._main.lvl.FAIL)
self.error("Verifiez que votre saisie est valide !")
def showWindow(self): def showWindow(self):
""" """
@ -95,16 +95,15 @@ class CreaParking:
:return: :return:
""" """
self._w.show() self._w.show()
self.__child = None # supprime l'eventuel widget enfant
self._w.focusWidget() # reprend le focus sur la fenetre self._w.focusWidget() # reprend le focus sur la fenetre
def error(self): def error(self, msg):
""" """
Qdialog message erreur Qdialog message erreur
:return: :return:
""" """
QtGui.QMessageBox.warning(self._w, QtGui.QMessageBox.warning(self._w,
"Erreur ...", "Erreur ...",
"Erreur lors de la création du parking ...") "Erreur lors de la création du parking ...\n" +
self._w.hide() msg
self._main.showWindow() )

View File

@ -36,6 +36,9 @@ class Main:
self.__ui.btn_supprimer.clicked.connect(self.rmParking) self.__ui.btn_supprimer.clicked.connect(self.rmParking)
self.__ui.btn_details.clicked.connect(self.detailsPlacesParking) self.__ui.btn_details.clicked.connect(self.detailsPlacesParking)
self.__ui.btn_borne.clicked.connect(self.afficherBornes) self.__ui.btn_borne.clicked.connect(self.afficherBornes)
self.__ui.btn_effectuer_entretien.clicked.connect(self.doEntretien)
self.__ui.btn_effectuer_livraison.clicked.connect(self.doLivraison)
self.__ui.btn_effectuer_maintenance.clicked.connect(self.doMaintenance)
self.__ui.actionNouveau_2.triggered.connect(self.nouveau) self.__ui.actionNouveau_2.triggered.connect(self.nouveau)
self.__ui.actionSauvegarder.triggered.connect(self.sauver) self.__ui.actionSauvegarder.triggered.connect(self.sauver)
self.__ui.actionCharger.triggered.connect(self.charger) self.__ui.actionCharger.triggered.connect(self.charger)
@ -43,7 +46,7 @@ class Main:
#Chargement activité # Chargement activité
self.loadLastActivity() self.loadLastActivity()
self.showWindow() self.showWindow()
@ -77,13 +80,14 @@ class Main:
self.__ui.comboBox.addItem(p.nom) self.__ui.comboBox.addItem(p.nom)
def selectParking(self): def selectParking(self):
#onglet detail parking # onglet detail parking
self.__ui.nom.clear() self.__ui.nom.clear()
self.__ui.placesParNiveau.clear() self.__ui.placesParNiveau.clear()
self.__ui.placesDispo.clear() self.__ui.placesDispo.clear()
self.__ui.placesSuperAbo.clear() self.__ui.placesSuperAbo.clear()
if self.__ui.comboBox.count() > 1: if self.__ui.comboBox.count() > 1:
p = Parking.getAllActif() p = Parking.getAllActif()
self.activity("Parking selectionné : " + str(p[self.__ui.comboBox.currentIndex() - 1]), self.lvl.INFO)
self.__ui.nom.setText(p[self.__ui.comboBox.currentIndex() - 1].nom) self.__ui.nom.setText(p[self.__ui.comboBox.currentIndex() - 1].nom)
self.__ui.placesParNiveau.setText(str(p[self.__ui.comboBox.currentIndex() - 1].nbPlaces)) self.__ui.placesParNiveau.setText(str(p[self.__ui.comboBox.currentIndex() - 1].nbPlaces))
self.__ui.placesDispo.setText( self.__ui.placesDispo.setText(
@ -101,24 +105,60 @@ class Main:
self.__ui.comboBox_livraison.clear() self.__ui.comboBox_livraison.clear()
self.__ui.comboBox_entretien.clear() self.__ui.comboBox_entretien.clear()
self.__ui.comboBox_maintenance.clear() self.__ui.comboBox_maintenance.clear()
self.__serviceLivraisons = []
self.__serviceEntretien = []
self.__serviceMaintenance = []
if self.__ui.comboBox.count() > 1: if self.__ui.comboBox.count() > 1:
for s in Service.getAllEnCours(p[self.__ui.comboBox.currentIndex() - 1]): for s in Service.getAllEnCours(p[self.__ui.comboBox.currentIndex() - 1]):
if s.typeService == TypeService.LIVRAISON : if s.typeService == TypeService.LIVRAISON:
self.__ui.comboBox_livraison.addItem(str(s.id)) self.__serviceLivraisons.append(s)
if s.typeService == TypeService.ENTRETIEN : self.__ui.comboBox_livraison.addItem(str(s.info))
self.__ui.comboBox_entretien.addItem(str(s.id)) if s.typeService == TypeService.ENTRETIEN:
if s.typeService == TypeService.MAINTENANCE : self.__serviceEntretien.append(s)
self.__ui.comboBox_maintenance.addItem(str(s.id)) self.__ui.comboBox_entretien.addItem(str(s.info))
if s.typeService == TypeService.MAINTENANCE:
self.__serviceMaintenance.append(s)
self.__ui.comboBox_maintenance.addItem(str(s.info))
#Onglet Stats
#Onglet Stats
def doMaintenance(self):
if len(self.__serviceMaintenance) > 0:
try:
s = self.__serviceMaintenance[self.__ui.comboBox_maintenance.currentIndex()]
s.doService()
self.activity("Livraision reussit : " + str(s), self.lvl.INFO)
except Exception as e:
self.activity("Livraision echoue : " + str(e), self.lvl.FAIL)
self.error("Livraision echoué.")
self.selectParking()
def doEntretien(self):
if len(self.__serviceEntretien) > 0:
try:
s = self.__serviceEntretien[self.__ui.comboBox_entretien.currentIndex()]
s.doService()
self.activity("Entretien reussit : " + str(s), self.lvl.INFO)
except Exception as e:
self.activity("Entretien echoue " + str(e), self.lvl.FAIL)
self.error("Entretien echoué.")
self.selectParking()
def doLivraison(self):
if len(self.__serviceLivraisons) > 0:
try:
s = self.__serviceLivraisons[self.__ui.comboBox_livraison.currentIndex()]
s.doService()
self.activity("Livraison reussit : " + str(s), self.lvl.INFO)
except Exception as e:
self.activity("Livraison echoue : " + str(e), self.lvl.FAIL)
self.error("Livraison echoué.")
self.selectParking()
def creerParking(self): def creerParking(self):
self.__view.hide() self.__view.hide()
self.__widgetCourant = CreaParking(self) self.__widgetCourant = CreaParking(self)
def rmParking(self): def rmParking(self):
if self.__ui.comboBox.currentIndex() != 0: if self.__ui.comboBox.currentIndex() != 0:
result = QtGui.QMessageBox.question(self.__view, result = QtGui.QMessageBox.question(self.__view,
@ -128,12 +168,17 @@ class Main:
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if result == QtGui.QMessageBox.Yes: if result == QtGui.QMessageBox.Yes:
Parking.remove(Parking.parkings[self.__ui.comboBox.currentIndex() - 1]) try:
Parking.remove(Parking.parkings[self.__ui.comboBox.currentIndex() - 1])
self.activity("Supression parking reussit", self.lvl.INFO)
except Exception as e:
self.activity("Suppression parking echoue : " + str(e), self.lvl.FAIL)
self.error("Suppression parking echoué.")
self.__view.hide() self.__view.hide()
self.showWindow() self.showWindow()
def detailsPlacesParking(self): def detailsPlacesParking(self):
if self.__ui.comboBox.currentIndex() != 0 : if self.__ui.comboBox.currentIndex() != 0:
self.__view.hide() self.__view.hide()
self.__widgetCourant = DetailsPlaces(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1]) self.__widgetCourant = DetailsPlaces(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1])
@ -145,10 +190,10 @@ class Main:
def nouveau(self): def nouveau(self):
result = QtGui.QMessageBox.question(self.__view, result = QtGui.QMessageBox.question(self.__view,
"Confirmer Nouveau...", "Confirmer Nouveau...",
"Etes vous sur de vouloir supprimer ?\n" "Etes vous sur de vouloir supprimer ?\n"
"(Toutes données non sauvegardées seront perdues)", "(Toutes données non sauvegardées seront perdues)",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if result == QtGui.QMessageBox.Yes: if result == QtGui.QMessageBox.Yes:
c = connexionBDD() c = connexionBDD()
c.initialisationBDD() c.initialisationBDD()
@ -157,23 +202,44 @@ class Main:
self.majListeParking() self.majListeParking()
def charger(self): def charger(self):
path = QtGui.QFileDialog.getOpenFileName(self.__view,"Charger",".") path = QtGui.QFileDialog.getOpenFileName(self.__view, "Charger", ".")
if path: if path:
connexionBDD.charger(path) try:
connexionBDD.charger(path)
self.activity("Le chargement a reussit", self.lvl.INFO)
except Exception as e:
self.activity("Le chargement a echoue : " + str(e), self.lvl.FAIL)
self.error("Le chargement a echoué.")
self.majListeParking() self.majListeParking()
def sauver(self): def sauver(self):
path = QtGui.QFileDialog.getSaveFileName(self.__view,"Sauvegarder",".") path = QtGui.QFileDialog.getSaveFileName(self.__view, "Sauvegarder", ".")
if path: if path:
connexionBDD.sauver(path) try:
connexionBDD.sauver(path)
self.activity("La sauvegarde a reussit", self.lvl.INFO)
except Exception as e:
self.activity("La sauvegarde a echoue : " + str(e), self.lvl.FAIL)
self.error("La sauvegarde a echoué.")
self.majListeParking() self.majListeParking()
def quitter(self): def quitter(self):
self.__view.close() self.__view.close()
def showWindow(self): def showWindow(self):
self.activity("Chargement de la fenetre principal", self.lvl.INFO)
self.majListeParking() self.majListeParking()
self.__view.show() self.__view.show()
self.__widgetCourant = None # supprime eventuel widget self.__widgetCourant = None # supprime eventuel widget
Borne.bornes = [] Borne.bornes = []
self.__view.focusWidget() # reprend le focus sur la fenetre principal self.__view.focusWidget() # reprend le focus sur la fenetre principal
def error(self, msg):
"""
Qdialog message erreur
:return:
"""
QtGui.QMessageBox.warning(self._w,
"Erreur ...",
msg
)

View File

@ -6,7 +6,7 @@ __author__ = 'sidya'
class Teleporteur: class Teleporteur:
@staticmethod @staticmethod
def teleporterVoiture(voiture, place): def teleporterVoiture(voiture, place):
p = Placement(None,voiture, place) p = Placement(None, voiture, place)
place.prendre() place.prendre()
return p return p

View File

@ -48,6 +48,7 @@ class Log(object):
""" """
Log Manager Log Manager
""" """
def __init__(self): def __init__(self):
""" """
Define 3 differents log : Define 3 differents log :

View File

@ -1,12 +1,14 @@
import random import random
import string import string
from src.m.connexionBDD import connexionBDD from src.m.connexionBDD import connexionBDD
__author__ = 'sidya' __author__ = 'sidya'
class Client: class Client:
def __init__(self,id, nom=None, prenom=None, adresse=None, typeAbonnement=None): def __init__(self, id, nom=None, prenom=None, adresse=None, typeAbonnement=None):
if id is None: if id is None:
self.__nom = nom self.__nom = nom
self.__prenom = prenom self.__prenom = prenom
@ -15,9 +17,9 @@ class Client:
while True: while True:
id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
range(random.randint(1, 10))) range(random.randint(1, 10)))
try : try:
Client(id) Client(id)
except IndexError : except IndexError:
break break
self.__id = id self.__id = id
c = connexionBDD() c = connexionBDD()
@ -26,9 +28,9 @@ class Client:
c.seDeconnecter() c.seDeconnecter()
else: else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM client WHERE idClient='"+str(id)+"'") r = c.execute("SELECT * FROM client WHERE idClient='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__id = id self.__id = id
@ -49,7 +51,7 @@ class Client:
def desabo(self): def desabo(self):
c = connexionBDD() c = connexionBDD()
c.execute("DELETE FROM client WHERE idClient ='"+str(id)+"'") c.execute("DELETE FROM client WHERE idClient ='" + str(id) + "'")
c.seDeconnecter() c.seDeconnecter()
@ -66,7 +68,7 @@ class Client:
return self.__id return self.__id
@property @property
def adr(self,nom, prenom, adresse, typeAbonnement): def adr(self):
return self.__adresse return self.__adresse
@property @property
@ -76,10 +78,12 @@ class Client:
def __str__(self): def __str__(self):
return "[Client :" \ return "[Client :" \
" id = " + str(self.__id) + ", " \ " id = " + str(self.__id) + ", " \
" prenom = " + str(self.__prenom) + ", " \ " prenom = " + str(self.__prenom) + ", " \
" nom = " + str(self.__nom) + ", " \ " nom = " + str(self.__nom) + ", " \
" adresse = " + str(self.__adresse) + ", " \ " adresse = " + str(
" typeAbonnement = " + str(self.__typeAbonnement) + "]" self.__adresse) + ", " \
" typeAbonnement = " + str(self.__typeAbonnement) + "]"
class TypeAbonnement: class TypeAbonnement:
ABONNE = 0 ABONNE = 0

View File

@ -1,36 +1,38 @@
import random import random
import string import string
import time import time
from src.m.Voiture import Voiture
from src.m.connexionBDD import connexionBDD
import random import random
import string import string
import time import time
from src.m.Voiture import Voiture from src.m.Voiture import Voiture
from src.m.connexionBDD import connexionBDD from src.m.connexionBDD import connexionBDD
from src.m.Voiture import Voiture
from src.m.connexionBDD import connexionBDD
__author__ = 'sidya' __author__ = 'sidya'
class Parking: class Parking:
parkings = [] parkings = []
@staticmethod @staticmethod
def get(id): def get(id):
if len(Parking.parkings) == 0 : if len(Parking.parkings) == 0:
Parking.getAllActif() Parking.getAllActif()
for p in Parking.parkings : for p in Parking.parkings:
if p.id == id : if p.id == id:
return p return p
@staticmethod @staticmethod
def getAllActif(): def getAllActif():
if len(Parking.parkings) == 0 : if len(Parking.parkings) == 0:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM parking WHERE actif = 1") r = c.execute("SELECT * FROM parking WHERE actif = 1")
rows = r.fetchall() rows = r.fetchall()
c.seDeconnecter() c.seDeconnecter()
for row in rows : for row in rows:
Parking(row["idParking"], row["nom"], None) Parking(row["idParking"], row["nom"], None)
return Parking.parkings return Parking.parkings
@ -38,7 +40,7 @@ class Parking:
def remove(parking): def remove(parking):
Parking.parkings.remove(parking) Parking.parkings.remove(parking)
c = connexionBDD() c = connexionBDD()
c.execute("UPDATE parking SET actif = 0 WHERE idParking='"+str(parking.id)+"'") c.execute("UPDATE parking SET actif = 0 WHERE idParking='" + str(parking.id) + "'")
c.seDeconnecter() c.seDeconnecter()
@staticmethod @staticmethod
@ -48,17 +50,22 @@ class Parking:
def __init__(self, id, nom=None, listeTypePlace=None): def __init__(self, id, nom=None, listeTypePlace=None):
self.__nom = nom self.__nom = nom
if id is None : if id is None:
c = connexionBDD() c = connexionBDD()
c.execute("INSERT INTO parking (nom) VALUES ('"+str(self.__nom)+"')", ()) c.execute("INSERT INTO parking (nom) VALUES ('" + str(self.__nom) + "')", ())
self.__id = c.lastId() self.__id = c.lastId()
#Crea des places # Crea des places
n = 0 n = 0
for typePlace in listeTypePlace : placeParNiveau = {}
for i in range(typePlace.nombre) : for typePlace in listeTypePlace:
print(Place(None,self,typePlace,n,1,True,False)) try:
n += 1 i = placeParNiveau[typePlace.niveau]
else : except KeyError:
i = 0
placeParNiveau[typePlace.niveau] = i + typePlace.nombre
for i in range(placeParNiveau[typePlace.niveau]):
Place(None, self, typePlace, i, True, False)
else:
self.__id = id self.__id = id
self.parkings.append(self) self.parkings.append(self)
@ -91,24 +98,23 @@ class Parking:
return Place.placeValide(self.__id, voiture) return Place.placeValide(self.__id, voiture)
def addPlaceSuperAbo(self, parking): def addPlaceSuperAbo(self, parking):
return Place(None, parking, None, None, None, True) return Place(None, parking, None, None, False, True)
def __str__(self): def __str__(self):
return "[Parking : nom = " + self.__nom +"]" return "[Parking : nom = " + self.__nom + "]"
class Place: class Place:
def __init__(self, id=None, parking=None, typePlace=None, numero=None, niveau=None,estLibre=True, estSuperAbo=False): def __init__(self, id=None, parking=None, typePlace=None, numero=None, estLibre=True, estSuperAbo=False):
if id is None : if id is None:
self.__parking = parking self.__parking = parking
self.__typePlace = typePlace self.__typePlace = typePlace
self.__numero = numero self.__numero = numero
self.__niveau = niveau
self.__estLibre = estLibre self.__estLibre = estLibre
self.__estSuperAbo = estSuperAbo self.__estSuperAbo = estSuperAbo
if self.__typePlace is None: if self.__typePlace is None:
t = "NULL" t = "NULL"
else : else:
t = self.__typePlace.id t = self.__typePlace.id
c = connexionBDD() c = connexionBDD()
c.execute("INSERT INTO place (idParking, idTypePlace, numero, estLibre, estSuperAbo) " c.execute("INSERT INTO place (idParking, idTypePlace, numero, estLibre, estSuperAbo) "
@ -117,16 +123,16 @@ class Place:
self.__numero, int(self.__estLibre), int(self.__estSuperAbo))) self.__numero, int(self.__estLibre), int(self.__estSuperAbo)))
self.__id = c.lastId() self.__id = c.lastId()
c.seDeconnecter() c.seDeconnecter()
else : else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM place WHERE idPlace='"+str(id)+"'") r = c.execute("SELECT * FROM place WHERE idPlace='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__parking = Parking.get(row["idParking"]) self.__parking = Parking.get(row["idParking"])
self.__typePlace = TypePlace(row["idTypePlace"]) self.__typePlace = TypePlace(row["idTypePlace"])
self.__numero = row["numero"] self.__numero = row["numero"]
self.__estLibre = row["estLibre"] self.__estLibre = row["estLibre"]
self.__estSuperAbo = row["estSuperAbo"] self.__estSuperAbo = row["estSuperAbo"]
self.__id = id self.__id = id
@ -135,6 +141,7 @@ class Place:
def id(self): def id(self):
return self.__id return self.__id
def prendre(self): def prendre(self):
""" """
Rend la place indisponible Rend la place indisponible
@ -145,7 +152,7 @@ class Place:
raise Exception("Place déjà prise") raise Exception("Place déjà prise")
self.__estLibre = False self.__estLibre = False
c = connexionBDD() c = connexionBDD()
c.execute("UPDATE place SET estLibre = 0 WHERE idPlace ='"+str(self.__id)+"'") c.execute("UPDATE place SET estLibre = 0 WHERE idPlace ='" + str(self.__id) + "'")
c.seDeconnecter() c.seDeconnecter()
def liberer(self): def liberer(self):
@ -157,17 +164,22 @@ class Place:
raise Exception("Impossible de liberer une place vide") raise Exception("Impossible de liberer une place vide")
self.__estLibre = True self.__estLibre = True
c = connexionBDD() c = connexionBDD()
c.execute("UPDATE place SET estLibre = 1 WHERE idPlace ='"+str(self.__id)+"'") c.execute(
"UPDATE place SET estLibre = 1, fin ='" + str(time.time()) + "' WHERE idPlace ='" + str(self.__id) + "'")
c.seDeconnecter() c.seDeconnecter()
@property @property
def identification(self): def identification(self):
return TypePlace(self.__typePlace).niveau + ":" + self.__numero return str(chr(self.__typePlace.niveau + ord('A')) + ":" + str(self.__numero))
@property @property
def estlibre(self): def estlibre(self):
return self.__estLibre return self.__estLibre
@property
def typePlace(self):
return self.__typePlace
@staticmethod @staticmethod
def nbPlaceParking(idParking): def nbPlaceParking(idParking):
c = connexionBDD() c = connexionBDD()
@ -179,7 +191,7 @@ class Place:
@staticmethod @staticmethod
def nbPlaceLibreParking(idParking): def nbPlaceLibreParking(idParking):
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT COUNT(*) FROM place WHERE idParking = "+str(idParking)+" AND estLibre = 1") r = c.execute("SELECT COUNT(*) FROM place WHERE idParking = " + str(idParking) + " AND estLibre = 1")
row = r.fetchone() row = r.fetchone()
c.seDeconnecter() c.seDeconnecter()
return row[0] return row[0]
@ -187,7 +199,7 @@ class Place:
@staticmethod @staticmethod
def nbSuperAbo(idParking): def nbSuperAbo(idParking):
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT COUNT(*) FROM place WHERE idParking = "+str(idParking)+" AND estSuperAbo = 1") r = c.execute("SELECT COUNT(*) FROM place WHERE idParking = " + str(idParking) + " AND estSuperAbo = 1")
row = r.fetchone() row = r.fetchone()
c.seDeconnecter() c.seDeconnecter()
return row[0] return row[0]
@ -198,31 +210,29 @@ class Place:
r = c.execute("SELECT * FROM place WHERE idParking= ? AND estLibre = 1 " r = c.execute("SELECT * FROM place WHERE idParking= ? AND estLibre = 1 "
"AND idTypePlace =(SELECT idTypePlace FROM typePlace " "AND idTypePlace =(SELECT idTypePlace FROM typePlace "
"WHERE hauteur>? AND longueur>? ORDER BY longueur) ", "WHERE hauteur>? AND longueur>? ORDER BY longueur) ",
(str(idPArking),str(voiture.hauteur),str(voiture.longueur))) (str(idPArking), str(voiture.hauteur), str(voiture.longueur)))
row = r.fetchone() row = r.fetchone()
c.seDeconnecter() c.seDeconnecter()
if row is None : if row is None:
return None return None
else : else:
return Place(row["idPlace"],row["idParking"], row["idTypePlace"], return Place(row["idPlace"], row["idParking"], row["idTypePlace"],
row["numero"], bool(row["estLibre"]), bool(row["estSuperAbo"])) row["numero"], bool(row["estLibre"]), bool(row["estSuperAbo"]))
def __str__(self): def __str__(self):
return "[Place : " \ return "[Place : " \
"Parking = " + str(self.__parking) + "," \ "Parking = " + str(self.__parking) + "," \
"typePlace = " + str(self.__typePlace) + "," \ "typePlace = " + str(self.__typePlace) + "," \
"numero = " + str(self.__numero) + "," \ "numero = " + str(
"estLibre = " + str(self.__estLibre) + "," \ self.__numero) + "," \
"estSuperAbo = " + str(self.__estSuperAbo) + "]" \ "estLibre = " + str(self.__estLibre) + "," \
"estSuperAbo = " + str(self.__estSuperAbo) + "]" \
\
\
class TypePlace: class TypePlace:
def __init__(self, id ,longueur=None, hauteur=None, nombre=None, prix=None, niveau=None): def __init__(self, id, longueur=None, hauteur=None, nombre=None, prix=None, niveau=None):
if id is None : if id is None:
self.__longueur = longueur self.__longueur = longueur
self.__hauteur = hauteur self.__hauteur = hauteur
self.__nombre = nombre self.__nombre = nombre
@ -230,14 +240,14 @@ class TypePlace:
self.__niveau = niveau self.__niveau = niveau
c = connexionBDD() c = connexionBDD()
c.execute("INSERT INTO typePlace (longueur,hauteur,nombre, prix, niveau) VALUES (?,?,?,?,?)", c.execute("INSERT INTO typePlace (longueur,hauteur,nombre, prix, niveau) VALUES (?,?,?,?,?)",
(self.__longueur, self.__hauteur, self.__nombre,self.__prix, self.__niveau)) (self.__longueur, self.__hauteur, self.__nombre, self.__prix, self.__niveau))
self.__id = c.lastId() self.__id = c.lastId()
c.seDeconnecter() c.seDeconnecter()
else: else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM typePlace WHERE idTypePlace='"+str(id)+"'") r = c.execute("SELECT * FROM typePlace WHERE idTypePlace='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__longueur = row["longueur"] self.__longueur = row["longueur"]
@ -274,11 +284,13 @@ class TypePlace:
def __str__(self): def __str__(self):
return "[TypePlace : " \ return "[TypePlace : " \
"id = " + str(self.__id) + "," \ "id = " + str(self.__id) + "," \
"longueur = " + str(self.__longueur) + "," \ "longueur = " + str(self.__longueur) + "," \
"hauteur = " + str(self.__hauteur) + "," \ "hauteur = " + str(
"nombre = " + str(self.__nombre) + "," \ self.__hauteur) + "," \
"prix = " + str(self.__prix) + "," \ "nombre = " + str(self.__nombre) + "," \
"niveau = " + str(self.__niveau) + "]" "prix = " + str(self.__prix) + "," \
"niveau = " + str(
self.__niveau) + "]"
class Placement: class Placement:
@ -289,14 +301,14 @@ class Placement:
:param place: Place :param place: Place
:return: :return:
""" """
if id is None : if id is None:
self.__voiture = voiture self.__voiture = voiture
self.__place = place self.__place = place
self.__debut = time.time() self.__debut = time.time()
self.__fin = None self.__fin = None
while True: while True:
id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
range(random.randint(1, 10))) range(random.randint(1, 10)))
try: try:
Placement(id) Placement(id)
except IndexError: except IndexError:
@ -308,9 +320,9 @@ class Placement:
c.seDeconnecter() c.seDeconnecter()
else: else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM placement WHERE idPlacement='"+str(id)+"'") r = c.execute("SELECT * FROM placement WHERE idPlacement='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__voiture = Voiture(row["idVoiture"]) self.__voiture = Voiture(row["idVoiture"])
@ -327,16 +339,22 @@ class Placement:
def place(self): def place(self):
return self.__place return self.__place
@property
def voiture(self):
return self.__voiture
def end(self): def end(self):
self.__fin = time.time() self.__fin = time.time()
c = connexionBDD() c = connexionBDD()
c.execute("UPDATE placement SET fin='"+str(self.__fin)+"' WHERE idPlacement='"+str(id)+"'") c.execute("UPDATE placement SET fin='" + str(self.__fin) + "' WHERE idPlacement='" + str(id) + "'")
c.seDeconnecter() c.seDeconnecter()
self.__place.liberer()
def __str__(self): def __str__(self):
return "[Placement : " \ return "[Placement : " \
"id = " + str(self.__id) +"," \ "id = " + str(self.__id) + "," \
"Voiture = " + str(self.__voiture) +"," \ "Voiture = " + str(self.__voiture) + "," \
"Place = " + str(self.__place) +"," \ "Place = " + str(self.__place) + "," \
"Debut = " + str(self.__debut) +"," \ "Debut = " + str(
"Fin = " + str(self.__fin) +"]" self.__debut) + "," \
"Fin = " + str(self.__fin) + "]"

View File

@ -1,29 +1,45 @@
import time import time
from src.m.Client import Client from src.m.Client import Client
from src.m.Parking import Placement from src.m.Parking import Placement
from src.m.connexionBDD import connexionBDD from src.m.connexionBDD import connexionBDD
__author__ = 'sidya' __author__ = 'sidya'
class Service: class Service:
@staticmethod @staticmethod
def getAllEnCours(parking): def getAllEnCours(parking):
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM service WHERE dateRealisation is NULL " r = c.execute("SELECT * FROM service WHERE dateRealisation is NULL "
"AND idPlacement IN (SELECT idPlacement FROM PLACEMENT WHERE " "AND idPlacement IN (SELECT idPlacement FROM PLACEMENT WHERE "
"idPlace IN (SELECT idPlace FROM Place WHERE idParking = '"+str(parking.id)+"'))") "idPlace IN (SELECT idPlace FROM Place WHERE idParking = '" + str(parking.id) + "'))")
rows = r.fetchall() rows = r.fetchall()
c.seDeconnecter() c.seDeconnecter()
l =[] l = []
for row in rows: for row in rows:
l.append(Service(row["idService"], Client(row["idClient"]), Placement(row["idPlacement"]), l.append(Service(row["idService"], Client(row["idClient"]), Placement(row["idPlacement"]),
row["typeService"], row["dateDemande"], row["dateService"], row["dateRealisation"])) row["typeService"], row["dateDemande"], row["dateService"], row["dateRealisation"]))
print("l = " + str(l)) print("l = " + str(l))
return l return l
def __init__(self, id, client= None, placement= None, typeService= None, @staticmethod
dateService = None, dateDemande = time.time(), dateRealisation = None): def getAllServicePlacement(placement):
if id is None : c = connexionBDD()
r = c.execute("SELECT * FROM service WHERE idPlacement ='" + str(placement.id) + "'")
rows = r.fetchall()
c.seDeconnecter()
l = []
for row in rows:
l.append(Service(row["idService"], Client(row["idClient"]), Placement(row["idPlacement"]),
row["typeService"], row["dateDemande"], row["dateService"], row["dateRealisation"]))
print("l = " + str(l))
return l
def __init__(self, id, client=None, placement=None, typeService=None,
dateService=None, dateDemande=time.time(), dateRealisation=None):
if id is None:
self.__client = client self.__client = client
self.__placement = placement self.__placement = placement
self.__typeService = typeService self.__typeService = typeService
@ -32,14 +48,15 @@ class Service:
self.__dateRealisation = dateRealisation self.__dateRealisation = dateRealisation
c = connexionBDD() c = connexionBDD()
c.execute("INSERT INTO service (idClient,idPlacement, typeService, dateDemande) VALUES (?,?,?,?)", c.execute("INSERT INTO service (idClient,idPlacement, typeService, dateDemande) VALUES (?,?,?,?)",
(str(self.__client.id), str(self.__placement.id), str(self.__typeService), str(self.__dateDemande))) (str(self.__client.id), str(self.__placement.id), str(self.__typeService),
str(self.__dateDemande)))
self.__id = c.lastId() self.__id = c.lastId()
c.seDeconnecter() c.seDeconnecter()
else: else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM service WHERE idService='"+str(id)+"'") r = c.execute("SELECT * FROM service WHERE idService='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__id = id self.__id = id
@ -56,17 +73,41 @@ class Service:
return self.__id return self.__id
@property @property
def typeService(self) : def typeService(self):
return self.__typeService return self.__typeService
@property
def placement(self):
return self.__placement
@property
def info(self):
str = "Place : " + self.__placement.place.identification + "Imma : " + self.__placement.voiture.immatriculation
if self.typeService == TypeService.LIVRAISON:
str += "Date : " + self.__dateService
return str
@property
def estRealise(self):
return self.__dateRealisation is None or self.__dateRealisation == "NULL"
def doService(self):
self.__dateRealisation = time.time()
c = connexionBDD()
c.execute("UPDATE service SET dateRealisation = '" + str(self.__dateRealisation) + "' WHERE idService='" + str(
self.__id) + "'")
c.seDeconnecter()
def __str__(self): def __str__(self):
return "[Service : " \ return "[Service : " \
"id = " + str(self.__id) +"," \ "id = " + str(self.__id) + "," \
"Client = " + str(self.__client) +"," \ "Client = " + str(self.__client) + "," \
"TypeService = " + str(self.__typeService) +"," \ "TypeService = " + str(
"DateDemande = " + str(self.__dateDemande) +"," \ self.__typeService) + "," \
"DateService = " + str(self.__dateService) +"," \ "DateDemande = " + str(self.__dateDemande) + "," \
"DateRealisation = " + str(self.__dateRealisation) +"]" "DateService = " + str(
self.__dateService) + "," \
"DateRealisation = " + str(self.__dateRealisation) + "]"
class TypeService: class TypeService:

View File

@ -1,33 +1,47 @@
from src.m.Client import Client
from src.m.connexionBDD import connexionBDD from src.m.connexionBDD import connexionBDD
__author__ = 'sidya' __author__ = 'sidya'
class Voiture: class Voiture:
def __init__(self, id, idClient=None, longueur=None, hauteur=None, imma=None, estDansParking=False): def __init__(self, id, client=None, longueur=None, hauteur=None, imma=None):
if id is None : if id is None:
self.__idClient = idClient if client is None:
self.__client = "NULL"
cl = "NULL"
else:
self.__client = client
cl = self.__client.id
self.__longueur = longueur self.__longueur = longueur
self.__hauteur = hauteur self.__hauteur = hauteur
self.__imma = imma self.__imma = imma
self.__estDansParking = estDansParking
c = connexionBDD() c = connexionBDD()
c.execute("INSERT INTO voiture (longueur, hauteur, imma, estDansParking) VALUES (?,?,?,?)", c.execute("INSERT INTO voiture (idClient,longueur, hauteur, imma) VALUES (?,?,?,?)",
(self.__longueur, self.__hauteur, self.__imma, int(self.__estDansParking))) (cl, self.__longueur, self.__hauteur, self.__imma))
self.__id = c.lastId() self.__id = c.lastId()
c.seDeconnecter() c.seDeconnecter()
else: else:
c = connexionBDD() c = connexionBDD()
r = c.execute("SELECT * FROM voiture WHERE idVoiture='"+str(id)+"'") r = c.execute("SELECT * FROM voiture WHERE idVoiture='" + str(id) + "'")
row = r.fetchone() row = r.fetchone()
if row is None : if row is None:
raise IndexError("Invalid id") raise IndexError("Invalid id")
c.seDeconnecter() c.seDeconnecter()
self.__id = id self.__id = id
self.__idClient = row["idClient"] try:
self.__client = Client(row["idClient"])
except IndexError:
self.__client = "NULL"
self.__longueur = row["longueur"] self.__longueur = row["longueur"]
self.__hauteur = row["hauteur"] self.__hauteur = row["hauteur"]
self.__imma = row["imma"] self.__imma = row["imma"]
self.__estDansParking = row["estDansParking"]
def setClient(self, client):
self.__client = client
c = connexionBDD()
c.execute("UPDATE voiture SET idClient = '" + str(client.id) + "' WHERE idVoiture='" + str(self.id) + "'")
c.seDeconnecter()
@property @property
@ -47,13 +61,14 @@ class Voiture:
return self.__imma return self.__imma
@property @property
def estDansParking(self): def client(self):
return self.__estDansParking == True return self.__client
def __str__(self): def __str__(self):
return "[Voiture :" \ return "[Voiture :" \
" id = " + str(self.__id) + ", " \ " id = " + str(self.__id) + ", " \
" longueur = " + str(self.__longueur) + ", " \ " client = " + str(self.__client) + ", " \
" hauteur = " + str(self.__hauteur) + ", " \ " longueur = " + str(
" imma = " + str(self.__imma) + ", " \ self.__longueur) + ", " \
" estDansParking = " + str(self.__estDansParking)+"]" " hauteur = " + str(self.__hauteur) + ", " \
" imma = " + str(self.__imma) + "]"

View File

@ -4,9 +4,11 @@ __author__ = 'sidya'
import sqlite3 import sqlite3
class connexionBDD: class connexionBDD:
__chemin = "m/BDDprojetPython.sq3" __chemin = "m/BDDprojetPython.sq3"
__sql = "m/table.sql" __sql = "m/table.sql"
def __init__(self): def __init__(self):
try: try:
with open(self.__chemin): with open(self.__chemin):
@ -21,9 +23,9 @@ class connexionBDD:
self.__cur = self.__conn.cursor() self.__cur = self.__conn.cursor()
def execute(self, req, param = ()): def execute(self, req, param=()):
r = None r = None
#try: # try:
r = self.__cur.execute(req, param) r = self.__cur.execute(req, param)
self.__conn.commit() self.__conn.commit()
"""except Exception as e: """except Exception as e:
@ -39,7 +41,7 @@ class connexionBDD:
def initialisationBDD(self): def initialisationBDD(self):
with open(self.__sql) as f: with open(self.__sql) as f:
sql = f.read() sql = f.read()
self.__conn.executescript(sql) self.__conn.executescript(sql)
self.__conn.commit() self.__conn.commit()

View File

@ -59,8 +59,7 @@ CREATE TABLE voiture (
idClient VARCHAR(10), idClient VARCHAR(10),
hauteur INTEGER, hauteur INTEGER,
longueur INTEGER, longueur INTEGER,
imma VARCHAR(10), imma VARCHAR(10)
estDansParking INTEGER(1)
); );

View File

@ -1,9 +1,6 @@
__author__ = 'sidya' __author__ = 'sidya'
from nose.tools import assert_equal
from src.m.Parking import Parking, TypePlace, Place class TestClient:
class TestClient :
def TestClient(self): def TestClient(self):
pass pass

View File

@ -4,9 +4,10 @@ from nose.tools import assert_equal
from src.m.Parking import Parking, TypePlace, Place from src.m.Parking import Parking, TypePlace, Place
class TestParking :
class TestParking:
def TestParking(self): def TestParking(self):
p = Parking(None,"test",[TypePlace(None,220,200,4,2.5,1),TypePlace(None,200,130,5,2.5,1)]) p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1), TypePlace(None, 200, 130, 5, 2.5, 1)])
id = p.id id = p.id
assert_equal(p.nbPlacesLibresParking, 9, "Nombre de place libre non valide") assert_equal(p.nbPlacesLibresParking, 9, "Nombre de place libre non valide")
assert_equal(p.nbPlaces, 9, "Nombre de place non valide") assert_equal(p.nbPlaces, 9, "Nombre de place non valide")
@ -15,18 +16,19 @@ class TestParking :
def TestRecherchePlace(self): def TestRecherchePlace(self):
pass pass
class TestPlace :
def TestPlace(self):
t1 =TypePlace(None,220,200,4,2.5,1)
parking = Parking(None,"test",[t1])
p = Place(None,parking,t1,2,1) class TestPlace:
def TestPlace(self):
t1 = TypePlace(None, 220, 200, 4, 2.5, 1)
parking = Parking(None, "test", [t1])
p = Place(None, parking, t1, 2, 1)
def TestPrendreLiberer(self): def TestPrendreLiberer(self):
t1 = TypePlace(None,220,200,4,2.5,1) t1 = TypePlace(None, 220, 200, 4, 2.5, 1)
parking = Parking(None,"test",[t1]) parking = Parking(None, "test", [t1])
p = Place(None,parking,t1,2,1) p = Place(None, parking, t1, 2, 1)
assert_equal(p.estlibre, True, "La place devrait etre libre") assert_equal(p.estlibre, True, "La place devrait etre libre")
@ -36,7 +38,7 @@ class TestPlace :
try: try:
p.prendre() p.prendre()
assert_equal(True, False, "Une place prise ne peut pas a nouveau prise") assert_equal(True, False, "Une place prise ne peut pas a nouveau prise")
except Exception : except Exception:
pass pass
p.liberer() p.liberer()
@ -45,18 +47,18 @@ class TestPlace :
try: try:
p.liberer() p.liberer()
assert_equal(True, False, "Une place libre ne peut pas a nouveau liberée") assert_equal(True, False, "Une place libre ne peut pas a nouveau liberée")
except Exception : except Exception:
pass pass
class TestTypePlace : class TestTypePlace:
def TestTypePlace(self): def TestTypePlace(self):
#Creation # Creation
t = TypePlace(None,220,200,4,2.5,1) t = TypePlace(None, 220, 200, 4, 2.5, 1)
assert_equal(t.longueur, 220, "Valeur non attendue pour la longueur") assert_equal(t.longueur, 220, "Valeur non attendue pour la longueur")
assert_equal(t.hauteur, 200,"Valeur non attendue pour la hauteur") assert_equal(t.hauteur, 200, "Valeur non attendue pour la hauteur")
assert_equal(t.nombre,4,"Valeur non attendue pour le nombre de place") assert_equal(t.nombre, 4, "Valeur non attendue pour le nombre de place")
assert_equal(t.prix, 2.5,"Valeur non attendue pour le prix") assert_equal(t.prix, 2.5, "Valeur non attendue pour le prix")
assert_equal(t.niveau, 1, "Valeur non attendue pour le niveau") assert_equal(t.niveau, 1, "Valeur non attendue pour le niveau")
id = t.id id = t.id
@ -64,11 +66,11 @@ class TestTypePlace :
try: try:
t = TypePlace("aaaa") t = TypePlace("aaaa")
assert_equal(True, False, "Un id invalide pour une type de place doit lever une exection") assert_equal(True, False, "Un id invalide pour une type de place doit lever une exection")
except IndexError : except IndexError:
pass pass
#Recuperer un TypePlace existant #Recuperer un TypePlace existant
try: try:
t = TypePlace(id) t = TypePlace(id)
except IndexError : except IndexError:
assert_equal(True, False, "Un id valide pour une type de place ne doit pas lever une exection") assert_equal(True, False, "Un id valide pour une type de place ne doit pas lever une exection")

View File

@ -1,10 +1,6 @@
from src.m.Service import Service
__author__ = 'sidya' __author__ = 'sidya'
from nose.tools import assert_equal
class TestService:
class TestService :
def TestService(self): def TestService(self):
pass pass

View File

@ -5,24 +5,23 @@ __author__ = 'sidya'
from nose.tools import assert_equal from nose.tools import assert_equal
class TestVoiture:
class TestVoiture :
def TestVoiture(self): def TestVoiture(self):
v = Voiture(None,None,120,100,"IMMA") v = Voiture(None, None, 120, 100, "IMMA")
assert_equal(v.longueur, 120, "Ne retourne pas la longueur attendue") assert_equal(v.longueur, 120, "Ne retourne pas la longueur attendue")
assert_equal(v.hauteur, 100, "Ne retourne pas la hateur attendue") assert_equal(v.hauteur, 100, "Ne retourne pas la hateur attendue")
assert_equal(v.immatriculation, "IMMA", "Ne retourne pas l'immatriculation attendue") assert_equal(v.immatriculation, "IMMA", "Ne retourne pas l'immatriculation attendue")
id = v.id id = v.id
#Recuperer une Voiture Non existant # Recuperer une Voiture Non existant
try: try:
t = Voiture("aaaa") t = Voiture("aaaa")
assert_equal(True, False, "Un id invalide pour une voiture doit lever une exection") assert_equal(True, False, "Un id invalide pour une voiture doit lever une exection")
except IndexError : except IndexError:
pass pass
#Recuperer un Voiture existant #Recuperer un Voiture existant
try: try:
t = Voiture(id) t = Voiture(id)
except IndexError : except IndexError:
assert_equal(True, False, "Un id valide pour une voiture ne doit pas lever une exection") assert_equal(True, False, "Un id valide pour une voiture ne doit pas lever une exection")

View File

@ -8,9 +8,9 @@ __author__ = 'sidya'
class Camera: class Camera:
@classmethod @staticmethod
def donnerVoiture(self): def donnerVoiture():
v = Voiture(None, None, random.randint(150, 300), random.randint(100, 200), ''.join( v = Voiture(None, None, random.randint(150, 300), random.randint(100, 200), ''.join(
random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
range(random.randint(1, 10))),False) range(random.randint(5, 10))))
return v return v

View File

@ -3,7 +3,7 @@
# Form implementation generated from reading ui file 'borne.ui' # Form implementation generated from reading ui file 'borne.ui'
# #
# Created: Sun Feb 1 14:38:43 2015 # Created: Sun Feb 1 14:38:43 2015
# by: PyQt4 UI code generator 4.11.3 # by: PyQt4 UI code generator 4.11.3
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -17,12 +17,14 @@ except AttributeError:
try: try:
_encoding = QtGui.QApplication.UnicodeUTF8 _encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding) return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError: except AttributeError:
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig) return QtGui.QApplication.translate(context, text, disambig)
class Ui_Borne(object): class Ui_Borne(object):
def setupUi(self, Borne): def setupUi(self, Borne):
Borne.setObjectName(_fromUtf8("Borne")) Borne.setObjectName(_fromUtf8("Borne"))
@ -195,7 +197,8 @@ class Ui_Borne(object):
def retranslateUi(self, Borne): def retranslateUi(self, Borne):
Borne.setWindowTitle(_translate("Borne", "Borne", None)) Borne.setWindowTitle(_translate("Borne", "Borne", None))
self.btn_Voiture.setText(_translate("Borne", "Detection Arrivee Voiture", None)) self.btn_Voiture.setText(_translate("Borne", "Detection Arrivee Voiture", None))
self.nomParking.setText(_translate("Borne", "<html><head/><body><p align=\"center\">NomParking</p></body></html>", None)) self.nomParking.setText(
_translate("Borne", "<html><head/><body><p align=\"center\">NomParking</p></body></html>", None))
self.box_id.setTitle(_translate("Borne", "Identification", None)) self.box_id.setTitle(_translate("Borne", "Identification", None))
self.label.setText(_translate("Borne", "Carte Membre ID ", None)) self.label.setText(_translate("Borne", "Carte Membre ID ", None))
self.btn_validerID.setText(_translate("Borne", "Valider", None)) self.btn_validerID.setText(_translate("Borne", "Valider", None))
@ -211,7 +214,8 @@ class Ui_Borne(object):
self.numeroTicketLabel.setText(_translate("Borne", "Numero Ticket :", None)) self.numeroTicketLabel.setText(_translate("Borne", "Numero Ticket :", None))
self.btn_recuperer.setText(_translate("Borne", "Récupérer Véhicule", None)) self.btn_recuperer.setText(_translate("Borne", "Récupérer Véhicule", None))
self.pushButton.setText(_translate("Borne", "Payer", None)) self.pushButton.setText(_translate("Borne", "Payer", None))
self.label_aff.setText(_translate("Borne", "<html><head/><body><p align=\"center\">TextLabel</p></body></html>", None)) self.label_aff.setText(
_translate("Borne", "<html><head/><body><p align=\"center\">TextLabel</p></body></html>", None))
self.box_garer.setTitle(_translate("Borne", "Se garer", None)) self.box_garer.setTitle(_translate("Borne", "Se garer", None))
self.btn_garer.setText(_translate("Borne", "Garer Véhicule", None)) self.btn_garer.setText(_translate("Borne", "Garer Véhicule", None))
self.box_service.setTitle(_translate("Borne", "Service (Abonnée seulement)", None)) self.box_service.setTitle(_translate("Borne", "Service (Abonnée seulement)", None))

View File

@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'creationParking.ui' # Form implementation generated from reading ui file 'creationParking.ui'
# #
# Created: Sat Jan 17 15:11:03 2015 # Created: Thu Feb 5 00:32:25 2015
# by: PyQt4 UI code generator 4.11.3 # by: PyQt4 UI code generator 4.11.3
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -17,12 +17,14 @@ except AttributeError:
try: try:
_encoding = QtGui.QApplication.UnicodeUTF8 _encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding) return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError: except AttributeError:
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig) return QtGui.QApplication.translate(context, text, disambig)
class Ui_CreaParking(object): class Ui_CreaParking(object):
def setupUi(self, CreaParking): def setupUi(self, CreaParking):
CreaParking.setObjectName(_fromUtf8("CreaParking")) CreaParking.setObjectName(_fromUtf8("CreaParking"))
@ -39,20 +41,8 @@ class Ui_CreaParking(object):
self.btn_valider = QtGui.QPushButton(self.layoutWidget) self.btn_valider = QtGui.QPushButton(self.layoutWidget)
self.btn_valider.setObjectName(_fromUtf8("btn_valider")) self.btn_valider.setObjectName(_fromUtf8("btn_valider"))
self.horizontalLayout_2.addWidget(self.btn_valider) self.horizontalLayout_2.addWidget(self.btn_valider)
self.layoutWidget1 = QtGui.QWidget(CreaParking)
self.layoutWidget1.setGeometry(QtCore.QRect(200, 230, 275, 25))
self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout_3.setMargin(0)
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.label_4 = QtGui.QLabel(self.layoutWidget1)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.horizontalLayout_3.addWidget(self.label_4)
self.nbPlacesTotal = QtGui.QLabel(self.layoutWidget1)
self.nbPlacesTotal.setObjectName(_fromUtf8("nbPlacesTotal"))
self.horizontalLayout_3.addWidget(self.nbPlacesTotal)
self.tableWidget = QtGui.QTableWidget(CreaParking) self.tableWidget = QtGui.QTableWidget(CreaParking)
self.tableWidget.setGeometry(QtCore.QRect(30, 100, 521, 121)) self.tableWidget.setGeometry(QtCore.QRect(30, 100, 521, 141))
self.tableWidget.setObjectName(_fromUtf8("tableWidget")) self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
self.tableWidget.setColumnCount(5) self.tableWidget.setColumnCount(5)
self.tableWidget.setRowCount(0) self.tableWidget.setRowCount(0)
@ -72,21 +62,21 @@ class Ui_CreaParking(object):
self.btn_rmRow = QtGui.QPushButton(CreaParking) self.btn_rmRow = QtGui.QPushButton(CreaParking)
self.btn_rmRow.setGeometry(QtCore.QRect(570, 170, 41, 27)) self.btn_rmRow.setGeometry(QtCore.QRect(570, 170, 41, 27))
self.btn_rmRow.setObjectName(_fromUtf8("btn_rmRow")) self.btn_rmRow.setObjectName(_fromUtf8("btn_rmRow"))
self.layoutWidget2 = QtGui.QWidget(CreaParking) self.layoutWidget1 = QtGui.QWidget(CreaParking)
self.layoutWidget2.setGeometry(QtCore.QRect(180, 20, 291, 56)) self.layoutWidget1.setGeometry(QtCore.QRect(180, 20, 291, 56))
self.layoutWidget2.setObjectName(_fromUtf8("layoutWidget2")) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget2) self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout.setMargin(0) self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.layoutWidget2) self.label = QtGui.QLabel(self.layoutWidget1)
self.label.setObjectName(_fromUtf8("label")) self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label) self.verticalLayout.addWidget(self.label)
self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.lineEdit_nom = QtGui.QLineEdit(self.layoutWidget2) self.lineEdit_nom = QtGui.QLineEdit(self.layoutWidget1)
self.lineEdit_nom.setObjectName(_fromUtf8("lineEdit_nom")) self.lineEdit_nom.setObjectName(_fromUtf8("lineEdit_nom"))
self.verticalLayout_2.addWidget(self.lineEdit_nom) self.verticalLayout_2.addWidget(self.lineEdit_nom)
self.horizontalLayout.addLayout(self.verticalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout_2)
@ -103,8 +93,6 @@ class Ui_CreaParking(object):
CreaParking.setWindowTitle(_translate("CreaParking", "Creation Parking", None)) CreaParking.setWindowTitle(_translate("CreaParking", "Creation Parking", None))
self.btn_annuler.setText(_translate("CreaParking", "Annuler", None)) self.btn_annuler.setText(_translate("CreaParking", "Annuler", None))
self.btn_valider.setText(_translate("CreaParking", "Valider", None)) self.btn_valider.setText(_translate("CreaParking", "Valider", None))
self.label_4.setText(_translate("CreaParking", "Nombre Places Total : ", None))
self.nbPlacesTotal.setText(_translate("CreaParking", "TextLabel", None))
item = self.tableWidget.horizontalHeaderItem(0) item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("CreaParking", "Hauteur (cm)", None)) item.setText(_translate("CreaParking", "Hauteur (cm)", None))
item = self.tableWidget.horizontalHeaderItem(1) item = self.tableWidget.horizontalHeaderItem(1)

View File

@ -3,7 +3,7 @@
# Form implementation generated from reading ui file 'main.ui' # Form implementation generated from reading ui file 'main.ui'
# #
# Created: Thu Jan 22 09:11:44 2015 # Created: Thu Jan 22 09:11:44 2015
# by: PyQt4 UI code generator 4.11.3 # by: PyQt4 UI code generator 4.11.3
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -17,12 +17,14 @@ except AttributeError:
try: try:
_encoding = QtGui.QApplication.UnicodeUTF8 _encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding) return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError: except AttributeError:
def _translate(context, text, disambig): def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig) return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setObjectName(_fromUtf8("MainWindow"))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'creationParking.ui' # Form implementation generated from reading ui file 'creationParking.ui'
# #
# Created: Sat Jan 17 15:11:03 2015 # Created: Thu Feb 5 00:32:25 2015
# by: PyQt4 UI code generator 4.11.3 # by: PyQt4 UI code generator 4.11.3
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -39,20 +39,8 @@ class Ui_CreaParking(object):
self.btn_valider = QtGui.QPushButton(self.layoutWidget) self.btn_valider = QtGui.QPushButton(self.layoutWidget)
self.btn_valider.setObjectName(_fromUtf8("btn_valider")) self.btn_valider.setObjectName(_fromUtf8("btn_valider"))
self.horizontalLayout_2.addWidget(self.btn_valider) self.horizontalLayout_2.addWidget(self.btn_valider)
self.layoutWidget1 = QtGui.QWidget(CreaParking)
self.layoutWidget1.setGeometry(QtCore.QRect(200, 230, 275, 25))
self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout_3.setMargin(0)
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.label_4 = QtGui.QLabel(self.layoutWidget1)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.horizontalLayout_3.addWidget(self.label_4)
self.nbPlacesTotal = QtGui.QLabel(self.layoutWidget1)
self.nbPlacesTotal.setObjectName(_fromUtf8("nbPlacesTotal"))
self.horizontalLayout_3.addWidget(self.nbPlacesTotal)
self.tableWidget = QtGui.QTableWidget(CreaParking) self.tableWidget = QtGui.QTableWidget(CreaParking)
self.tableWidget.setGeometry(QtCore.QRect(30, 100, 521, 121)) self.tableWidget.setGeometry(QtCore.QRect(30, 100, 521, 141))
self.tableWidget.setObjectName(_fromUtf8("tableWidget")) self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
self.tableWidget.setColumnCount(5) self.tableWidget.setColumnCount(5)
self.tableWidget.setRowCount(0) self.tableWidget.setRowCount(0)
@ -72,21 +60,21 @@ class Ui_CreaParking(object):
self.btn_rmRow = QtGui.QPushButton(CreaParking) self.btn_rmRow = QtGui.QPushButton(CreaParking)
self.btn_rmRow.setGeometry(QtCore.QRect(570, 170, 41, 27)) self.btn_rmRow.setGeometry(QtCore.QRect(570, 170, 41, 27))
self.btn_rmRow.setObjectName(_fromUtf8("btn_rmRow")) self.btn_rmRow.setObjectName(_fromUtf8("btn_rmRow"))
self.layoutWidget2 = QtGui.QWidget(CreaParking) self.layoutWidget1 = QtGui.QWidget(CreaParking)
self.layoutWidget2.setGeometry(QtCore.QRect(180, 20, 291, 56)) self.layoutWidget1.setGeometry(QtCore.QRect(180, 20, 291, 56))
self.layoutWidget2.setObjectName(_fromUtf8("layoutWidget2")) self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget2) self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout.setMargin(0) self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.layoutWidget2) self.label = QtGui.QLabel(self.layoutWidget1)
self.label.setObjectName(_fromUtf8("label")) self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label) self.verticalLayout.addWidget(self.label)
self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.lineEdit_nom = QtGui.QLineEdit(self.layoutWidget2) self.lineEdit_nom = QtGui.QLineEdit(self.layoutWidget1)
self.lineEdit_nom.setObjectName(_fromUtf8("lineEdit_nom")) self.lineEdit_nom.setObjectName(_fromUtf8("lineEdit_nom"))
self.verticalLayout_2.addWidget(self.lineEdit_nom) self.verticalLayout_2.addWidget(self.lineEdit_nom)
self.horizontalLayout.addLayout(self.verticalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout_2)
@ -103,8 +91,6 @@ class Ui_CreaParking(object):
CreaParking.setWindowTitle(_translate("CreaParking", "Creation Parking", None)) CreaParking.setWindowTitle(_translate("CreaParking", "Creation Parking", None))
self.btn_annuler.setText(_translate("CreaParking", "Annuler", None)) self.btn_annuler.setText(_translate("CreaParking", "Annuler", None))
self.btn_valider.setText(_translate("CreaParking", "Valider", None)) self.btn_valider.setText(_translate("CreaParking", "Valider", None))
self.label_4.setText(_translate("CreaParking", "Nombre Places Total : ", None))
self.nbPlacesTotal.setText(_translate("CreaParking", "TextLabel", None))
item = self.tableWidget.horizontalHeaderItem(0) item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("CreaParking", "Hauteur (cm)", None)) item.setText(_translate("CreaParking", "Hauteur (cm)", None))
item = self.tableWidget.horizontalHeaderItem(1) item = self.tableWidget.horizontalHeaderItem(1)
@ -119,4 +105,3 @@ class Ui_CreaParking(object):
self.btn_rmRow.setText(_translate("CreaParking", "-", None)) self.btn_rmRow.setText(_translate("CreaParking", "-", None))
self.label.setText(_translate("CreaParking", "Nom :", None)) self.label.setText(_translate("CreaParking", "Nom :", None))

View File

@ -39,39 +39,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>200</x>
<y>230</y>
<width>275</width>
<height>25</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Nombre Places Total : </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nbPlacesTotal">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QTableWidget" name="tableWidget"> <widget class="QTableWidget" name="tableWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>100</y> <y>100</y>
<width>521</width> <width>521</width>
<height>121</height> <height>141</height>
</rect> </rect>
</property> </property>
<column> <column>