reformat
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
from PyQt4 import QtGui
|
||||
from src.c.SelectService import SelectService
|
||||
|
||||
from src.c.Teleporteur import Teleporteur
|
||||
from src.m.Placement import Placement
|
||||
from src.m.Parking import Placement
|
||||
from src.m.Client import Client
|
||||
from src.m.TypeAbonnement import TypeAbonnement
|
||||
from src.m.Service import Service
|
||||
from src.m.Client import TypeAbonnement
|
||||
from src.v.Camera import Camera
|
||||
from src.v.MyQWidget import MyQWidget
|
||||
from src.v.Ui_Borne import Ui_Borne
|
||||
@@ -39,7 +41,8 @@ class Borne:
|
||||
# Validator
|
||||
|
||||
|
||||
self.__ui.nomParking = parking.nom
|
||||
self.__ui.label_aff.setText("Dream park")
|
||||
self.__ui.nomParking.setText(parking.nom)
|
||||
self.nonVoiture()
|
||||
self.showWindow()
|
||||
|
||||
@@ -94,13 +97,15 @@ class Borne:
|
||||
TypeAbonnement.SUPER_ABONNE)
|
||||
self.__ui.label_aff.setText("Mise a jour de votre abonnement effectué")
|
||||
else:
|
||||
if self.__ui.checkBox.isEnabled():
|
||||
self.__c = Client(self.__ui.nomLineEdit,
|
||||
if self.__ui.checkBox.isChecked():
|
||||
self.__c = Client(None,
|
||||
self.__ui.nomLineEdit,
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
TypeAbonnement.SUPER_ABONNE)
|
||||
else:
|
||||
self.__c = Client(self.__ui.nomLineEdit,
|
||||
self.__c = Client(None,
|
||||
self.__ui.nomLineEdit,
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
TypeAbonnement.ABONNE)
|
||||
@@ -114,13 +119,26 @@ class Borne:
|
||||
:return:
|
||||
"""
|
||||
if self.__c is None:
|
||||
id = Teleporteur.teleporterVoiture(self.v_actuel, self.__parking.recherchePlace(self.v_actuel))
|
||||
self.__ui.label_aff.setText("Votre num ticket est : " + id)
|
||||
p = self.__parking.recherchePlace(self.v_actuel)
|
||||
if p is None :
|
||||
self.__ui.label_aff.setText("Aucun Place disponible")
|
||||
else :
|
||||
id = Teleporteur.teleporterVoiture(self.v_actuel, p)
|
||||
self.__ui.label_aff.setText("Votre num ticket est : " + str(id))
|
||||
self.nonVoiture()
|
||||
else:
|
||||
if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE:
|
||||
Teleporteur.teleporterVoiture(self.v_actuel, self.__parking.recherchePlace(self.v_actuel))
|
||||
p = self.__parking.recherchePlace(self.v_actuel)
|
||||
if p is None :
|
||||
self.__ui.label_aff.setText("Aucun Place disponible")
|
||||
else :
|
||||
id = Teleporteur.teleporterVoiture(self.v_actuel, self.__parking.recherchePlace(self.v_actuel))
|
||||
self.__w.hide()
|
||||
self.__child = SelectService(self.__main)
|
||||
self.__ui.label_aff.setText("Votre num ticket est : " + str(id))
|
||||
self.nonVoiture()
|
||||
else:
|
||||
Teleporteur.teleporterVoirureSuperAbonne(self.v_actuel)
|
||||
Teleporteur.teleporterVoitureSuperAbonne(self.v_actuel)
|
||||
|
||||
|
||||
def recuperer(self):
|
||||
@@ -128,12 +146,13 @@ class Borne:
|
||||
Essaie de recuperer une voiture avec le numero de ticket (lineedit)
|
||||
:return:
|
||||
"""
|
||||
p = Placement.get(self.__ui.numeroTicketLineEdit.text())
|
||||
if p is None:
|
||||
self.__ui.label_aff.setText("Mauvais numero de ticket")
|
||||
else:
|
||||
try :
|
||||
p = Placement.get(self.__ui.numeroTicketLineEdit.text())
|
||||
Teleporteur.teleporterVersSortie(p)
|
||||
self.__ui.label_aff.setText("Bonne journée")
|
||||
except IndexError:
|
||||
self.__ui.label_aff.setText("Mauvais numero de ticket")
|
||||
|
||||
|
||||
|
||||
def showWindow(self):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from src.m.Parking import Parking
|
||||
from src.m.ListeTypePlace import ListeTypePlace
|
||||
from src.m.Parking import Parking, TypePlace
|
||||
from src.v.MyQWidget import MyQWidget
|
||||
from src.v.Ui_CreaParking import Ui_CreaParking
|
||||
|
||||
@@ -13,7 +12,6 @@ class CreaParking:
|
||||
"""
|
||||
Controleur de cretion de parking
|
||||
"""
|
||||
|
||||
def __init__(self, main):
|
||||
self._main = main
|
||||
self._main.activity("Debut Creation Parking", self._main.lvl.INFO)
|
||||
@@ -76,14 +74,12 @@ class CreaParking:
|
||||
:return:
|
||||
"""
|
||||
# try:
|
||||
l = ListeTypePlace()
|
||||
l = []
|
||||
for i in range(0, self._ui.tableWidget.rowCount()):
|
||||
l.add(int(self._ui.tableWidget.item(i, 0).text()), int(self._ui.tableWidget.item(i, 1).text()),
|
||||
int(self._ui.tableWidget.item(i, 2).text()))
|
||||
self._main.addParking(Parking(
|
||||
l,
|
||||
self._ui.lineEdit_nom.text()))
|
||||
self._main.activity("Ajout Parking : detail", self._main.lvl.INFO)
|
||||
l.append(TypePlace(None,int(self._ui.tableWidget.item(i, 0).text()), int(self._ui.tableWidget.item(i, 1).text()),
|
||||
int(self._ui.tableWidget.item(i, 2).text())))
|
||||
p = Parking(self._ui.lineEdit_nom.text(),l)
|
||||
self._main.activity("Ajout:" + str(p), self._main.lvl.INFO)
|
||||
self._w.hide()
|
||||
self._main.showWindow()
|
||||
#except Exception as e:
|
||||
|
||||
@@ -7,6 +7,7 @@ from src.c.DetailsPlaces import DetailsPlaces
|
||||
from src.c.log.log import Log
|
||||
from src.c.log.log import lvl
|
||||
from src.c.CreaParking import CreaParking
|
||||
from src.m.Parking import Parking
|
||||
from src.v.MyQMainWindow import MyQMainWindow
|
||||
from src.v.Ui_MainWindow import Ui_MainWindow
|
||||
|
||||
@@ -19,9 +20,6 @@ class Main:
|
||||
self.lvl = lvl() # Public : Acces au constante
|
||||
self.__log = Log()
|
||||
|
||||
# Parking
|
||||
self.__parkings = []
|
||||
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
|
||||
self.__view = MyQMainWindow()
|
||||
@@ -68,7 +66,7 @@ class Main:
|
||||
def majListeParking(self):
|
||||
self.__ui.comboBox.clear()
|
||||
self.__ui.comboBox.addItem("Selectionner un parking")
|
||||
for p in self.__parkings:
|
||||
for p in Parking.getAll():
|
||||
self.__ui.comboBox.addItem(p.nom)
|
||||
|
||||
def selectParking(self):
|
||||
@@ -77,25 +75,19 @@ class Main:
|
||||
self.__ui.placesDispo.clear()
|
||||
self.__ui.placesSuperAbo.clear()
|
||||
if self.__ui.comboBox.count() > 1:
|
||||
print(self.__ui.comboBox.count())
|
||||
self.__ui.nom.setText(self.__parkings[self.__ui.comboBox.currentIndex() - 1].nom)
|
||||
self.__ui.placesParNiveau.setText(str(self.__parkings[self.__ui.comboBox.currentIndex() - 1].nbPlaces))
|
||||
p = Parking.getAll()
|
||||
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.placesDispo.setText(
|
||||
str(self.__parkings[self.__ui.comboBox.currentIndex() - 1].nbPlacesLibresParking))
|
||||
self.__ui.placesSuperAbo.setText("lol")
|
||||
str(p[self.__ui.comboBox.currentIndex() - 1].nbPlacesLibresParking))
|
||||
self.__ui.placesSuperAbo.setText(str(p[self.__ui.comboBox.currentIndex() - 1].nbSuperAbo))
|
||||
|
||||
|
||||
def creerParking(self):
|
||||
self.__view.hide()
|
||||
self.__widgetCourant = CreaParking(self)
|
||||
|
||||
def addParking(self, parking):
|
||||
self.__parkings.append(parking)
|
||||
|
||||
def modifParking(self):
|
||||
if self.__ui.comboBox.currentIndex() != 0:
|
||||
self.__view.hide()
|
||||
self.__widgetCourant = ModifParking(self, self.__parkings[self.__ui.comboBox.currentIndex() - 1])
|
||||
|
||||
def rmParking(self):
|
||||
if self.__ui.comboBox.currentIndex() != 0:
|
||||
@@ -113,12 +105,12 @@ class Main:
|
||||
def detailsPlacesParking(self):
|
||||
if self.__ui.comboBox.currentIndex() != 0:
|
||||
self.__view.hide()
|
||||
self.__widgetCourant = DetailsPlaces(self, self.__parkings[self.__ui.comboBox.currentIndex() - 1])
|
||||
self.__widgetCourant = DetailsPlaces(self, Parking.getAll()[self.__ui.comboBox.currentIndex() - 1])
|
||||
|
||||
def afficherBorne(self):
|
||||
if self.__ui.comboBox.currentIndex() != 0:
|
||||
self.__view.hide()
|
||||
self.__widgetCourant = Borne(self, self.__parkings[self.__ui.comboBox.currentIndex() - 1])
|
||||
self.__widgetCourant = Borne(self, Parking.getAll()[self.__ui.comboBox.currentIndex() - 1])
|
||||
|
||||
|
||||
def showWindow(self):
|
||||
|
||||
55
src/c/SelectService.py
Normal file
55
src/c/SelectService.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from PyQt4 import QtGui
|
||||
from src.v.MyQWidget import MyQWidget
|
||||
from src.v.Ui_Service import Ui_Service
|
||||
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class SelectService:
|
||||
"""
|
||||
Controleur de cretion de parking
|
||||
"""
|
||||
def __init__(self, main):
|
||||
self.__main = main
|
||||
self.__main.activity("Choix Service", self.__main.lvl.INFO)
|
||||
|
||||
self._w = MyQWidget(self.__main)
|
||||
self.__ui = Ui_Service()
|
||||
self.__ui.setupUi(self._w)
|
||||
|
||||
# connect
|
||||
self.__ui.btn_valider.clicked.connect(self.valider)
|
||||
|
||||
# Validator
|
||||
|
||||
|
||||
self.showWindow()
|
||||
|
||||
|
||||
def valider(self):
|
||||
"""
|
||||
Gestion validation de formulaire de choix de service
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
||||
def showWindow(self):
|
||||
"""
|
||||
Gestion affichage vue Creation de Parking
|
||||
:return:
|
||||
"""
|
||||
self._w.show()
|
||||
self.__child = None # supprime l'eventuel widget enfant
|
||||
self._w.focusWidget() # reprend le focus sur la fenetre
|
||||
|
||||
def error(self):
|
||||
"""
|
||||
Qdialog message erreur
|
||||
:return:
|
||||
"""
|
||||
QtGui.QMessageBox.warning(self._w,
|
||||
"Erreur ...",
|
||||
"Erreur lors du choix de service ...")
|
||||
self._w.hide()
|
||||
self.__main.showWindow()
|
||||
@@ -1,18 +1,18 @@
|
||||
from src.m.Placement import Placement
|
||||
from src.m.Parking import Placement
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class Teleporteur:
|
||||
@classmethod
|
||||
def teleporterVoiture(self, voiture, place):
|
||||
p = Placement(voiture, place)
|
||||
@staticmethod
|
||||
def teleporterVoiture(voiture, place):
|
||||
p = Placement(None,voiture, place,None,None)
|
||||
return p.id
|
||||
|
||||
@classmethod
|
||||
def teleporterVoitureSuperAbonne(self, voiture):
|
||||
@staticmethod
|
||||
def teleporterVoitureSuperAbonne(voiture):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def teleporterVersSortie(self, placement):
|
||||
@staticmethod
|
||||
def teleporterVersSortie(placement):
|
||||
placement.end()
|
||||
Reference in New Issue
Block a user