Exemplo n.º 1
0
def add_status(current_status_message):
    # update status message.
    if current_status_message != None:
        print 'Your current status messsge is ' + current_status_message + "\n"
    else:
        print " you don't have status message currently \n "
        default = raw_input(" do you want to select from the older message (y/n)? ")

        if default.upper() == 'N':
            new_status_message = raw_input(" what status message do you want to set?")

            # validating users input.
            if len(new_status_message) > 0:
                update_status_message = new_status_message
                STATUS_MESSAGES.append(update_status_message)
            elif default.upper() == 'Y':
                item_position = 1
                for message in STATUS_MESSAGES:
                    print item_position + "." + message
                    item_position = item_position + 1
                    message_selection = int(raw_input("\n choose from the above messages "))
                    if len(STATUS_MESSAGES) >= message_selection:
                        updated_status_message = STATUS_MESSAGES[message_selection - 1]
                        return updated_status_message
                    current_status_message = add_status(current_status_message)
Exemplo n.º 2
0
def add_status():
    # in the beginning no status message
    updated_status_message = None

    # check if current status message is set or not
    if spy.current_status_message is not None:
        print 'Your current status message is %s \n' % spy.current_status_message
    else:
        print 'You don\'t have any status message currently \n'

    # Asking if the user wants to select a default status or a status which is already present
    default = raw_input(colored("Do you want to select from the older status (y/n)? ", "magenta"))

    # A spy wants to add another status rather from the existing one
    # .upper() converts from any case to upper case
    if default.upper() == "N":
        # ask the user to enter a new status
        new_status_message = raw_input(colored("What status message do you want to see?: ", "magenta"))

        # if valid status message is entered
        if len(new_status_message) > 0:
            # in the existing status list add the new status
            STATUS_MESSAGES.append(new_status_message)
            # variable update
            updated_status_message = new_status_message

    # A spy wants to choose from the existing status
    elif default.upper() == 'Y':

        # To give an index number to the statuses
        item_position = 1

        # To show all the default statuses so that the user can select
        for message in STATUS_MESSAGES:
            print '%d. %s' % (item_position, message)
            item_position = item_position + 1

        # Ask the user which index of the list he wants to choose.
        message_selection = int(raw_input(colored("\nChoose the index of the status: ", "magenta")))

        # Check if the position exists and then only set it
        if len(STATUS_MESSAGES) >= message_selection:
            # Variable update
            updated_status_message = STATUS_MESSAGES[message_selection - 1]

    # When the user chooses neither yes nor no
    else:
        print 'The option you chose is not valid! Press either y or n.'

    # When the status message is updated
    if updated_status_message:
        print 'Your updated status message is:',
        print(colored(updated_status_message, "yellow"))

    # When it is not updated
    else:
        print(colored('You did not update your status message','magenta'))

    # The updated message will be read
    return updated_status_message
Exemplo n.º 3
0
def add_status(current_status_message):
    if current_status_message != None:
        print "your current status message is " + current_status_message + "\n"
    else:
        print "you don't have any status message currently \n"
    default = raw_input("Do you want to select from older messages y/n")
    if default.upper() == "N":
        new_status_message = raw_input("what status message do you want")

        if len(new_status_message) > 0:
            update_status_message = new_status_message
            STATUS_MESSAGES.append(update_status_message)
            print 'your updated status message is : %s' % (
                update_status_message)
        else:
            print 'you did not provided any status..'
    elif default.upper() == "Y":
        item_position = 1
        for message in STATUS_MESSAGES:
            print str(item_position) + ". " + message
            item_position = item_position + 1
        #asking users choice.
        message_selection = int(input("\n Choose from the "))

        #validating user input
        if len(STATUS_MESSAGES) >= message_selection:
            update_status_message = STATUS_MESSAGES(message_selection)
            print "Your updated status message is : %s" % ()
        else:
            print "Invalid choice"
    else:
        print "The option you chose is not valid.."

    return update_status_message
Exemplo n.º 4
0
def add_status(current_status_message):

    # status in beginning
    updated_status_message = None

    # check if current status is set or not
    if current_status_message != None:
        print 'Your current status message is %s \n' % (current_status_message)
    else:
        print 'You don\'t have any status message currently \n'

    # Ask user for choose default status or an old status.
    default = raw_input(colored("Do you want to select from the older status (y/n)? ",'cyan'))

    # when spy wants to add another status rather than existing one
    # .upper() converts everything to uppercase
    if default.upper() == "N":
        new_status_message = raw_input(colored("What status message do you want to set?: ",'cyan'))

        # validating users input.
        if len(new_status_message) > 0:
            # adding new status to default status or older status list.
            STATUS_MESSAGES.append(new_status_message)
            #updated status
            updated_status_message = new_status_message
            print 'Your updated status message is: %s' % (updated_status_message)
        else:
            print "You did not provided any status message. Try again."

    # spy wants to choose from existing status.
    elif default.upper() == 'Y':

        # counter for serial number of messages.
        item_position = 1

        # printing all older status messages so spy can choose
        for message in STATUS_MESSAGES:
            print '%d. %s' % (item_position, message)
            item_position = item_position + 1

        # asking users choice which index of list he wants to choose
        message_selection = int(raw_input(colored("\nChoose from the Index of status: ",'cyan')))

        # validating users input and set status of choice if exist.
        if len(STATUS_MESSAGES) >= message_selection:
            #updating
            updated_status_message = STATUS_MESSAGES[message_selection - 1]
            print 'Your updated status message is: %s' % (updated_status_message)
        # when user has wrong choice or choice that does not exist.
        else:
            print "Invalid choice. Try again."
    # when user has diffrent choice than yes and no
    else:
        print 'The option you chose is not valid! Press either y or n.'
    # updated message will be read
    return updated_status_message
