diff options
author | 2017-09-11 20:43:35 +0300 | |
---|---|---|
committer | 2017-09-11 20:43:35 +0300 | |
commit | b1e78ba48eedbc70ec79e225e0a8ab7dc8e2c3e6 (patch) | |
tree | 450e9c183b928cadc69c92bd407afb9ae7f5d41d | |
parent | Update gse.py (diff) | |
download | GSE-b1e78ba48eedbc70ec79e225e0a8ab7dc8e2c3e6.tar.gz GSE-b1e78ba48eedbc70ec79e225e0a8ab7dc8e2c3e6.tar.bz2 GSE-b1e78ba48eedbc70ec79e225e0a8ab7dc8e2c3e6.zip |
Included text menu entries
-rwxr-xr-x | scripts/pyfunctions/preliminary.py | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/scripts/pyfunctions/preliminary.py b/scripts/pyfunctions/preliminary.py index 7aa435d..103570b 100755 --- a/scripts/pyfunctions/preliminary.py +++ b/scripts/pyfunctions/preliminary.py @@ -28,6 +28,19 @@ def _is_su(): else: return 1 +# Simple input call +def portalin(_input): + from gseout import report_colors + + if _input is "_input": + portin = input(report_colors.YELLOW + "Input :: <= " + report_colors.RESET) + + elif _input is "_key": + portin = input(report_colors.YELLOW + "Press any key to continue" + report_colors.RESET) + + del report_colors + return portin + # Simple shell call def _shell(): @@ -53,6 +66,7 @@ def _clear(): from os import system system("clear") +# Parameter miss match error def _parameter_error(): from gseout import die from os import system @@ -70,4 +84,90 @@ def _parameter_error(): """) +# Text main menu +def _call_menu(CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR): + from gsub_men import _call_sub + from gmen_opt import _men_opt + + def _init_sub(men, bpar, spar, ccal, *args): + print(*args) + + try: + del _sub_call + + c = [_PARENT, _CHILD, _STAY] + + for i in c[:]: + del i + + except NameError: + pass + + while True: + _clear() + + _men_opt(men) + + _sub_call = _call_sub(ccal, *args) + + for k, v in _sub_call.items(): + if k is "_PARENT" and v == 0: + BACKTO = bpar + + elif k is "_CHILD": + + BACKTO = v + + elif k is "_STAY" and v == 0: + BACKTO = spar + + + return BACKTO + + def _main_loop(minit, CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR): + BACKTO = minit + + while True: + if BACKTO is "MM": + BACKTO = _init_sub("1", "Q", "MM", "main_f", CWORKDIR) + + elif BACKTO is "DOC": + BACKTO = _init_sub("2", "MM", "DOC", "doc_f", CWORKDIR) + + elif BACKTO is "AB": + BACKTO = _init_sub("3", "MM", "DOC", "about_f", CWORKDIR) + + elif BACKTO is "PORT_M": + BACKTO = _init_sub("7", "SM", "PORT_M", "portage_men_f", CCONFDIR) + + elif BACKTO is "CAT_M": + BACKTO = _init_sub("10", "SM", "CATA_M", "catalyst_f", CCONFDIR) + + elif BACKTO is "SM": + BACKTO = _init_sub("6", "BSM", "SM", "bs_f", CWORKDIR) + + elif BACKTO is "BSM": + BACKTO = _init_sub("5", "MM", "BSM", "bs_menu_f", CWORKDIR) + + elif BACKTO is "CO_F": + BACKTO = _init_sub("8", "BSM", "CO_F", "config_f", CCONFDIR) + + elif BACKTO is "SELDEF": + BACKTO = _init_sub("9", "BSM", "SELDEF", "selectdef_f", CWORKDIR) + + elif BACKTO is "GSET": + BACKTO = _init_sub("11", "MM", "GSET", "gse_t", CWORKDIR) + + elif BACKTO is "CONTR": + BACKTO = _init_sub('', "MM", "CONTR", "controller_f", CWORKDIR) + + elif BACKTO is "Q": + break + + + _main_loop("MM", CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR) + + return 0 + + |