Пример #1
0
def change_account_details(main_page):
    """ Depending on the imput changes account details in 'data.csv'"""

    header = "What do you want to change?"
    change_choices = (('Name', change_name), ('Surname', change_surname),
                      ('Password', change_password), ('To exit', log.exit))

    change_account = Screen(header, change_choices, main_page.login,
                            main_page.password)

    change_account.activate()
Пример #2
0
def intro():
    """Loads intro screen"""

    header = """
            LOGIN______________________________
            Welcome to the LIBRARY 6000 system!"""

    choice = namedtuple('Choice', ['desc', 'func'])

    choices = (choice('To log in', log.log_in_and_go_to_main_page),
               choice('To create a new account', log.create_account),
               choice('To admin funcions',
                      lib.librarian), choice('To exit', exit.exit))

    intro = Screen(header, choices)
    intro.activate()
Пример #3
0
def search_for_books(
        main_page):  # Add information to the printout if the book is rented
    """Ask for the type of search and then lists books based of the criteria"""

    type_of_search = 0

    header = """
    Do you want to search for books by the first letter of the title
    or by the type?
            """
    search_choices = (("To search by letter", search_by_letter),
                      ("To search by type",
                       search_by_type), ("To exit", exit.exit_to_main))

    book_search = Screen(header, search_choices, main_page.login,
                         main_page.password)
    book_search.activate()
Пример #4
0
def librarian(main_page):
    """Admins domain with access to admin funcitons """

    admin_header = """
            ADMIN___________________________
            This is librairian account. What do you want to do?
                """
    choice = namedtuple('Choice', ['desc', 'func'])

    admin_choices = (choice("Return a book", return_single_book),
                     choice("Add a book", adding_books),
                     choice("Delete a book", deleting_books),
                     choice("Check person database", person_search),
                     choice("Delete users account", if_to_delete_user),
                     choice("To quit", exit.exit_to_intro))

    admin_page = Screen(admin_header, admin_choices, main_page)
    while True:
        admin_page.activate()
Пример #5
0
def main_page(login, password):
    """Loads main page of the user"""

    main_header = """
            ACCOUNT_________________
            Welcome to your page
            What do you want to do?
            """

    choice = namedtuple('Choice', ['desc', 'func'])

    main_choices = (
        choice('Search for a book', ac.search_for_books),
        choice('Check your books', ac.check_my_books),  # LOGIN?
        choice('Rent a book', ac.rent_book),  # LOGIN?
        choice('Change your account data', ac.change_account_details),
        choice('Log out', exit.exit_to_intro))

    main_page = Screen(main_header, main_choices, login, password)
    while True:
        main_page.activate()
Пример #6
0
 def activate(self):
     Screen.activate(self)
     self._active_mutex.acquire()
     self._active_mutex.notifyAll()
     self._active_mutex.release()