def admin_menu():
    menu = consolemenu.SelectionMenu(
        ['Online users', 'Top senders', 'Top spamers'], title='ADMIN MENU')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #2
0
def admin_menu():
    menu = consolemenu.SelectionMenu(
        ["Online users", "Senders Top", "Spamers Top"], title="Menu admin")
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #3
0
def display_results(results, player_one_play, player_two_play):
    global continue_playing
    results_menu_string = ""
    results_menu_play = ""
    list_selection = ["Yes", "No"]

    if results == 0 :
        results_menu_string = "TIE!"
        results_menu_play = "{0} Ties with {1}"
        results_menu_play = results_menu_play.format(player_one_play, player_two_play)
    elif results == 1 :
        results_menu_string = "Player 1 Wins!"
        results_menu_play = "{0} Beats {1}"
        results_menu_play = results_menu_play.format(player_one_play, player_two_play)
    elif results == 2 :
        results_menu_string = "Player 2 Wins!"
        results_menu_play = "{0} Beats {1}"
        results_menu_play = results_menu_play.format(player_two_play, player_one_play)

    results_menu = consolemenu.SelectionMenu(list_selection, show_score(), results_menu_string + " " + results_menu_play)
    results_menu.prologue_text = "Do you want to play again?"
    results_menu.show_exit_option = False
    results_menu.show()
    results_menu.join()
    if results_menu.selected_option == 1:
        continue_playing = False
Beispiel #4
0
def main_menu(msg='') -> int:
    menu = consolemenu.SelectionMenu(['Регистрация', 'Вход'],
                                     title=f'ГЛАВНОЕ МЕНЮ ({msg})')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #5
0
def main_menu(msg="") -> int:
    menu = consolemenu.SelectionMenu(["Register", "Log in"],
                                     title=f"Menu({msg})")
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
def user_menu(login) -> int:
    menu = consolemenu.SelectionMenu(['Sign out', 'Send message', 'Inbox messages', 'My message statistic'],
                                     title=f'USER MENU FOR `{login}`')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
def main_menu(msg='') -> int:
    menu = consolemenu.SelectionMenu(['Register', 'Log in'],
                                     title=f'MAIN MENU ({msg})')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #8
0
def admin_menu():
    menu = consolemenu.SelectionMenu(
        ['Пользователи в онлайне', 'ТОП отправители', 'ТОП спаммеры'],
        title='МЕНЮ АДМИНА')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #9
0
def user_menu(login) -> int:
    menu = consolemenu.SelectionMenu(
        ['Выход', 'Отправить сообщение', 'Входящие', 'СМС статистика'],
        title=f'МЕНЮ ПОЛЬЗОВАТЕЛЯ ДЛЯ `{login}`')
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #10
0
def user_menu(login) -> int:
    menu = consolemenu.SelectionMenu(
        ["Sign out", "Send message", "Messages inbox", "Message statistic"],
        title=f"User menu for `{login}`")
    menu.show()
    if menu.is_selected_item_exit():
        exit()
    return menu.selected_option + 1
Beispiel #11
0
def input_play(player_number, rules_dictionary):
    menu_string = "Player {0}! Please input your choice! Player {1}! Please Look away!"
    menu_string = menu_string.format(player_number + 1, ((player_number + 1) % 2) + 1)
    play_options = list(rules_dictionary.keys())
    menu = consolemenu.SelectionMenu(play_options, show_score(), menu_string)
    menu.show_exit_option = False
    menu.show()
    menu.join()
    return play_options[menu.selected_option]
def mainMenu():
    menu = consolemenu.SelectionMenu(
        ["INICIAR"],
        title="TrasponerTool v.3",
        subtitle="UTILIZE ESTA HERRAMIENTA PARA FÁCILMENTE TRASPONER CELDAS.",
        prologue_text=
        "ESTE PROGRAMA USA LOS MÓDULOS OPENPYXL, COLORAMA, OS, TIME, Y CONSOLEMENU",
        epilogue_text="HECHO POR: FRANCISCO SALCEDO 2020 ",
        exit_option_text="SALIR")
    menu.show()
    menu.join()
Beispiel #13
0
def mainMenu():
    menu = consolemenu.SelectionMenu(
        ["START"],
        title="TrasponerTool v.3",
        subtitle="USE THIS TOOL TO EASILY TRANSPOSE EXCEL CELLS",
        prologue_text=
        "THIS PROGRAM USES THE MODULES OPENPYXL, COLORAMA, OS, TIME, AND CONSOLEMENU",
        epilogue_text="AUTHOR: FF-SS ",
        exit_option_text="EXIT")
    menu.show()
    menu.join()
