Exemplo n.º 1
0
    task = Thread(target=main, args=args)
    task_menu = FunctionItem(name,
                             terminate_task, [task, name],
                             should_exit=True)
    task_menu.args.append(task_menu)
    tasks_menu.append_item(task_menu)
    task.start()
    print('Started successfully.')
    input()


Client.login()

gen_menu = ConsoleMenu('Send messages and files')
gen_menu.append_item(FunctionItem('Send message', Client.send_message))
gen_menu.append_item(FunctionItem('Send file', Client.send_file))
gen_menu.append_item(FunctionItem('Bulk send', Client.bulk_send))
gen_menu.append_item(FunctionItem('User info', Client.user_info))
gen_menu.append_item(FunctionItem('Server list', Client.get_servers))
gen_menu.append_item(FunctionItem('Member list', Client.create_list))
gen_menu.append_item(FunctionItem('Download avatar', Client.download_avatar))

exploit_menu = ConsoleMenu('Exploits and misc features')
exploit_menu.append_item(
    FunctionItem('Infinite typing', create_task,
                 ['Infinite typing', Exploits.typing, 'Channel ID']))
exploit_menu.append_item(
    FunctionItem('Status changer', create_task,
                 ['Status changer', Exploits.status_changer]))
exploit_menu.append_item(FunctionItem('Friend finder', Exploits.friend_list))
def test():
    return FunctionItem("current working directory", space, [])
def renameFunction():
    return FunctionItem("Rename File", getRenameInfo, [])
def bulkFunction():
    return FunctionItem("Bulk Rename", getBulkInfo, [])
def fileListFunction():
    return FunctionItem("List all Files in folder", listAllFilesInDir, [])
