Ejemplo n.º 1
0
 def checkCharacters( self, opt, arg ):
     if opt in ('-l', '--arrl-lesson',
                '-k', '--koch-lesson' ):
         if opt in ('-k', '--koch-lesson'):
             lessons = KOCH_lessons
         else:
             lessons = ARRL_lessons
         if arg == 'all':
             self.dict['character_list'] = "".join( lessons )
         elif int(arg) >= 1 and int(arg) <= (len(lessons)+1):
             if int(arg) == 1:
                 self.dict['character_list'] = lessons[0]
             else:
                 self.dict['character_list'] = "".join(lessons[:int(arg)])
         else:
             self.errors.append( "Lessons range from 1 and %s" %\
                                 (len(lessons)+1) )
     elif opt in ('-a', '--all-arrl'):
         self.dict['character_list'] = ARRL_list
     elif opt in ('-m', '--all-morse'):
         self.dict['character_list'] = morse_dict.keys()
     elif opt == '-u':
         self.dict['character_list'] = arg.upper()
     elif opt in ('-p','--priority'):
         self.dict['priority_list'] = arg.upper()
     elif opt in ('-c','--no_caps'):
         self.dict['no_caps'] = true
     elif opt in ('-x','--extra'):
         self.dict['extra_characters'] = arg.upper()
     elif opt in ('-h','--hamwords'):
         self.dict['hamwords'] = true
     else:
         return false
     return true
Ejemplo n.º 2
0
 def checkPrintings(self, opt, arg):
     if opt in ('-v', '--verbose'):
         self.verbose = sys.stderr
     elif opt == '--debug':
         self.debug = true
         self.verbose = sys.stderr
     elif opt == '--license':
         print LICENSE
         sys.exit(0)
     elif opt in ('-L', '--list-arrl-lessons'):
         print "ARRL Lesson List\n"
         count = 1
         for l in ARRL_lessons:
             print "%d: %s" % (count, l)
             count += 1
         sys.exit(0)
     elif opt in ('-K', '--list-koch-lessons'):
         print "Koch Lesson List\n"
         count = 1
         for l in KOCH_lessons:
             print "%d: %s" % (count, l)
             count += 1
         sys.exit(0)
     elif opt in ("-A",'--list-all-arrl'):
         print "ARRL Exam Character Lists\n"
         print ARRL_list
         sys.exit(0)
     elif opt in ('-M','--list-all-morse'):
         print "All Morse Characters\n"
         print
         l = morse_dict.keys()
         l.sort()
         print l
         sys.exit(1)
     else:
         return false
     return true