forked from endorphant/ttbp
updated to 0.11.2
parent
89a53336ac
commit
161ce39ea7
|
@ -82,7 +82,7 @@ ___________________________________________________________
|
||||||
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
|
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
|
||||||
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
|
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
|
||||||
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
|
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
|
||||||
| ver 0.11.1 (rainbows) |
|
| ver 0.11.2 (rainbows) |
|
||||||
|__________________________________________________________|
|
|__________________________________________________________|
|
||||||
'''.lstrip()
|
'''.lstrip()
|
||||||
|
|
||||||
|
@ -146,4 +146,12 @@ version 0.9.3 features:
|
||||||
exciting
|
exciting
|
||||||
* general PSA: feel free to use the github repo for bugs/feature requests:
|
* general PSA: feel free to use the github repo for bugs/feature requests:
|
||||||
https://github.com/modgethanc/ttbp/issues""",
|
https://github.com/modgethanc/ttbp/issues""",
|
||||||
}
|
"0.11.2": """
|
||||||
|
~[version 0.11.2 update]~
|
||||||
|
|
||||||
|
* added a new option to allow setting entries to default to either public or
|
||||||
|
non-public on posting; this option only really makes sense if you're
|
||||||
|
already publishing to html/gopher, but is available either way!
|
||||||
|
|
||||||
|
you can find this option under 'settings' as 'post as nopub'."""
|
||||||
|
}
|
||||||
|
|
65
ttbp/ttbp.py
65
ttbp/ttbp.py
|
@ -50,7 +50,7 @@ from . import chatter
|
||||||
from . import gopher
|
from . import gopher
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
__version__ = "0.11.1"
|
__version__ = "0.11.2"
|
||||||
__author__ = "endorphant <endorphant@tilde.town)"
|
__author__ = "endorphant <endorphant@tilde.town)"
|
||||||
|
|
||||||
p = inflect.engine()
|
p = inflect.engine()
|
||||||
|
@ -225,11 +225,13 @@ def check_init():
|
||||||
print("{greeting}, {user}".format(greeting=chatter.say("greet"),
|
print("{greeting}, {user}".format(greeting=chatter.say("greet"),
|
||||||
user=config.USER))
|
user=config.USER))
|
||||||
|
|
||||||
|
load_settings = load_user_settings()
|
||||||
|
|
||||||
## ttbp env validation
|
## ttbp env validation
|
||||||
if not user_up_to_date():
|
if not user_up_to_date():
|
||||||
update_user_version()
|
update_user_version()
|
||||||
|
|
||||||
if not valid_setup():
|
if not valid_setup(load_settings):
|
||||||
setup_repair()
|
setup_repair()
|
||||||
else:
|
else:
|
||||||
input("press <enter> to explore your feels.\n\n")
|
input("press <enter> to explore your feels.\n\n")
|
||||||
|
@ -327,23 +329,14 @@ def gen_header():
|
||||||
"""
|
"""
|
||||||
return header
|
return header
|
||||||
|
|
||||||
def valid_setup():
|
def valid_setup(load_settings):
|
||||||
'''
|
'''
|
||||||
Checks to see if user has a valid ttbp environment.
|
Checks to see if user has a valid ttbp environment.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
global SETTINGS
|
if not load_settings:
|
||||||
|
|
||||||
if not os.path.isfile(config.TTBPRC):
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
|
||||||
SETTINGS = json.load(open(config.TTBPRC))
|
|
||||||
except ValueError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
core.load(SETTINGS)
|
|
||||||
|
|
||||||
for option in iter(DEFAULT_SETTINGS):
|
for option in iter(DEFAULT_SETTINGS):
|
||||||
if option != "publish dir" and SETTINGS.get(option, None) is None:
|
if option != "publish dir" and SETTINGS.get(option, None) is None:
|
||||||
return False
|
return False
|
||||||
|
@ -362,6 +355,24 @@ def valid_setup():
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def load_user_settings():
|
||||||
|
"""attempts to load user's ttbprc; returns settings dict if valie, otherwise
|
||||||
|
returns false"""
|
||||||
|
|
||||||
|
global SETTINGS
|
||||||
|
|
||||||
|
if not os.path.isfile(config.TTBPRC):
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
SETTINGS = json.load(open(config.TTBPRC))
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
core.load(SETTINGS)
|
||||||
|
|
||||||
|
return SETTINGS
|
||||||
|
|
||||||
def setup_repair():
|
def setup_repair():
|
||||||
'''
|
'''
|
||||||
setup repair function
|
setup repair function
|
||||||
|
@ -381,7 +392,8 @@ def setup_repair():
|
||||||
"publishing": select_publishing,
|
"publishing": select_publishing,
|
||||||
"publish dir": select_publish_dir,
|
"publish dir": select_publish_dir,
|
||||||
"gopher": gopher.select_gopher,
|
"gopher": gopher.select_gopher,
|
||||||
"rainbows": toggle_rainbows
|
"rainbows": toggle_rainbows,
|
||||||
|
"post as nopub": toggle_pub_default
|
||||||
}
|
}
|
||||||
|
|
||||||
for option in iter(settings_map):
|
for option in iter(settings_map):
|
||||||
|
@ -475,9 +487,9 @@ def setup():
|
||||||
return setup()
|
return setup()
|
||||||
|
|
||||||
#nopub toggling
|
#nopub toggling
|
||||||
elif settingList[int(choice)] == "nopub":
|
elif settingList[int(choice)] == "post as nopub":
|
||||||
SETTINGS.update({"nopub": toggle_pub_default()})
|
SETTINGS.update({"post as nopub": toggle_pub_default()})
|
||||||
redraw("posting default set to {nopub}".format(nopub=SETTINGS.get("nopub")))
|
redraw("posting default set to {nopub}".format(nopub=SETTINGS.get("post as nopub")))
|
||||||
save_settings()
|
save_settings()
|
||||||
return setup()
|
return setup()
|
||||||
|
|
||||||
|
@ -794,7 +806,7 @@ editor.
|
||||||
|
|
||||||
left = ""
|
left = ""
|
||||||
|
|
||||||
if SETTINGS.get("nopub"):
|
if SETTINGS.get("post as nopub"):
|
||||||
core.toggle_nopub(os.path.basename(entry))
|
core.toggle_nopub(os.path.basename(entry))
|
||||||
else:
|
else:
|
||||||
if core.publishing():
|
if core.publishing():
|
||||||
|
@ -1000,7 +1012,7 @@ def toggle_pub_default():
|
||||||
"""setup helper for setting default publish privacy (does not apply
|
"""setup helper for setting default publish privacy (does not apply
|
||||||
retroactively). """
|
retroactively). """
|
||||||
|
|
||||||
if SETTINGS.get("nopub", False) is True:
|
if SETTINGS.get("post as nopub", False) is True:
|
||||||
(nopub, will) = ("(nopub)", "won't")
|
(nopub, will) = ("(nopub)", "won't")
|
||||||
else:
|
else:
|
||||||
(nopub, will) = ("public", "will")
|
(nopub, will) = ("public", "will")
|
||||||
|
@ -1032,9 +1044,9 @@ would you like to change this behavior?
|
||||||
please enter""")
|
please enter""")
|
||||||
|
|
||||||
if ans:
|
if ans:
|
||||||
return not SETTINGS.get("nopub")
|
return not SETTINGS.get("post as nopub")
|
||||||
else:
|
else:
|
||||||
return SETTINGS.get("nopub")
|
return SETTINGS.get("post as nopub")
|
||||||
|
|
||||||
def toggle_rainbows():
|
def toggle_rainbows():
|
||||||
"""setup helper for rainbow toggling
|
"""setup helper for rainbow toggling
|
||||||
|
@ -1296,7 +1308,6 @@ def update_user_version():
|
||||||
ttbprc.close()
|
ttbprc.close()
|
||||||
|
|
||||||
# from earlier than 0.10.1
|
# from earlier than 0.10.1
|
||||||
|
|
||||||
if y < 10:
|
if y < 10:
|
||||||
# select gopher
|
# select gopher
|
||||||
print("[ NEW FEATURE ]")
|
print("[ NEW FEATURE ]")
|
||||||
|
@ -1318,6 +1329,12 @@ def update_user_version():
|
||||||
print("[ NEW FEATURE ]")
|
print("[ NEW FEATURE ]")
|
||||||
SETTINGS.update({"rainbows": toggle_rainbows()})
|
SETTINGS.update({"rainbows": toggle_rainbows()})
|
||||||
|
|
||||||
|
if z < 2:
|
||||||
|
# set default option for 0.11.2
|
||||||
|
# print("default nopub: false")
|
||||||
|
SETTINGS.update({"post as nopub": False})
|
||||||
|
save_settings()
|
||||||
|
|
||||||
print("""
|
print("""
|
||||||
you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant if
|
you're all good to go, """+chatter.say("friend")+"""! please contact ~endorphant if
|
||||||
something strange happened to you during this update.
|
something strange happened to you during this update.
|
||||||
|
@ -1335,6 +1352,10 @@ something strange happened to you during this update.
|
||||||
# version 0.11.1 patch notes
|
# version 0.11.1 patch notes
|
||||||
print(config.UPDATES["0.11.1"])
|
print(config.UPDATES["0.11.1"])
|
||||||
|
|
||||||
|
if y < 11 or z < 2:
|
||||||
|
# version 0.11.2 patch notes
|
||||||
|
print(config.UPDATES["0.11.2"])
|
||||||
|
|
||||||
confirm = ""
|
confirm = ""
|
||||||
|
|
||||||
while confirm not in ("x", "<x>", "X", "<X>"):
|
while confirm not in ("x", "<x>", "X", "<X>"):
|
||||||
|
|
Loading…
Reference in New Issue