Pokemon-Terminal/main.py
2017-04-25 11:32:44 -04:00

64 lines
2 KiB
Python
Executable file

#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
# The main module that brings everything together.
from sys import argv
import backchanger
import extractor
import printer
import random
import sys
import time
def debug(start, end):
# Test each Pokemon in order, one by one.
try:
for x in range(start, end):
backchanger.change_background(x)
time.sleep(0.25)
except KeyboardInterrupt:
print("Program was terminated.")
sys.exit()
if __name__ == "__main__":
# Entrance to the program.
if len(argv) == 1:
print("No command line arguments specified. Try typing in a Pokemon name or number.")
elif len(argv) == 2:
arg = argv[1].lower()
if len(arg) == 1 and arg.isalpha():
printer.print_pokemon_starting_with(arg)
elif arg == "regions":
printer.print_regions()
elif arg == "--help" or arg == "help" or arg == "-h":
printer.print_usage()
elif arg == "kanto":
printer.print_kanto()
elif arg == "johto":
printer.print_johto()
elif arg == "hoenn":
printer.print_hoenn()
elif arg == "sinnoh":
printer.print_sinnoh()
elif arg == "all" or arg == "pokemon" or arg == "list":
printer.print_all()
elif arg == "slideshow":
debug(1, 494)
elif arg == "slideshow-kanto":
debug(1, 152)
elif arg == "slideshow-johto":
debug(152, 252)
elif arg == "slideshow-hoenn":
debug(252, 387)
elif arg == "slideshow-sinnoh":
debug(387, 494)
elif arg == "rand" or arg == "random":
backchanger.change_background(random.randint(1, 494))
elif arg == "?" or arg == "current":
extractor.current_pokemon()
else:
backchanger.change_background(arg)
else:
print("Only one command line argument is supported.")