working version that was presented

This commit is contained in:
= 2020-06-15 17:43:52 +02:00
parent a7d3f0b356
commit 21021ea59a
2 changed files with 26 additions and 18 deletions

View File

@ -106,4 +106,4 @@ while running:
if not kitchenManager.is_running():
gridBoard.reinitialize()
gridBoard.draw(drawableManager)
gridBoard.udpdate()
gridBoard.udpdate()

View File

@ -84,23 +84,19 @@ class Table(Drawable):
# self.__tableLock.release()
# return order
# def get_order(self):
# return self.__order
def get_order(self):
order = None
if self.__tableLock.acquire(False):
try:
if self.isStatus(Status.Ready) and self.hasOrder():
# Generates order
order = []
for a in range(0, len(self.__guests)):
order.append(Tree_Builder.zgadnij(self.__zainteresowania[a], self.Decision_Tree))
print("Zamowienie: " + str(order))
self.setOrder([])
finally:
self.__tableLock.release()
return order
return self.__order
# def getOrder(self):
# order = None
# if self.__tableLock.acquire(False):
# try:
# if self.isStatus(Status.Ready) and self.hasOrder():
# order = self.__order
# self.setOrder([])
# finally:
# self.__tableLock.release()
# return order
def setOrder(self, order):
self.__order = order
@ -115,7 +111,7 @@ class Table(Drawable):
self.__status = status
def __getImage(self, imageKind):
if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate]:
if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate, Images.Chicken]:
size = int(self.getCellSize() / 3)
else:
size = int(1.4 * self.getCellSize())
@ -168,3 +164,15 @@ class Table(Drawable):
screen.blit(imagePlate, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest3XOffset, yBase + platesYOffset))
elif self.isStatus(Status.Served):
platesYOffset = int(0.3 * self.getCellSize())
imageChicken = self.__getImage(Images.Chicken)
if len(self.__guests) == 1:
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
elif len(self.__guests) == 2:
screen.blit(imageChicken, (xBase + guest4XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest5XOffset, yBase + platesYOffset))
elif len(self.__guests) == 3:
screen.blit(imageChicken, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest3XOffset, yBase + platesYOffset))