コード例 #1
0
    def do_task(self, arg):
        '\nto start please enter\
         \n[task] <0-10>\
         \nstop task by entering [task]\
         \n'

        print('type: [task ?] to see all options')

        if arg.lower() == 'stop' or arg.lower() == '':
            AUV.stop_task()
        elif arg.lower() == 'all':
            AUV.perform_tasks()
        elif arg.lower() == 'heading' or arg.lower() == 'h':
            AUV.save_heading()
        elif arg == '?':
            print(
                '\nto start please enter:\
                   \n[task] (0-{})\
                   \nstop task by entering [task] or [task stop]\
                   \nrun all tasks by entering [task all]\
                   \nsave current heading by entering [task heading]\
                   \n'.format(len(AUV.houston.tasks)))

            AUV.display_tasks()
        elif not arg == '':
            try:
                arg = int(arg)
            except:
                print '\nINVALID NUMBER INPUT'
                pass

            if arg >= 0 and arg <= len(AUV.houston.tasks):
                AUV.specific_task(arg)
                # AUV.display_tasks()
        else:
            print(
                '\nto start please enter:\
                   \n[task] (0-{})\
                   \nstop task by entering [task] or [task stop]\
                   \nrun all tasks by entering [task all]\
                   \nsave current heading by entering [task heading]\
                   \n'.format(len(AUV.houston.tasks)))

            AUV.display_tasks()
コード例 #2
0
    def do_task(self, arg):
        '\n\
         \n[task] followed by a number'

        AUV.display_tasks()

        if arg.lower() == 'stop' or arg.lower() == '':
            AUV.stop_task()
        elif not arg == '':
            try:
                arg = int(arg)
            except:
                # print '\nINVALID NUMBER INPUT'
                pass

        if arg >= 0 and arg <= 10:
            AUV.specific_task(arg)
        else:
            print '\nINVALID NUMBER INPUT'