From e1bd23d257cc8ee57215a5039757155ead894fbd Mon Sep 17 00:00:00 2001 From: endorphant Date: Fri, 27 May 2016 14:08:45 -0400 Subject: [PATCH] graffiti wall testing added graffiti wall to beta. cleaned up beta checking, including new beta banner. added rainbow text to util. --- bin/_ttbp.py | 92 ++++++++++++++++++++++++++++++++++++++-------------- bin/util.py | 13 ++++++++ 2 files changed, 81 insertions(+), 24 deletions(-) diff --git a/bin/_ttbp.py b/bin/_ttbp.py index a16d421..71ceea3 100644 --- a/bin/_ttbp.py +++ b/bin/_ttbp.py @@ -40,7 +40,7 @@ import chatter import inflect import util -__version__ = "0.9.0b" +__version__ = "0.9.1b" __author__ = "endorphant if you didn't mean to do this.") try: core.load(setup()) # reload settings to core except KeyboardInterrupt(): redraw(EJECT) redraw() - elif choice == '5': + elif choice == '6': redraw("you're about to send mail to ~endorphant about ttbp\n") feedback_menu() - elif choice == '6': + elif choice == '7': redraw() show_credits() - elif choice == '7': + elif choice == '8': subprocess.call(["lynx", os.path.join(SOURCE, "..", "README.html")]) redraw() elif choice in QUITS: @@ -548,7 +555,7 @@ editor. entryFile = open(entry, "a") entryFile.write("\n"+entered+"\n") entryFile.close() - subprocess.call([SETTINGS["editor"], entry]) + subprocess.call([SETTINGS.get("editor"), entry]) left = "" @@ -653,6 +660,33 @@ def view_feed(): return +def graffiti_handler(): + ''' + Main graffiti handler. + ''' + + if os.path.isfile(WALL_LOCK): + redraw("sorry, "+chatter.say("friend")+", but someone's there right now. try again in a few!\n") + else: + subprocess.call(["touch", WALL_LOCK]) + redraw() + print("""\ +the graffiti wall is a world-writeable text file. anyone can +scribble on it; anyone can move or delete things. please be +considerate of your neighbors when writing on it. + +no one will be able to visit the wall while you are here, so don't +worry about overwriting someone else's work. anything you do to the +wall will be recorded if you save the file, and you can cancel +your changes by exiting without saving. + +""") + raw_input("press to visit the wall\n\n") + subprocess.call([SETTINGS.get("editor"), WALL]) + subprocess.call(["rm", WALL_LOCK]) + redraw("thanks for visiting the graffiti wall!") + + ## misc helpers @@ -787,31 +821,32 @@ def build_mismatch(): if not os.path.exists(versionFile): return False - ver = open(versionFile, "r").read() - + ver = open(versionFile, "r").read().rstrip() if ver[-1] == __version__[-1]: return False - return True + return ver -def switch_build(): +def switch_build(ver): ''' switches user between beta and stable builds ''' if __version__[-1] == 'b': build = "beta" + ver += "b" else: build = "stable" + ver = ver[0:-1] - # increment user versionfile - print("\nswitching you over to the most current "+build+" version...\n") + # write user versionfile + print("\nswitching you over to the "+build+" version...\n") time.sleep(1) print("...") versionFile = os.path.join(PATH, "version") - open(versionFile, "w").write(__version__) - time.sleep(2) - print("\nall good!\n") + open(versionFile, "w").write(ver) + time.sleep(1) + #print("\nall good!\n") def updated(): ''' @@ -846,6 +881,8 @@ def update_version(): print("...") time.sleep(2) + userVersion = "" + if not os.path.isfile(versionFile): # from 0.8.5 to 0.8.6: @@ -878,9 +915,9 @@ def update_version(): ttbprc.close() else: # version at least 0.8.6 - userVersion = open(versionFile, 'r').read() + userVersion = open(versionFile, "r").read().rstrip() - # from 0.8.6 to 0.8.7 + # from 0.8.6 if userVersion == "0.8.6": print("\nresetting your publishing settings...\n") SETTINGS.update({"publishing":select_publishing()}) @@ -889,16 +926,23 @@ def update_version(): ttbprc.write(json.dumps(SETTINGS, sort_keys=True, indent=2, separators=(',',':'))) ttbprc.close() - # increment user versionfile open(versionFile, "w").write(__version__) - print("you're all good to go, "+chatter.say("friend")+"!") + print("\nyou're all good to go, "+chatter.say("friend")+"!\n") - # version 0.9.0 patch notes: - print(""" + # show patch notes + if userVersion != "0.9.0" and userVersion != "0.9.0b": + # version 0.9.0 patch notes: + print(""" ver. 0.9.0 features: * browsing other people's feels from neighbor view * documentation browser + """) + + # version 0.9.1 patch notes + print(""" +ver 0.9.1 features: + * graffiti wall """) ##### diff --git a/bin/util.py b/bin/util.py index 8f4dfca..1b597ed 100644 --- a/bin/util.py +++ b/bin/util.py @@ -84,6 +84,19 @@ def hilight(text): return colorama.Style.BRIGHT+text+colorama.Style.NORMAL +def rainbow(txt): + ''' + Takes a string and makes every letter a different color. + ''' + + rainbow = "" + for letter in txt: + rainbow += attach_rainbow() + letter + + rainbow += attach_reset() + + return rainbow + def pretty_time(time): ''' human-friendly time formatter