Exemplo n.º 5
0
def add_status(current_status_message):
    if current_status_message != None:
        cprint(
            'Your current status message is %s \n' % (current_status_message),
            'yellow')
    else:
        cprint('You don\'t have any status message currently \n', 'magenta')

    # Ask user for choosing from older older messages.
    default = raw_input("Do you want to select from the older status (y/n)? ")

    if default.upper() == "N":
        new_status_message = raw_input(
            "What status message do you want to set?:\n")

        # validating users input.
        if len(new_status_message) > 0:
            # adding new status message to the list.
            STATUS_MESSAGES.append(new_status_message)
            updated_status_message = new_status_message
            cprint(
                'Your updated status message is: %s' %
                (updated_status_message), 'yellow')
        else:
            cprint("You did not provided any status message. Try again.",
                   'magenta')
    elif default.upper() == 'Y':
        # counter for serial number of messages.
        item_position = 1

        # printing all older status messages.
        for message in STATUS_MESSAGES:
            print '%d. %s' % (item_position, message)
            item_position = item_position + 1

        # asking users choice.
        message_selection = int(
            raw_input("\nChoose from the above messages \n"))

        # validating users input.
        if len(STATUS_MESSAGES) >= message_selection:
            updated_status_message = STATUS_MESSAGES[message_selection - 1]
            cprint(
                'Your updated status message is: %s' %
                (updated_status_message), 'yellow')
        else:
            cprint("Invalid choice. Try again.", 'magenta')
    else:
        cprint('The option you chose is not valid! Press either y or n.',
               'magenta')

    return updated_status_message
Exemplo n.º 6
0
def add_status(current_status_message):

    updated_status_message = None

    if current_status_message != None:
        print 'Your current status message is %s \n' % (current_status_message)
    else:
        print 'You don\'t have any status message currently \n'

    default = raw_input(
        colored("Do you want to select from the older status (y/n)? ", 'cyan'))

    if default.upper() == "N":
        new_status_message = raw_input(
            colored("What status message do you want to set?: ", 'cyan'))

        if len(new_status_message) > 0:

            STATUS_MESSAGES.append(new_status_message)

            updated_status_message = new_status_message
            print 'Your updated status message is: %s' % (
                updated_status_message)
        else:
            print "You did not provided any status message. Try again."

    elif default.upper() == 'Y':

        item_position = 1

        for message in STATUS_MESSAGES:
            print '%d. %s' % (item_position, message)
            item_position = item_position + 1

        message_selection = int(
            raw_input(colored("\nChoose from the Index of status: ", 'cyan')))

        if len(STATUS_MESSAGES) >= message_selection:

            updated_status_message = STATUS_MESSAGES[message_selection - 1]
            print 'Your updated status message is: %s' % (
                updated_status_message)

        else:
            print "Invalid choice. Try again."

    else:
        print 'The option you chose is not valid! Press either y or n.'

    return updated_status_message
Exemplo n.º 7
0
def add_status(current_status_message):
    if current_status_message != None:
        print 'your current status message is %s' % (current_status_message)
    else:
        print 'ypu do not have any status message currently \n'

        # ask user for choosing older message.
        default = raw_input(
            "Do you want to select from the older status (y/n)? ")

        if default.upper() == "N":
            new_status_message = raw_input(
                "what status message do you want to set?:\n")

            # validating user input.
            if len(new_status_message) > 0:
                # adding new status message.
                STATUS_MESSAGES.append(new_status_message)
                updated_status_message = new_status_message
                print 'your updated status message is: %s' % (
                    updated_status_message)
            else:
                print "you didnot provide any status message . try again."
        elif default.upper() == "Y":
            # counter for serial no. of messages.
            item_position = 1

            # printing all older messages
            for message in STATUS_MESSAGES:
                print '%d. %s' % (item_position, message)
                item_position = item_position + 1

                # askig users choice.
            message_selection = int(
                raw_input("\nChoose from the above message \n"))

            # validating user input.
            if len(STATUS_MESSAGES) >= message_selection:
                updated_status_message = STATUS_MESSAGES[message_selection - 1]
                print 'your updated status message is: %s' % (
                    updated_status_message)
            else:
                print colored('invalid choice.try again.')
        else:
            print 'the option you choozse is invalid!'
        return updated_status_message