From 27f6d954eaddb03eb9645d480226002534408501 Mon Sep 17 00:00:00 2001 From: sidya82 Date: Fri, 26 Dec 2014 17:38:51 +0100 Subject: [PATCH] Implementation parking vue --- src/c/Acces.py | 7 +- src/c/CreaParking.py | 12 +++ src/c/Main.py | 34 ++++++- src/m/Parking.py | 1 + src/v/{Borne.py => Ui_Borne.py} | 0 src/v/Ui_CreaParking.py | 103 +++++++++++++++++++ src/v/{MainWindow.py => Ui_MainWindow.py} | 115 +++++++++------------- src/v/{Panneau.py => Ui_Panneau.py} | 0 8 files changed, 196 insertions(+), 76 deletions(-) create mode 100644 src/c/CreaParking.py rename src/v/{Borne.py => Ui_Borne.py} (100%) create mode 100644 src/v/Ui_CreaParking.py rename src/v/{MainWindow.py => Ui_MainWindow.py} (68%) rename src/v/{Panneau.py => Ui_Panneau.py} (100%) diff --git a/src/c/Acces.py b/src/c/Acces.py index 840e5b0..78be743 100644 --- a/src/c/Acces.py +++ b/src/c/Acces.py @@ -1,4 +1,4 @@ -from src.v import Panneau, Borne, Camera +from src.v import Ui_Panneau, Ui_Borne, Camera from src.c import Teleporteur from src.m import Parking, Place @@ -10,8 +10,8 @@ class Acces: def __init__(self): self.__parking = Parking() self.__camera = Camera() - self.__borne = Borne() - self.__panneau = Panneau() + self.__borne = Ui_Borne() + self.__panneau = Ui_Panneau() def actionnerCamera(self): return self.__camera.donnerVoiture() @@ -21,3 +21,4 @@ class Acces: def lancerProcedureEntree(self,client): self.__borne.afficher("Inserer votre carte ou valider") + diff --git a/src/c/CreaParking.py b/src/c/CreaParking.py new file mode 100644 index 0000000..bcfe77c --- /dev/null +++ b/src/c/CreaParking.py @@ -0,0 +1,12 @@ +from PyQt4 import QtGui +from src.v.Ui_CreaParking import Ui_CreaParking + +__author__ = 'sidya' + + +class CreaParking: + def __init__(self): + self.w = QtGui.QWidget() + self.ui = Ui_CreaParking() + self.ui.setupUi(self.w) + self.w.show() \ No newline at end of file diff --git a/src/c/Main.py b/src/c/Main.py index 35150c6..d177e9a 100644 --- a/src/c/Main.py +++ b/src/c/Main.py @@ -2,9 +2,10 @@ import sys from PyQt4 import QtGui -from src.v.MainWindow import Ui_MainWindow +from src.c.CreaParking import CreaParking from src.c.log.log import Log from src.m.Parking import Parking, ListeTypePlace +from src.v.Ui_MainWindow import Ui_MainWindow __author__ = 'sidya' @@ -30,6 +31,10 @@ class Main: self.ui = Ui_MainWindow() self.ui.setupUi(self.view) + #connect + self.ui.comboBox.currentIndexChanged['QString'].connect(self.selectParking) + self.ui.btn_creer.clicked.connect(self.creerParking) + #Chargement activité self.loadLastActivity() self.majListeParking() @@ -54,5 +59,30 @@ class Main: for l in [l[:-1] for l in liste[-11:-1]]: self.ui.addItemActivite(l) + + def addItemActivite(self, line): + self.log.addItem(line) + def majListeParking(self): - self.ui.majListeParkings(self.__parkings) + self.ui.comboBox.clear() + self.ui.comboBox.addItem("Selectionner un parking") + for p in self.__parkings: + self.ui.comboBox.addItem(p.nom) + + def selectParking(self): + self.ui.nom.clear() + self.ui.niveau.clear() + self.ui.placesParNiveau.clear() + self.ui.placesDispo.clear() + self.ui.placesSuperAbo.clear() + if(self.ui.comboBox.currentIndex() != 0) : + self.ui.nom.setText(self.__parkings[self.ui.comboBox.currentIndex()-1].nom) + self.ui.niveau.setText(str(self.__parkings[self.ui.comboBox.currentIndex()-1].nbNiveau)) + self.ui.placesParNiveau.setText(str(self.__parkings[self.ui.comboBox.currentIndex()-1].nbPlacesParNiveau)) + self.ui.placesDispo.setText(str(self.__parkings[self.ui.comboBox.currentIndex()-1].nbPlacesLibresParking)) + self.ui.placesSuperAbo.setText("lol") + + + def creerParking(self): + self.view.hide() + CreaParking() \ No newline at end of file diff --git a/src/m/Parking.py b/src/m/Parking.py index 02b2316..21c6931 100644 --- a/src/m/Parking.py +++ b/src/m/Parking.py @@ -8,6 +8,7 @@ class Parking: Definie un parking """ def __init__(self, nbNiv, typePlacesParNiv,nom): + self.typePlacesParNiv = typePlacesParNiv self.__nom = nom self.__nbPlacesParNiveau = typePlacesParNiv.nbPlaceTotal self.__prix = 10 diff --git a/src/v/Borne.py b/src/v/Ui_Borne.py similarity index 100% rename from src/v/Borne.py rename to src/v/Ui_Borne.py diff --git a/src/v/Ui_CreaParking.py b/src/v/Ui_CreaParking.py new file mode 100644 index 0000000..3322007 --- /dev/null +++ b/src/v/Ui_CreaParking.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'creationParking.ui' +# +# Created: Fri Dec 26 17:33:19 2014 +# by: PyQt4 UI code generator 4.11.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_CreaParking(object): + def setupUi(self, Form): + Form.setObjectName(_fromUtf8("Form")) + Form.resize(400, 300) + self.tableWidget = QtGui.QTableWidget(Form) + self.tableWidget.setGeometry(QtCore.QRect(30, 110, 331, 101)) + self.tableWidget.setObjectName(_fromUtf8("tableWidget")) + self.tableWidget.setColumnCount(0) + self.tableWidget.setRowCount(0) + self.layoutWidget = QtGui.QWidget(Form) + self.layoutWidget.setGeometry(QtCore.QRect(50, 10, 291, 89)) + self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) + self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) + self.horizontalLayout.setMargin(0) + self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.label = QtGui.QLabel(self.layoutWidget) + self.label.setObjectName(_fromUtf8("label")) + self.verticalLayout.addWidget(self.label) + self.label_2 = QtGui.QLabel(self.layoutWidget) + self.label_2.setObjectName(_fromUtf8("label_2")) + self.verticalLayout.addWidget(self.label_2) + self.label_3 = QtGui.QLabel(self.layoutWidget) + self.label_3.setObjectName(_fromUtf8("label_3")) + self.verticalLayout.addWidget(self.label_3) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) + self.lineEdit_nom = QtGui.QLineEdit(self.layoutWidget) + self.lineEdit_nom.setObjectName(_fromUtf8("lineEdit_nom")) + self.verticalLayout_2.addWidget(self.lineEdit_nom) + self.lineEdit_nbNiv = QtGui.QLineEdit(self.layoutWidget) + self.lineEdit_nbNiv.setObjectName(_fromUtf8("lineEdit_nbNiv")) + self.verticalLayout_2.addWidget(self.lineEdit_nbNiv) + self.btn_ajouterPlaces = QtGui.QPushButton(self.layoutWidget) + self.btn_ajouterPlaces.setObjectName(_fromUtf8("btn_ajouterPlaces")) + self.verticalLayout_2.addWidget(self.btn_ajouterPlaces) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.layoutWidget1 = QtGui.QWidget(Form) + self.layoutWidget1.setGeometry(QtCore.QRect(90, 270, 201, 29)) + self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.layoutWidget1) + self.horizontalLayout_2.setMargin(0) + self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) + self.pushButton_2 = QtGui.QPushButton(self.layoutWidget1) + self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) + self.horizontalLayout_2.addWidget(self.pushButton_2) + self.pushButton = QtGui.QPushButton(self.layoutWidget1) + self.pushButton.setObjectName(_fromUtf8("pushButton")) + self.horizontalLayout_2.addWidget(self.pushButton) + self.layoutWidget2 = QtGui.QWidget(Form) + self.layoutWidget2.setGeometry(QtCore.QRect(60, 230, 275, 25)) + self.layoutWidget2.setObjectName(_fromUtf8("layoutWidget2")) + self.horizontalLayout_3 = QtGui.QHBoxLayout(self.layoutWidget2) + self.horizontalLayout_3.setMargin(0) + self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) + self.label_4 = QtGui.QLabel(self.layoutWidget2) + self.label_4.setObjectName(_fromUtf8("label_4")) + self.horizontalLayout_3.addWidget(self.label_4) + self.nbPlacesTotal = QtGui.QLabel(self.layoutWidget2) + self.nbPlacesTotal.setObjectName(_fromUtf8("nbPlacesTotal")) + self.horizontalLayout_3.addWidget(self.nbPlacesTotal) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(_translate("Form", "Creation Parking", None)) + self.label.setText(_translate("Form", "Nom", None)) + self.label_2.setText(_translate("Form", "Nombre de niveaux :", None)) + self.label_3.setText(_translate("Form", "Places par niveau :", None)) + self.btn_ajouterPlaces.setText(_translate("Form", "Ajouter places", None)) + self.pushButton_2.setText(_translate("Form", "Annuler", None)) + self.pushButton.setText(_translate("Form", "Valider", None)) + self.label_4.setText(_translate("Form", "Nombre Places Total : ", None)) + self.nbPlacesTotal.setText(_translate("Form", "TextLabel", None)) + diff --git a/src/v/MainWindow.py b/src/v/Ui_MainWindow.py similarity index 68% rename from src/v/MainWindow.py rename to src/v/Ui_MainWindow.py index 4ce0f41..0f1b5e2 100644 --- a/src/v/MainWindow.py +++ b/src/v/Ui_MainWindow.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'main.ui' # -# Created: Tue Dec 23 22:14:01 2014 +# Created: Fri Dec 26 17:32:35 2014 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! @@ -65,40 +65,40 @@ class Ui_MainWindow(object): self.label_17 = QtGui.QLabel(self.tab_2) self.label_17.setObjectName(_fromUtf8("label_17")) self.formLayout_3.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_17) - self.label_2 = QtGui.QLabel(self.tab_2) - self.label_2.setObjectName(_fromUtf8("label_2")) - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.label_2) - self.label_3 = QtGui.QLabel(self.tab_2) - self.label_3.setObjectName(_fromUtf8("label_3")) - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.label_3) - self.label_4 = QtGui.QLabel(self.tab_2) - self.label_4.setObjectName(_fromUtf8("label_4")) - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.label_4) - self.label_5 = QtGui.QLabel(self.tab_2) - self.label_5.setObjectName(_fromUtf8("label_5")) - self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.label_5) - self.label_6 = QtGui.QLabel(self.tab_2) - self.label_6.setObjectName(_fromUtf8("label_6")) - self.formLayout_3.setWidget(4, QtGui.QFormLayout.FieldRole, self.label_6) + self.nom = QtGui.QLabel(self.tab_2) + self.nom.setObjectName(_fromUtf8("nom")) + self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.nom) + self.niveau = QtGui.QLabel(self.tab_2) + self.niveau.setObjectName(_fromUtf8("niveau")) + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.niveau) + self.placesParNiveau = QtGui.QLabel(self.tab_2) + self.placesParNiveau.setObjectName(_fromUtf8("placesParNiveau")) + self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.placesParNiveau) + self.placesDispo = QtGui.QLabel(self.tab_2) + self.placesDispo.setObjectName(_fromUtf8("placesDispo")) + self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.placesDispo) + self.placesSuperAbo = QtGui.QLabel(self.tab_2) + self.placesSuperAbo.setObjectName(_fromUtf8("placesSuperAbo")) + self.formLayout_3.setWidget(4, QtGui.QFormLayout.FieldRole, self.placesSuperAbo) self.verticalLayout.addLayout(self.formLayout_3) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.pushButton_4 = QtGui.QPushButton(self.tab_2) - self.pushButton_4.setObjectName(_fromUtf8("pushButton_4")) - self.horizontalLayout.addWidget(self.pushButton_4) - self.pushButton_3 = QtGui.QPushButton(self.tab_2) - self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) - self.horizontalLayout.addWidget(self.pushButton_3) + self.btn_details = QtGui.QPushButton(self.tab_2) + self.btn_details.setObjectName(_fromUtf8("btn_details")) + self.horizontalLayout.addWidget(self.btn_details) + self.btn_borne = QtGui.QPushButton(self.tab_2) + self.btn_borne.setObjectName(_fromUtf8("btn_borne")) + self.horizontalLayout.addWidget(self.btn_borne) self.verticalLayout.addLayout(self.horizontalLayout) - self.pushButton_5 = QtGui.QPushButton(self.tab_2) - self.pushButton_5.setObjectName(_fromUtf8("pushButton_5")) - self.verticalLayout.addWidget(self.pushButton_5) - self.pushButton_2 = QtGui.QPushButton(self.tab_2) - self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) - self.verticalLayout.addWidget(self.pushButton_2) - self.pushButton = QtGui.QPushButton(self.tab_2) - self.pushButton.setObjectName(_fromUtf8("pushButton")) - self.verticalLayout.addWidget(self.pushButton) + self.btn_creer = QtGui.QPushButton(self.tab_2) + self.btn_creer.setObjectName(_fromUtf8("btn_creer")) + self.verticalLayout.addWidget(self.btn_creer) + self.btn_modifier = QtGui.QPushButton(self.tab_2) + self.btn_modifier.setObjectName(_fromUtf8("btn_modifier")) + self.verticalLayout.addWidget(self.btn_modifier) + self.btn_supprimer = QtGui.QPushButton(self.tab_2) + self.btn_supprimer.setObjectName(_fromUtf8("btn_supprimer")) + self.verticalLayout.addWidget(self.btn_supprimer) self.tabWidget.addTab(self.tab_2, _fromUtf8("")) self.tab_5 = QtGui.QWidget() self.tab_5.setObjectName(_fromUtf8("tab_5")) @@ -159,19 +159,19 @@ class Ui_MainWindow(object): self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Activite", None)) self.label_13.setText(_translate("MainWindow", "Nom :", None)) self.label_14.setText(_translate("MainWindow", "Niveau :", None)) - self.label_15.setText(_translate("MainWindow", "Place / niveau :", None)) - self.label_16.setText(_translate("MainWindow", "Place disponible :", None)) - self.label_17.setText(_translate("MainWindow", "Place Reserve Super Abo : ", None)) - self.label_2.setText(_translate("MainWindow", "TextLabel", None)) - self.label_3.setText(_translate("MainWindow", "TextLabel", None)) - self.label_4.setText(_translate("MainWindow", "TextLabel", None)) - self.label_5.setText(_translate("MainWindow", "TextLabel", None)) - self.label_6.setText(_translate("MainWindow", "TextLabel", None)) - self.pushButton_4.setText(_translate("MainWindow", "Details Places", None)) - self.pushButton_3.setText(_translate("MainWindow", "Borne", None)) - self.pushButton_5.setText(_translate("MainWindow", "Créer", None)) - self.pushButton_2.setText(_translate("MainWindow", "Modifier", None)) - self.pushButton.setText(_translate("MainWindow", "Supprimer", None)) + self.label_15.setText(_translate("MainWindow", "Places / niveau :", None)) + self.label_16.setText(_translate("MainWindow", "Places disponible :", None)) + self.label_17.setText(_translate("MainWindow", "Places Reserve Super Abo : ", None)) + self.nom.setText(_translate("MainWindow", "TextLabel", None)) + self.niveau.setText(_translate("MainWindow", "TextLabel", None)) + self.placesParNiveau.setText(_translate("MainWindow", "TextLabel", None)) + self.placesDispo.setText(_translate("MainWindow", "TextLabel", None)) + self.placesSuperAbo.setText(_translate("MainWindow", "TextLabel", None)) + self.btn_details.setText(_translate("MainWindow", "Details Places", None)) + self.btn_borne.setText(_translate("MainWindow", "Borne", None)) + self.btn_creer.setText(_translate("MainWindow", "Créer", None)) + self.btn_modifier.setText(_translate("MainWindow", "Modifier", None)) + self.btn_supprimer.setText(_translate("MainWindow", "Supprimer", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Parkings", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("MainWindow", "Membres", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "Services", None)) @@ -187,30 +187,3 @@ class Ui_MainWindow(object): self.actionQuitter.setText(_translate("MainWindow", "Quitter", None)) self.action.setText(_translate("MainWindow", "?", None)) - - - - ################################NOT GENERATED#################################################### - def addItemActivite(self, line): - self.log.addItem(line) - - def majListeParkings(self, parkings): - self.__parkings = parkings - self.comboBox.currentIndexChanged['QString'].connect(self.selectParking) - self.comboBox.clear() - self.comboBox.addItem("Selectionner un parking") - for p in parkings: - self.comboBox.addItem(p.nom) - - def selectParking(self): - self.label_2.clear() - self.label_3.clear() - self.label_4.clear() - self.label_5.clear() - self.label_6.clear() - if(self.comboBox.currentIndex() != 0) : - self.label_2.setText(self.__parkings[self.comboBox.currentIndex()-1].nom) - self.label_3.setText(str(self.__parkings[self.comboBox.currentIndex()-1].nbNiveau)) - self.label_4.setText(str(self.__parkings[self.comboBox.currentIndex()-1].nbPlacesParNiveau)) - self.label_5.setText(str(self.__parkings[self.comboBox.currentIndex()-1].nbPlacesLibresParking)) - self.label_6.setText("lol") diff --git a/src/v/Panneau.py b/src/v/Ui_Panneau.py similarity index 100% rename from src/v/Panneau.py rename to src/v/Ui_Panneau.py