Beispiel #1
0
def modify_entry(will_delete=False):
    """Will modify or delete an entry. Pass True to delete. """
    print("Modifying existing entry.")
    list_modify_select = search.search_tool()  #Will return a
    if len(list_modify_select) > 0:  #If the list returns anything.

        menu.print_sub_list(list_modify_select, "Choose an entry to modify.")

        while True:
            entry_select_command = menu.get_option()
            if entry_select_command > len(
                    list_modify_select
            ) or entry_select_command < 0:  #Is the user's choice in the range of the list.
                print("That value is out of range.")
            else:
                modified_data_index = index_finder(data.container_phonebook,
                                                   list_modify_select,
                                                   entry_select_command)
                if will_delete == False:
                    change_phone_number(modified_data_index)
                    break
                else:
                    delete_entry(
                        modified_data_index,
                        ("{first_name} {last_name}: {number}".format(
                            **list_modify_select[entry_select_command])))
                    break
Beispiel #2
0
def modify_menu():

    print("Choose an option.")
    print("1. Create a new Entry")
    print("2. Modify an existing Entry.")
    modify_command = menu.get_option()
    if modify_command == 1:
        create_new_entry()
    elif modify_command == 2:
        modify_entry()
Beispiel #3
0
    async def send_file_async(self):

        file_name = 'README.md'
        receiver = get_option('Para: ')

        stream = await self['xep_0047'].open_stream(receiver)

        with open(file_name) as f:
            data = f.read()
            stream.sendall(data)
import data
import menu
import search
import modify
import list
while True:
    menu.main_menu()
    command = menu.get_option()

    if command == 1:
        search.search_tool(True)
    elif command == 2:
        modify.modify_menu()
    elif command == 3:
        modify.modify_entry(True)
    elif command == 4:
        list.list_all()
    elif command == 5:
        exit(0)
Beispiel #5
0
 def add_to_roster(self):
     jid = get_option('jid: ')
     self.send_presence_subscription(pto=jid)
Beispiel #6
0
 def get_one_user(self):
     jid = get_option('jid: ')
     print(self.roster[self.jid][jid])
Beispiel #7
0
    def change_status(self):
        status = get_option('Nuevo status: ')
        while status not in possible_status:
            status = get_option('Nuevo status: ')

        self.make_presence(pshow=status)
Beispiel #8
0
 def send_individual_message(self):
     mto = get_option('Para: ')
     mbody = get_option('Contenido: ')
     self.send_message(mto=mto, mbody=mbody)
Beispiel #9
0
from common import *
from shoes_management import get_predefined_shoe_list
import menu

option = '0'

# sleep(1)
# Limpia la pantalla
clear()
# Obtiene la lista predeterminada de zapatos.
# shoe_list = get_shoe_list()
shoe_list = get_predefined_shoe_list()

# print(get_predefined_shoe_list.__doc__)
# help(get_predefined_shoe_list)

# Mientras que la opción no sea "5", no se sale de la aplicación.
while option != '5':
    menu.display_menu()
    option = menu.execute_option(shoe_list, menu.get_option())