Return to repo list

pystatsite

On-or-Offline static site generator in Python
Return to HMagellan.com

commit 1a44c474f4274b66324a831ab892d232481c7e53
parent 66e011a5d119baaa286add1d018a3b81ee9150e6
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sun,  4 Apr 2021 23:11:53 -0500

finalize option system

Diffstat:
Ddata/hierarchy.json | 2--
Mdata/interfaces.json | 19++++++++++++++-----
Moptions.json | 1+
Msrc/interface.py | 3+++
Msrc/share.py | 1+
5 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/data/hierarchy.json b/data/hierarchy.json @@ -1,2 +0,0 @@ -{ -} diff --git a/data/interfaces.json b/data/interfaces.json @@ -1,14 +1,15 @@ { "main" : { - "prompt" : "==============\n| PYSTATSITE |\n==============\nPlease choose an option:", + "prompt" : "==============\n| PYSTATSITE |\n==============\n", "choices" : [ ["Create a new web page", "new_page"], ["Edit an existing web page", "edit_page"], - ["Sync site to a location", "sync_site"] + ["Sync site to a location", "sync_site"], + ["Change current options", "change_options"] ] }, "new_page" : { - "prompt" : "============\n| NEW PAGE |\n============\nPlease choose an option:", + "prompt" : "============\n| NEW PAGE |\n============\n", "choices" : [ ["Create a new blog post", "new_blog"], ["Create a new top-level site page", "new_top_page"], @@ -16,7 +17,7 @@ ] }, "edit_page" : { - "prompt" : "=============\n| EDIT PAGE |\n=============\nPlease choose an option:", + "prompt" : "=============\n| EDIT PAGE |\n=============\n", "choices" : [ ["Edit a blog post", "edit_blog"], ["Edit a top-level site page", "edit_top_page"], @@ -24,10 +25,18 @@ ] }, "sync_site" : { - "prompt" : "=============\n| SYNC SITE |\n=============\nPlease choose an option:", + "prompt" : "=============\n| SYNC SITE |\n=============\n", "choices" : [ ["Sync to a remote location", "sync_remote"], ["Sync to a local directory", "sync_local"] ] + }, + "change_options" : { + "prompt" : "==================\n| CHANGE OPTIONS |\n==================\n", + "choices" : [ + ["Change working site", "change_site"], + ["Change editor", "change_editor"], + ["Change sync locations", "change_sync"] + ] } } diff --git a/options.json b/options.json @@ -1,5 +1,6 @@ { "editor" : "/usr/bin/vim", + "active_site" : "sample", "sync_local": "/var/www/html", "sync_remote" : "https://sample.com" } diff --git a/src/interface.py b/src/interface.py @@ -9,9 +9,12 @@ def launch_interface(interface_name = ""): choice = None choices = LOADED_INTERFACES[interface_name]["choices"] choices.append(["Quit", "exit"]) + state = "Current working site: " + LOADED_OPTIONS["active_site"] while not chosen: os.system("clear") print(LOADED_INTERFACES[interface_name]["prompt"]) + print('\t' + state + '\n') + print("Please choose an option: ") num = 1 for c in choices: print('\t' + str(num) + ") " + c[0]) diff --git a/src/share.py b/src/share.py @@ -12,6 +12,7 @@ INTERFACE_FUNCS = { "new_page" : [0, "new_page"], "edit_page" : [0, "edit_page"], "sync_site" : [0, "sync_site"], + "change_options" : [0, "change_options"], "exit" : [sys.exit, 0] }