def mainMenu():
    menu = consolemenu.SelectionMenu(
        ["START"],
        title="TrasponerTool",
        subtitle="USE THIS TOOL TO EASILY TRANSPOSE EXCEL CELLS",
        prologue_text=
        "THIS PROGRAM USES THE MODULES OPENPYXL, COLORAMA, OS, TIME, AND CONSOLEMENU",
        epilogue_text="ABOUT: Version 3.2.0 (C) 2021 github.com/ff-ss",
        show_exit_option=False)
    menu.show()
    menu.join()
Beispiel #15
0
def main_menu_start():
    splash_screen()
    #menu = consolemenu.ConsoleMenu("Rock Paper Scissors", "Choose your game mode",)
    rule_list = read_rules()
    menu = consolemenu.SelectionMenu(rule_list, "RPS & Co. Games",
                                     "Please choose your game mode!")
    menu.show()
    menu.join()
    selection = menu.selected_option

    if selection < len(rule_list):
        initiate_game(rule_list[selection])
def newquery():
    global exitcode
    options = ["CONTINUE WITH THIS FILE (ANOTHER SHEET)", "EXPORT"]
    menu = consolemenu.SelectionMenu(
        options,
        title="DO YOU WISH TO CONTINUE USING THIS FILE?",
        subtitle="EXPORT TO PRODUCE A SINGLE FILE",
        epilogue_text=" ",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    if selection == 0:
        return True
    elif selection == 1:
        return False
Beispiel #17
0
def main():
    menu = consolemenu.SelectionMenu([
        'Кількість терористичних актів по рокам',
        'Кількість терористичних актів по країнам/регіонам',
        'Співвідношення вдалих/невдалих актів та актів, які були/не були спробою самогубства',
        'Статистика типів жертв та використаної зброї'
    ])
    menu.show()
    if menu.is_selected_item_exit():
        return

    steps = [
        dataframe.plot_attacks_by_year_bar, dataframe.plot_country_region_barh,
        dataframe.plot_success_suicide_pie, dataframe.plot_target_props_barh
    ]
    steps[menu.selected_option]()
    main()
def newquery():
    global exitcode
    options = [
        "DESEO EXTRAER MAS DE ESTE ARCHIVO", "TERMINAR CON ESTE ARCHIVO"
    ]
    menu = consolemenu.SelectionMenu(
        options,
        title="DESEA CONTINUAR CON ESTE ARCHIVO?",
        subtitle="LA EXPORTACIÓN SE DARÁ EN UN SOLO ARCHIVO",
        epilogue_text=" ",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    if selection == 0:
        return True
    elif selection == 1:
        return False
def openFile(path):
    global wd
    global menu
    global selection
    global filename
    global file
    global o

    os.chdir(path)

    wd = os.listdir()
    print(wd)
    menu = consolemenu.SelectionMenu(
        wd,
        title="PLEASE SELECT THE SPREADSHEET FROM WHERE TO EXTRACT DATA",
        subtitle="USE ONLY EXCEL (.XLS .XLSX) FILES",
        epilogue_text=
        "IF YOU CAN'T FIND YOUR FILE, MAKE SURE YOU ARE RUNNING THIS PROGRAM ON THE SAME FOLDER AS YOUR FILES.",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    filename = wd[selection]
    try:
        openpyxl.load_workbook(filename)
    except:
        print(
            "                                 ERROR:                                   "
        )
        print(
            "                        YOU HAVE PICKED AN INVALID FILE                   "
        )
        print(
            "                                 TRY AGAIN                                "
        )
        input(">> ")
        openFile()
    else:
        file = openpyxl.load_workbook(filename)
        o = openpyxl.Workbook()
        time.sleep(0.2)
Beispiel #20
0
def main_menu():
    menu = consolemenu.SelectionMenu([
        'Статистика по количеству инцидентов во всех штатах',
        'Статистика по количеству инцидентов по годам',
        'Статистика по количеству раненных/убитых по годам',
        'Распределение гендеров среди жертв и подозреваемых',
        'Распределение возрастных групп среди жертв и подозреваемых'
    ])
    menu.show()
    if menu.is_selected_item_exit():
        exit()

    opts = [
        partial(analisys.plot_states_incident_number,
                df), plot_states_chronological_incidents_stats,
        plot_states_chronological_victims_stats,
        partial(analisys.plot_victims_and_suspects_gender_stats, df),
        partial(analisys.plot_victims_and_suspects_age_stats, df)
    ]
    opts[menu.selected_option]()
    main_menu()
def openFile():
    global wd
    global menu
    global selection
    global filename
    global file
    global o

    wd = os.listdir()
    print(wd)
    menu = consolemenu.SelectionMenu(
        wd,
        title="ESCOJA EL ARCHIVO DEL CUAL EXTRAER DATOS",
        subtitle="SOLO UTILIZE FORMATOS .XLSX O .XLS",
        epilogue_text=
        "SI NO LOCALIZA SU ARCHIVO, POR FAVOR VERIFIQUE QUE ÉSTE EJECUTABLE ESTÉ EN EL MISMO DIRECTORIO.",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    filename = wd[selection]
    try:
        openpyxl.load_workbook(filename)
    except:
        print(
            "                                 ERROR:                                   "
        )
        print(
            "                    HA SELECCIONADO UN ARCHIVO INVÁLIDO.                  "
        )
        print(
            "                             INTENTE DE NUEVO                             "
        )
        input(">> ")
        openFile()
    else:
        file = openpyxl.load_workbook(filename)
        o = openpyxl.Workbook()
        time.sleep(0.2)
def openSheet():
    global wd
    global menu
    global selection
    global sheet_old
    wd = file.sheetnames
    menu = consolemenu.SelectionMenu(
        wd,
        title="CHOOSE THE SHEET FROM WHERE TO EXTRACT DATA.",
        subtitle="PLEASE CHECK THIS IS RIGHT SHEET",
        epilogue_text="YOU MAY OPEN YOUR FILE TO VERIFY",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    global fixdopt
    global fixddir
    fixdopt = menu.selected_option
    fixddir = file.sheetnames
    sheet_old = file.worksheets[file.sheetnames.index(wd[selection])]

    time.sleep(0.2)
def openSheet():
    global wd
    global menu
    global selection
    global sheet_old
    wd = file.sheetnames
    menu = consolemenu.SelectionMenu(
        wd,
        title="ESCOJA LA HOJA DE TRABAJO DE LA CUAL EXTRAER DATOS",
        subtitle="VERIFIQUE QUE SEA LA CORRECTA.",
        epilogue_text="PUEDE ABRIR EL ARCHIVO EXCEL PARA VERIFICAR.",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    global fixdopt
    global fixddir
    fixdopt = menu.selected_option
    fixddir = file.sheetnames
    sheet_old = file.worksheets[file.sheetnames.index(wd[selection])]

    time.sleep(0.2)
    def run_command(self, menu_context):
        """Run the command that will print the dictionary to the user.

        :menu_context: The context of the menu to add the dictionary to.

        :Note: The function prints the dictionary to the user.
        """
        if menu_context.get("dictionary", None) is None:
            print("Menu does not have a dictionary")
            qprompt.pause()
            return

        dictionary = menu_context["dictionary"]

        title = "Dictionary from {} to {}.".format(
            dictionary.native_language, dictionary.translated_language)
        word_list = [str(current_word) for current_word in dictionary.words]
        dictionary_menu = consolemenu.SelectionMenu(word_list,
                                                    title,
                                                    exit_option_text="Up")

        dictionary_menu.show()
def setDirectory():

    cwd = os.getcwd()
    subwd = next(os.walk('.'))[1]
    subwd.append('THIS IS MY FOLDER')
    if not subwd:
        print("___________________________________________________________")
        print("|                                                         |")
        print("|             THERE ARE NO MORE SUBFOLDERS HERE           |")
        print("|            SETTING THIS FOLDER AS THE DIRECTORY...      |")
        print("|          PLEASE RESTART IF THIS NOT YOUR FOLDER         |")
        print("|_________________________________________________________|")
        time.sleep(2)
        return cwd
    menu = consolemenu.SelectionMenu(
        subwd,
        title="LET'S LOOK UP THE FOLDER WHERE YOUR FILE IS",
        subtitle=f"WE ARE CURRENTLY IN {cwd}",
        epilogue_text=
        "YOU CAN'T GO BACK, PLEASE RESTART IF YOU FAILED TO CHOOSE A CORRECT PATH",
        show_exit_option=False)
    menu.show()
    menu.join()
    selection = menu.selected_option
    print(selection)
    sub = subwd[selection]
    print(sub)
    if sub == 'THIS IS MY FOLDER':
        cwd = os.getcwd()
        return cwd
    else:
        os.chdir(cwd + "/" + sub)

    cwd = os.getcwd()
    print(cwd)
    return setDirectory()
    categories = json.loads(f.read().decode())

categories_name = []
categories_index = []
for cat in categories['trivia_categories']:
    # print(cat['name'])
    categories_name.append(cat['name'])
    categories_index.append(cat['id'])
categories_name.append('Any Categories')
categories_index.append(-1)

# print(categories_name)
# print(categories_index)

# We choose a category
menu = cm.SelectionMenu(categories_name, "Please choose a category.")
menu.show()
menu.join()
selection = menu.selected_option

if selection == len(categories_name):
    print("OK, bye.")
    quit()
elif categories_index[selection] == -1:
    str_category = ""
else:
    str_category = "&category=" + str(categories_index[selection])

# We select the amount of questions to load
# By default: 10 questions.
str_question = "amount=10"
Beispiel #27
0
import consolemenu

import database

if __name__ == '__main__':
    menu = consolemenu.SelectionMenu(
        ['Сделать резервную копию', 'Восстановить данные из резервной копии'])
    menu.show()
    if menu.is_selected_item_exit():
        exit()

    if menu.selected_option == 0:
        url = input(
            'Введите URL базы данных, для которой нужно сделать бекап: ')
        database.backup(url)
        print('Резервная копия сохранена в backup.csv')
    else:
        url = input(
            'Введите URL базы данных, в которую нужно восстановить данные: ')
        database.restore(url)
        print('Резервная копия из backup.csv восстановлена')
Beispiel #28
0
# Create the menu
menu = cm.ConsoleMenu('Title', 'Subtitle')

# Create some items

# MenuItem is the base class for all items, it doesn't do anything when selected
menu_item = cm_items.MenuItem('Menu Item')

# A FunctionItem runs a Python function when selected
function_item = cm_items.FunctionItem('Call a Python function', input,
                                      ['Enter an input'])

# A CommandItem runs a console command
command_item = cm_items.CommandItem('Run a console command', 'touch hello.txt')

# A SelectionMenu constructs a menu from a list of strings
selection_menu = cm.SelectionMenu(['item1', 'item2', 'item3'])

# A SubmenuItem lets you add a menu (the selection_menu above, for example)
# as a submenu of another menu
submenu_item = cm_items.SubmenuItem('Submenu item', selection_menu, menu)

# Once we're done creating them, we just add the items to the menu
menu.append_item(menu_item)
menu.append_item(function_item)
menu.append_item(command_item)
menu.append_item(submenu_item)

# Finally, we call show to show the menu and allow the user to interact
menu.show()
Beispiel #29
0
# Create the menu
menu = consolemenu.ConsoleMenu("Title", "Subtitle")

# Create some cm_items

# MenuItem is the base class for all cm_items, it doesn't do anything when selected
menu_item = cm_items.MenuItem("Menu Item")
function_item = cm_items.FunctionItem("Call a Python function", input,
                                      ["Enter an input "])
command_item = cm_items.CommandItem("Run a console command", "touch hello.txt")

# A SelectionMenu constructs a menu from a list of strings
selection_menu = consolemenu.SelectionMenu(["item1", "item2", "item3"],
                                           'title',
                                           'subtitle',
                                           False,
                                           prologue_text='asdf',
                                           epilogue_text='ariuh')

# A SubmenuItem lets you add a menu (the selection_menu above, for example)
# as a submenu of another menu

sub_menu = consolemenu.ConsoleMenu("submenu", "Subtitle")

sub_add_item = cm_items.FunctionItem("add item",
                                     lambda: sub_menu.append_item(menu_item))
sub_rem_item = cm_items.FunctionItem("remove item",
                                     lambda: sub_menu.remove_item(menu_item))

sub_menu.append_item(sub_add_item)
sub_menu.append_item(sub_rem_item)
Beispiel #30
0
import pickle
import json
import consolemenu
from generic_lib import georeverse, geolookup
from bluvo_main import BlueLink
from tools.stamps import postOffice

from params import *  # p_parameters are read

logging.basicConfig(format='%(asctime)s - %(levelname)-8s - %(filename)-18s - %(message)s', filename='bluvo_test.log',
                    level=logging.DEBUG)

menuoptions = ['0 exit',"1 Lock", "2 Unlock", "3 Status", "4 Status formatted", "5 Status refresh", "6 location", "7 loop status",
               "8 Navigate to", '9 set Charge Limits', '10 get charge schedule', '11 get services', '12 poll car',  '13 get stamps', '14 odometer', '15 get park location',
               '16 get user info', '17 get monthly report', '18 get monthly report lists', '19 poll car without forced', '20 poll car with forced']
mymenu = consolemenu.SelectionMenu(menuoptions)
# heartbeatinterval, initsuccess = initialise(p_email, p_password, p_pin, p_vin, p_abrp_token, p_abrp_carmodel, p_WeatherApiKey,
                         # p_WeatherProvider, p_homelocation, p_forcepollinterval, p_charginginterval,
                         # p_heartbeatinterval)
logging.info("starting test run")
bluelink = BlueLink(p_email, p_password, p_pin, p_vin, p_abrp_carmodel, p_abrp_token, p_WeatherApiKey, p_WeatherProvider, p_homelocation)
bluelink.initialise(p_forcepollinterval, p_charginginterval)

if bluelink.initSuccess:
    #stampie = postOffice("hyundai", False)
    while True:
        for i in menuoptions:
            print(i) 
        #try:
        x = int(input("Please Select:"))
        #print(x)