clothing module
AIU - holds all clothing module processesAnonymous
python
03/30/2025 4:50 AM
16.2 KB
14
Indexable
import main_messages
from rich.console import Console
from rich.table import Table
console = Console()
# ----------------------------------------------------------------------------------------------------------------------------------#
def mens_shirt_US_to_EU(US_EU):
return US_EU + 10
def womens_dress_US_to_UK(US_UK):
return US_UK + 4
def pants_inches_to_CM(inch_CM):
return inch_CM * 2.54
def shoe_US_to_Japan(US_JP):
return (US_JP + 16.5) * 1.5
# ----------------------------------------------------------------------------------------------------------------------------------#
def clothing_conversion_menu():
main_messages.separator()
table = Table(title="", show_lines=True)
table.add_column("👚 Clothing Size Conversion", justify="left", style="cyan", no_wrap=True)
table.add_row("[1] Adult Men's US ➡️ Men's EU")
table.add_row("[2] Adult Women's US ➡️ Women's UK")
table.add_row("[3] Adult Pants Inches ➡️ CM")
table.add_row("[4] Adult Shoes US ➡️ Japan")
table.add_row("[red][5] 🚪 Return to Main Menu[/red]")
console.print(table)
# ----------------------------------------------------------------------------------------------------------------------------------#
def clothing_conversion_confirm():
table = Table(title="", show_lines=True)
table.add_column("ℹ️ Would you like to make another computation?", justify="left", style="cyan", no_wrap=True)
table.add_row("[1] ✅ [green]Yes[/green]")
table.add_row("[2] 🚪 [red]Return to Menu[/red]")
console.print(table)
# ----------------------------------------------------------------------------------------------------------------------------------#
def cloth_3_select():
try:
console.print("[green]\n➡️ Enter your selection[/green] [[blue]1[/blue] - [blue]5[/blue]]:")
clothing_select = int(input("-- "))
except ValueError:
console.print("[red]\n❌ Invalid Entry[/red]. Enter a number between 1 and 5!")
return
if clothing_select < 1 or clothing_select > 5:
console.print("[red]\n❌ Out of Range[/red]. Enter a number between 1 and 5!")
return
if clothing_select == 5:
console.print("\n[yellow]🚪 Returning to Main Menu...[/yellow]")
main_messages.separator()
return "BACK_MAIN"
# ----------------------------------------------------------------------------------------------------------------------------------#
if clothing_select == 1:
while True:
try:
main_messages.separator()
US_EU = float(console.input("[green]➡️ Enter your US Men Clothing[/green]\n-- "))
if US_EU == 0:
console.print("\n❌ 0 US is still 0 in EU!")
continue
if US_EU < 0:
console.print("\n❌ Your entry cannot be negative! Enter a valid value!")
continue
if US_EU < 14:
console.print("\n❌ 14 is the smallest shirt size in Men's US! Enter a valid value!")
continue
main_messages.separator()
console.print(f"\n✅ {US_EU} in US Men is {mens_shirt_US_to_EU(US_EU):.2f} in EU Men Size")
main_messages.separator()
except ValueError:
console.print("\n[red]\n❌ Invalid Entry[/red]. Enter a valid number.\n")
continue
while True:
clothing_conversion_confirm()
main_messages.separator()
try:
return_menu = int(input("\n-- "))
if return_menu < 1 or return_menu > 2:
console.print("\n[red]❌ Out of Range[/red]. Please enter [1 or 2].")
main_messages.separator()
elif return_menu == 1:
break
elif return_menu == 2:
console.print("\n[yellow]🚪 Returning to Clothing Menu... [/yellow]")
return
except ValueError:
console.print("\n[red]❌ Invalid Entry[/red]. Enter a valid number.")
main_messages.separator()
# ----------------------------------------------------------------------------------------------------------------------------------#
elif clothing_select == 2:
while True:
try:
main_messages.separator()
US_UK = float(console.input("[green]➡️ Enter your US Women Sized Clothing[/green]\n-- "))
if US_UK == 0:
console.print("\n❌ 0 US is still 0 in UK!")
continue
if US_UK < 0:
console.print("\n❌ Your entry cannot be negative! Enter a valid value!")
continue
if US_UK < 8:
console.print("\n❌ 8 is the smallest size in Women's US! Enter a valid value!")
continue
main_messages.separator()
console.print(f"\n✅ {US_UK} in US Women is {womens_dress_US_to_UK(US_UK):.2f} in UK Women Size")
main_messages.separator()
except ValueError:
console.print("\n[red]\n❌ Invalid Entry[/red]. Enter a valid number.\n")
continue
while True:
clothing_conversion_confirm()
main_messages.separator()
try:
return_menu = int(input("\n-- "))
if return_menu < 1 or return_menu > 2:
console.print("\n[red]❌ Out of Range[/red]. Please enter [1 or 2].")
main_messages.separator()
elif return_menu == 1:
break
elif return_menu == 2:
console.print("\n[yellow]🚪 Returning to Clothing Menu... [/yellow]")
return
except ValueError:
console.print("\n[red]❌ Invalid Entry[/red]. Enter a valid number.")
main_messages.separator()
# ----------------------------------------------------------------------------------------------------------------------------------#
elif clothing_select == 3:
while True:
try:
main_messages.separator()
inch_CM = float(console.input("[green]➡️ Enter your pants in inches[/green]\n-- "))
if inch_CM == 0:
console.print("\n❌ 0 inch is not possible! Please enter a valid value")
continue
if inch_CM < 0:
console.print("\n❌ Your entry cannot be negative! Enter a valid value!")
continue
if inch_CM < 26:
console.print("\n❌ 26 is the smallest pants size for Adults! Enter a valid value!")
continue
# Checks for "s" if amount is greater than 1
main_messages.separator()
if inch_CM > 1:
console.print(f"\n✅ A size of a {inch_CM} inches pants is {pants_inches_to_CM(inch_CM):.2f} in Centimeters")
elif inch_CM == 1:
console.print(f"\n✅ A size of a {inch_CM} inch pants is {pants_inches_to_CM(inch_CM):.2f} in Centimeters")
main_messages.separator()
except ValueError:
console.print("[red]\n❌ Invalid Entry[/red]. Enter a valid number.\n")
continue
while True:
clothing_conversion_confirm()
main_messages.separator()
try:
return_menu = int(input("\n-- "))
if return_menu < 1 or return_menu > 2:
console.print("\n[red]❌ Out of Range[/red]. Please enter [1 or 2].")
main_messages.separator()
elif return_menu == 1:
break
elif return_menu == 2:
console.print("\n[yellow]🚪 Returning to Clothing Menu... [/yellow]")
return
except ValueError:
console.print("\n[red]❌ Invalid Entry[/red]. Enter a valid number.")
main_messages.separator()
# ----------------------------------------------------------------------------------------------------------------------------------#
elif clothing_select == 4:
while True:
try:
main_messages.separator()
US_JP = float(console.input("[green]➡️ Enter your US Sized Shoes[/green]\n-- "))
if US_JP == 0:
console.print("\n❌ 0 US is still 0 in JP!")
continue
if US_JP < 0:
console.print("\n❌ Your entry cannot be negative! Enter a valid value!")
continue
if US_JP < 4:
console.print("\n❌ 4 is the smallest size for both Men and Women Shoes in US Size! Enter a valid value!")
continue
main_messages.separator()
console.print(f"\n✅ {US_JP} in US shoe size is {shoe_US_to_Japan(US_JP):.2f} in Japanese shoe size")
main_messages.separator()
except ValueError:
console.print("[red]\n❌ Invalid Entry[/red]. Enter a valid number.\n")
continue
while True:
clothing_conversion_confirm()
main_messages.separator()
try:
return_menu = int(input("\n-- "))
if return_menu < 1 or return_menu > 2:
console.print("\n[red]❌ Out of Range[/red]. Please enter [1 or 2].")
main_messages.separator()
elif return_menu == 1:
break
elif return_menu == 2:
console.print("\n[yellow]🚪 Returning to Clothing Menu... [/yellow]")
return
except ValueError:
console.print("\n[red]❌ Invalid Entry[/red]. Enter a valid number.")
main_messages.separator()
# ----------------------------------------------------------------------------------------------------------------------------------#
Editor is loading...
Leave a Comment