Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String grouping #21

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/MaterialManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,38 @@ def __init__(self, params: list):
self.params = params
# other configurations

def changeMaterial(self, material) -> bool:
def changeMaterial(self, material) -> bool:
returnText = ""
textBaseForValidMaterial = "Material is changed to"

match material:
case materialType.Titanium:
self.carManager.setMaterial(materialType.Titanium)
returnText = "Material is changed to Titanium."
returnText = f"{textBaseForValidMaterial} Titanium."

case materialType.Carbon:
self.carManager.setMaterial(materialType.Carbon)
returnText = "Material is changed to Carbon."
returnText = f"{textBaseForValidMaterial} Carbon."

case materialType.AlloyX:
self.carManager.setMaterial(materialType.AlloyX)
returnText = f"{textBaseForValidMaterial} AlloyX."

case _:
returnText = "Material seletion is invalid."
returnText = "Material selection is invalid."

return self._announceMaterial(returnText)




def _announceMaterial(self, text: str) -> bool:
return self.announcer(text)
returnValue = False
try:
returnValue = self.announcer(text)
except:
print("Announcement of material type is failed.")
returnValue = False
finally:
return returnValue

2 changes: 1 addition & 1 deletion src/Util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from enum import Enum

materialType = Enum('Titanium', 'Carbon')
materialType = Enum('Titanium', 'Carbon', 'AlloyX')