def EnterQuantityHeightWidth(windowName):
    while True:
        try:
            height = input("Height of {}(x'-y\"): ".format(windowName))
            height = imp2dec(height)

            width = input("Width of {}(x'-y\"): ".format(windowName))
            width = imp2dec(width)

            quantity = int(input("Quantity of {}: ".format(windowName)))

        except ValueError:
            print("\n\t\t\t*****PLEASE ENTER A VALID VALUE*****\n")
            continue

        else:
            return quantity, height, width
def EnterLength(component, i):
    while True:
        try:
            length = input("Length of {}{}(x'-y\"): ".format(component, i + 1))
            length = imp2dec(length)
        except ValueError:
            print("\n\t\t\t*****PLEASE ENTER A VALID VALUE*****\n")
            continue
        else:
            return length
    def EditComponentAttributeLength(self, windowEdit, component_edit):

        # Create a query to specify the component and edit it's length
        query = "UPDATE " + self.projectName + " SET Length = ? WHERE Components = ? AND Name = ?"

        componentNewLength = input("New length: ")

        self.cursor.execute(
            query, (imp2dec(componentNewLength), component_edit, windowEdit))
        self.connection.commit()

        print("\n\t\t\t\t\t\t***COMPONENT LENGTH UPDATED SUCCESSFULLY: {}***".
              format(componentNewLength))
    def EditWindowAttribute(self, windowEdit):
        while True:
            # Choose a valid event that given in the menu
            MenuEditWindowAttribute()
            option = input()

            # Rename window
            if option == "1":
                query = "UPDATE " + self.projectName + " SET Name = ? WHERE Name = ?"

                windowEditNewName = input("\n\t\t\tNew name: ")

                windowEditNewName = windowEditNewName.upper()

                self.cursor.execute(query, (windowEditNewName, windowEdit))
                self.connection.commit()

                print("\n\t\t\t***NAME UPDATED SUCCESSFULLY: {}***".format(
                    windowEditNewName))

            # Edit window quantity
            elif option == "2":
                query = "UPDATE " + self.projectName + " SET WindowQuantity = ? WHERE Name = ?"

                windowEditNewQuantity = int(input("\n\t\t\tNew quantity: "))

                self.cursor.execute(query, (windowEditNewQuantity, windowEdit))
                self.connection.commit()

                print("\n\t\t\t***QUANTITY UPDATED SUCCESSFULLY: {}***".format(
                    windowEditNewQuantity))

            # Edit window height
            elif option == "3":
                query = "UPDATE " + self.projectName + " SET WindowHeight = ? WHERE Name = ?"

                windowEditNewHeight = input("\n\t\t\tNew height: ")

                self.cursor.execute(query,
                                    (imp2dec(windowEditNewHeight), windowEdit))
                self.connection.commit()

                print("\n\t\t\t***HEIGHT UPDATED SUCCESSFULLY: {}***".format(
                    windowEditNewHeight))

            # Edit window width
            elif option == "4":
                query = "UPDATE " + self.projectName + " SET WindowWidth = ? WHERE Name = ?"

                windowEditNewWidth = input("\n\t\t\tNew width: ")

                self.cursor.execute(query,
                                    (imp2dec(windowEditNewWidth), windowEdit))
                self.connection.commit()

                print("\n\t\t\t***WIDTH UPDATED SUCCESSFULLY: {}***".format(
                    windowEditNewWidth))

            # Back
            elif option == "0":
                break

            # Invalid option
            else:
                print("\n\t\t\t*****PLEASE ENTER A VALID OPTION*****\n")
                continue