From 222e6e9d595d016ef43a3b8bfe4925b4de0624cd Mon Sep 17 00:00:00 2001 From: Vincent Zeng Date: Wed, 28 Feb 2018 12:23:34 -0500 Subject: [PATCH] adding menu option for changing nopub default --- ttbp/ttbp.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 54605a1..896bc99 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -474,6 +474,13 @@ def setup(): save_settings() return setup() + #nopub toggling + elif settingList[int(choice)] == "nopub": + SETTINGS.update({"nopub": toggle_pub_default()}) + redraw("posting default set to {nopub}".format(nopub=SETTINGS.get("nopub"))) + save_settings() + return setup() + input("\nyou're all good to go, {friend}! hit to continue.\n\n".format(friend=chatter.say("friend"))) redraw() @@ -985,6 +992,46 @@ your changes by exiting without saving. ## misc helpers +def toggle_pub_default(): + """setup helper for setting default publish privacy (does not apply + retroactively). """ + + if SETTINGS.get("nopub", False) is True: + (nopub, will) = ("(nopub)", "won't") + else: + (nopub, will) = ("public", "will") + + if SETTINGS.get("publishing", False) is True: + publishing = "" + else: + publishing = """\ +since you're currently not publishing your posts to html/gopher, this setting +won't affect the visibility of your posts. however, the option is still here if +you'd like to change it. +""" + + print(""" + +DEFAULT POST PRIVACY + +your entries are set to automatically post as {nopub}. this means they {will} be +posted to your world-visible pages at first (which you can always change after +the fact.) + +this setting only affects subsequent posts; it does not apply retroactively. + +{publishing}""".format(nopub=nopub, will=will, publishing=publishing)) + + ans = util.input_yn("""\ +would you like to change this behavior? + +please enter""") + + if ans: + return not SETTINGS.get("nopub") + else: + return SETTINGS.get("nopub") + def toggle_rainbows(): """setup helper for rainbow toggling """