adding subscription remover

master
endorphant 2018-10-14 13:25:07 -04:00
parent 7fbdc6b608
commit 2222197e29
1 changed files with 18 additions and 5 deletions

View File

@ -570,7 +570,7 @@ def main_menu():
redraw("most recent global entries") redraw("most recent global entries")
view_global_feed() view_global_feed()
elif choice == '4': elif choice == '4':
intro = "here are some options for managing your subscriptions" intro = "your subscriptions list is private; no one but you will know who you're following.\n\n> here are some options for your subscriptions:"
redraw(intro) redraw(intro)
subscription_handler(intro) subscription_handler(intro)
elif choice == '5': elif choice == '5':
@ -1423,8 +1423,9 @@ def subscription_manager(subs, intro=""):
redraw(prompt) redraw(prompt)
subs = subscribe_handler(subs, prompt) subs = subscribe_handler(subs, prompt)
elif choice == 1: elif choice == 1:
redraw("list of townies you're subscribed to:") prompt = "list of townies you're subscribed to:"
subs = unsubscribe_handler(subs) redraw(prompt)
subs = unsubscribe_handler(subs, prompt)
else: else:
redraw() redraw()
return return
@ -1432,11 +1433,23 @@ def subscription_manager(subs, intro=""):
redraw(top+intro) redraw(top+intro)
return subscription_manager(subs, intro) return subscription_manager(subs, intro)
def unsubscribe_handler(subs): def unsubscribe_handler(subs, prompt):
''' '''
displays a list of currently subscribed users and toggles deletion. displays a list of currently subscribed users and toggles deletion.
''' '''
subs.sort()
choice = menu_handler(subs, "pick a pal to unsubscribe (or 'q' to cancel): ", 15, SETTINGS.get("rainbows", False), "list of townies recording feels:")
if choice is not False:
townie = subs[choice]
subs.remove(townie)
save_subs(subs)
redraw("{townie} removed! \n\n> {prompt}".format(townie=townie, prompt=prompt))
return unsubscribe_handler(subs, prompt)
else:
redraw()
return subs return subs
def subscribe_handler(subs, prompt): def subscribe_handler(subs, prompt):