Exemplo n.º 6
0
    discovering_website = Project()
    load_or_new = input('Do you want to load a project from disk? (y/n) ')
    if load_or_new == 'y':
        path = input('Path: ')
        discovering_website.load(path)
    else:
        name = input('Name: ')
        description = input('Description: ')
        discovering_website = Project(name, description)

    interface = ConsoleInterfaceWrapper(discovering_website)

    m_main = ConsoleMenu('WebSiDis console interface')

    m_notes = ConsoleMenu('Notes')
    m_notes.append_item(FunctionItem('Add new note', interface.wrapAddNote))
    m_notes.append_item(
        FunctionItem('Remove existed note', interface.wrapRemNote))
    m_notes.append_item(
        FunctionItem('Show notes', interface.wrapShow, ['notes']))

    m_related = ConsoleMenu('Sites')
    m_related.append_item(
        FunctionItem('Add new related site', interface.wrapAddRelated))
    m_related.append_item(
        FunctionItem('Remove existed related site', interface.wrapRemRelated))
    m_related.append_item(
        FunctionItem('Show related sites', interface.wrapShow, ['related']))

    m_structure = ConsoleMenu('Structure')
    m_structure.append_item(FunctionItem('Add new page',
Exemplo n.º 7
0
def main():
    # Create the menu
    menu = ConsoleMenu(
        "Lena's Bank main menu",
        "Welcome to Lena's Bank! Please select from the following menu:")

    # A FunctionItem runs a Python function when selected
    list_of_all_customers_function = FunctionItem("List of all customers",
                                                  bank.list_of_all_customers)
    find_customer_function = FunctionItem("Find customer by SSN",
                                          bank.find_customer)
    update_customer_info_function = FunctionItem("Update customer info",
                                                 bank.update_customer)
    remove_customer_function = FunctionItem("Remove customer",
                                            bank.remove_customer)
    add_new_customer_function = FunctionItem("Add new customer",
                                             bank.add_new_customer)

    get_balance_function = FunctionItem("Get balance", bank.get_balance)
    open_new_account_function = FunctionItem("Open New Account",
                                             bank.open_new_account)
    close_account_function = FunctionItem("Close account", bank.close_account)

    add_new_transaction_function = FunctionItem("Add new transaction",
                                                bank.add_new_transaction)
    view_transaction_history_function = FunctionItem(
        "View transaction history", bank.transaction_history)

    list_of_all_customers_submenu_item = SelectionMenu([])
    list_of_all_customers_submenu_item.append_item(
        list_of_all_customers_function)
    list_of_all_customers_submenu_item.append_item(find_customer_function)
    list_of_all_customers_submenu_item.append_item(
        update_customer_info_function)
    list_of_all_customers_submenu_item.append_item(add_new_customer_function)
    list_of_all_customers_submenu_item.append_item(remove_customer_function)

    work_with_accounts_selection_menu = SelectionMenu([])
    work_with_accounts_selection_menu.append_item(get_balance_function)
    work_with_accounts_selection_menu.append_item(open_new_account_function)
    work_with_accounts_selection_menu.append_item(close_account_function)

    process_transactions_selection_menu = SelectionMenu([])
    process_transactions_selection_menu.append_item(
        add_new_transaction_function)
    process_transactions_selection_menu.append_item(
        view_transaction_history_function)

    manage_customers_submenu_item = SubmenuItem(
        "Manage customers", list_of_all_customers_submenu_item, menu)

    accounts_submenu_item = SubmenuItem("Work with accounts",
                                        work_with_accounts_selection_menu,
                                        menu)
    process_transactions_submenu_item = SubmenuItem(
        "Process Transactions", process_transactions_selection_menu, menu)

    menu.append_item(manage_customers_submenu_item)
    menu.append_item(accounts_submenu_item)
    menu.append_item(process_transactions_submenu_item)

    models.create_lenas_bank()
    menu.show()
Exemplo n.º 8
0
        @@@@@@@@@@@@@@@&%*&%%(%%(/,           .@@(% @@@@@@@@@@@@@@@
        @@@@@@@@@@@@@@@@&%%%%%%%%#(./* **///*@@@@@@@.@@@@@@@@@@@@@@
        @@@@@@@@@@@@@@@@@@&%%%%%%###( .,////@@@@@@@@@%@@@@@@@@@@@@@
        @@@@@@@@@@@@@@@@@@@@&%%%%%%#((((((&@@@@@@@@@@@@@@@@@@@@@@@@

  _____                _        _______                  _       _             
 / ____|              (_)      |__   __|                | |     | |            
| |     ___  _ __ ___  _  ___     | |_ __ __ _ _ __  ___| | __ _| |_ ___  _ __ 
| |    / _ \| '_ ` _ \| |/ __|    | | '__/ _` | '_ \/ __| |/ _` | __/ _ \| '__|
| |___| (_) | | | | | | | (__     | | | | (_| | | | \__ \ | (_| | || (_) | |   
 \_____\___/|_| |_| |_|_|\___|    |_|_|  \__,_|_| |_|___/_|\__,_|\__\___/|_|   
                                                                               
"""

if __name__ == '__main__':
    comic = ComicTranslator('images/WORK/fra/moira-1.jpg')
    menu = ConsoleMenu(logo, "A Project By Prasanth, Manish and Ratan")
    function0 = FunctionItem("Show the Image Loaded", show_image,
                             ["Show", comic.image])
    function1 = FunctionItem("Get Text Bubble Marked Image",
                             comic.mark_text_bubbles, [])
    function2 = FunctionItem("Extract the Text Bubbles",
                             comic.extract_text_bubbles, [])
    function3 = FunctionItem("Output the Translated Image!",
                             comic.output_translated_image, [])
    menu.append_item(function0)
    menu.append_item(function1)
    menu.append_item(function2)
    menu.append_item(function3)
    menu.show()
Exemplo n.º 9
0
def menu():
    menu = ConsoleMenu("Timelapse Server Console")
    menu.append_item(FunctionItem("Process the past", runDailyProcess))
    menu.append_item(FunctionItem("Preview today", previewToday))
    menu.show()
Exemplo n.º 10
0
######################################### 'Main' Code #########################################
"""

if __name__ == '__main__':

    # Creates the main Menu
    menu = ConsoleMenu(f"Passwordmanager UI", "Select an option!")

    # Creates the submenu 'Passwordmanager menu'
    password_stuff = ConsoleMenu("Passwordmanager menu", "Select an option!")
    password_stuff_submenu = SubmenuItem("Passwordmanager menu",
                                         password_stuff, menu)

    # Creates the individual components of the submenu 'Passwordmanager menu'
    password_stuff.append_item(
        FunctionItem("Show all stored entries", show_database_entries))
    password_stuff.append_item(
        FunctionItem("Add database entry", create_database_entry))
    password_stuff.append_item(
        FunctionItem("Modify database entry", modify_database_entry))
    password_stuff.append_item(
        FunctionItem("Delete database entry", delete_database_entry))
    password_stuff.append_item(
        FunctionItem("Password generator", password_generator))

    # Creates the submenu 'Database menu'
    database_stuff = ConsoleMenu(f"Database menu", "Select an option!")
    database_stuff_submenu = SubmenuItem("Database Menu", database_stuff, menu)

    # Creates the individual components of the submenu 'Database menu'
    database_stuff.append_item(
Exemplo n.º 11
0
        while True:
            try:
                print("Ready to read card...")
                _id, key = reader.read()
                print(f"ID:  {_id}")
                print(f"Key: {key}")
                print()
                sleep(1)
            except:
                break
    except:
        pass
    finally:
        GPIO.cleanup()


menu = ConsoleMenu("Door Access Control", "")

# Create some items
# Docs: https://github.com/aegirhall/console-menu
# MenuItem is the base class for all items, it doesn't do anything when selected
# menu_item = MenuItem("Add User")

# A FunctionItem runs a Python function when selected
menu.append_item(FunctionItem("Add User and Write Card", add_user))
menu.append_item(FunctionItem("Read Card", read_card))

# Finally, we call show to show the menu and allow the user to interact
menu.show()
def _show_interactive_menu(test_session, logging_specification_document):
    """Display an interactive menu for configuring the logging specification.

    Some configuration options are not available if the test session is running.

    This will return when the user invokes one of the exit menu items.
    """
    # A menu item for all menus, so that test_session.state is checked again
    refresh_test_session_state = FunctionItem("Refresh test session state",
                                              _no_op,
                                              should_exit=True)

    def _create_menu(desc, epilogue_text, menu_items):
        console_menu = ConsoleMenu("Logging Specification Document API Demo",
                                   desc,
                                   epilogue_text=epilogue_text)
        console_menu.append_item(refresh_test_session_state)
        for name, fn, args, opts in menu_items:
            menu_item = FunctionItem(name, fn, args, **opts)
            console_menu.append_item(menu_item)
        return console_menu

    edits_allowed_menu = _create_menu(
        "The test session is currently idle.",
        "",
        [
            ("Show the log file path", _show_log_file_path,
             [logging_specification_document], {}),
            ("Set the log file path", _set_log_file_path,
             [logging_specification_document], {}),
            (
                "Show all test properties",
                _show_test_properties,
                [logging_specification_document],
                {},
            ),
            ("Show a test property", _show_test_property,
             [logging_specification_document], {}),
            ("Set a test property", _set_test_property,
             [logging_specification_document], {}),
            (
                "Remove a test property",
                _remove_test_property,
                [logging_specification_document],
                {},
            ),
        ],
    )
    edits_not_allowed_menu = _create_menu(
        "The test session is currently running.",
        "",
        [
            ("Show the log file path", _show_log_file_path,
             [logging_specification_document], {}),
            (
                "Show all test properties",
                _show_test_properties,
                [logging_specification_document],
                {},
            ),
            ("Show a test property", _show_test_property,
             [logging_specification_document], {}),
        ],
    )

    while True:
        # Edits to the logging specification are not allowed while the test is running
        state = test_session.state
        if state == TestSessionState.RUNNING:
            active_menu = edits_not_allowed_menu
        elif state == TestSessionState.IDLE:
            edits_allowed_menu.subtitle = "The test session is currently idle."
            active_menu = edits_allowed_menu
        elif state == TestSessionState.NO_VALID_LOGGED_CHANNELS:
            edits_allowed_menu.subtitle = "The project has no channels to log."
            active_menu = edits_allowed_menu
        else:
            edits_allowed_menu.subtitle = "The project has one or more errors."
            active_menu = edits_allowed_menu
        active_menu.show()
        if active_menu.selected_item == active_menu.exit_item:
            break