fixing pagination indexing error

master
Vincent Zeng 2018-01-02 22:28:04 -05:00
parent 554550b9eb
commit 8837e2766e
1 changed files with 5 additions and 14 deletions

View File

@ -83,7 +83,6 @@ SETTINGS = {
"rainbows": False "rainbows": False
} }
## ttbp specific utilities ## ttbp specific utilities
def menu_handler(options, prompt, pagify=10, rainbow=False, top=""): def menu_handler(options, prompt, pagify=10, rainbow=False, top=""):
@ -103,14 +102,13 @@ def menu_handler(options, prompt, pagify=10, rainbow=False, top=""):
if optCount % pagify == 0: if optCount % pagify == 0:
total = total - 1 total = total - 1
if total < 2: if total < 1:
util.print_menu(options, SETTINGS.get("rainbows", False)) util.print_menu(options, SETTINGS.get("rainbows", False))
return util.list_select(options, prompt) return util.list_select(options, prompt)
else: else:
return page_helper(options, prompt, pagify, rainbow, page, total, top) return page_helper(options, prompt, pagify, rainbow, page, total, top)
def page_helper(options, prompt, pagify, rainbow, page, total, top): def page_helper(options, prompt, pagify, rainbow, page, total, top):
''' '''
A helper to process pagination. A helper to process pagination.
@ -190,7 +188,6 @@ just keep in mind that you might lose anything you've started here.\
print(stop()) print(stop())
return return
##
redraw() redraw()
while 1: while 1:
@ -206,16 +203,14 @@ just keep in mind that you might lose anything you've started here.\
def stop(): def stop():
''' '''
closer returns an exit message.
* prints ending text
''' '''
return "\n\n\t"+chatter.say("bye")+"\n\n" return "\n\n\t"+chatter.say("bye")+"\n\n"
def check_init(): def check_init():
''' '''
user handler user environment validation
* checks for presence of ttbprc * checks for presence of ttbprc
* checks for last run version * checks for last run version
@ -243,12 +238,8 @@ def check_init():
return init() return init()
def init(): def init():
''' """Initializes new user by setting up ~/.ttbp directory and config file.
new user creation """
* introduces user
* calls setup functinos
'''
try: try:
raw_input(""" raw_input("""