couleur
This commit is contained in:
parent
de9183f019
commit
cd97900b30
17
cave.py
17
cave.py
@ -1,9 +1,11 @@
|
||||
|
||||
import pickle
|
||||
|
||||
class Etageres(object):
|
||||
def __init__(self):
|
||||
self.etageres = []
|
||||
self.nbetagere = 0
|
||||
self.couleur = ["rouge","blanc","rose"]
|
||||
|
||||
@classmethod
|
||||
def load_etageres(cls,file):
|
||||
@ -37,8 +39,8 @@ class Etageres(object):
|
||||
self.nbetagere -= 1
|
||||
|
||||
return "etagere {} suprimer".format(etagere.num_etagere)
|
||||
def save_etageres(self):
|
||||
with open('company_data.pkl', 'wb') as output:
|
||||
def save_etageres(self,file):
|
||||
with open(file, 'wb') as output:
|
||||
pickle.dump(self,output)
|
||||
|
||||
def __iter__(self):
|
||||
@ -85,7 +87,12 @@ class Bouteille(object):
|
||||
def __init__(self, pos_largeur, pos_hauteur, couleur, appelation, millesime, etagere):
|
||||
self.pos_largeur = pos_largeur
|
||||
self.pos_hauteur = pos_hauteur
|
||||
if (couleur not in etagere.etageres.couleur):
|
||||
etagere.etageres.couleur.append(couleur)
|
||||
|
||||
|
||||
self.couleur = couleur
|
||||
|
||||
self.millesime = millesime
|
||||
self.appelation = appelation
|
||||
self.etagere = etagere
|
||||
@ -97,13 +104,13 @@ class Bouteille(object):
|
||||
new = Etageres()
|
||||
new.add_etagere(30, 3)
|
||||
print(new.etageres[0].add_bouteille(28, 2, "rouge", "saint emilion", 2005))
|
||||
print(new.etageres[0].add_bouteille(24, 1, "blanc", "gewurtz", 2010))
|
||||
print(new.etageres[0].add_bouteille(24, 1, "pisse", "gewurtz", 2010))
|
||||
print(new.etageres[0].add_bouteille(23, 2, "rouge", "saint emilion", 2006))
|
||||
print(new.etageres[0].bouteilles)
|
||||
print("vos etagére contiennes {} bouteille".format(new.nbbouteille()))
|
||||
print("vos etagére contiennes {} bouteille de rouge".format(
|
||||
new.nbbouteillecouleur("rouge")))
|
||||
new.save_etageres()
|
||||
new.save_etageres("test.pkl")
|
||||
print(new.couleur)
|
||||
print(new.remove_etagere(new.etageres[0]))
|
||||
del new
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user