GUI

The GUI package implements all the necessary modules to setup a user interface which uses the CORE package. This package uses the built-in Tkinter module to create the frames.

LoginFrame

This module implements one class named LoginFrame that extends the tkinter.ttk.Frame module to show a simple login frame with two text fields for the username and the master password and a button to check the data.

If the user enters its data correctly the login frame closes, and it calls to the GUI.HomeFrame

class GUI.LoginFrame.LoginFrame(root)[source]
class LoginFrame

This class setups all the widgets on a ttk.Frame and implements two functions to check if the data entered is correct and the other one is to register a new user in the database. If the data that the user enters is correct, the frame closes and the GUI.HomeFrame raises.

check_password()[source]

This function checks if the password entered by the user is correct or not. If the username is in the database and the password it’s correct, the function raise the GUI.HomeFrame with all the data from the database

register_user()[source]

This functions raises the GUI.RegisterFrame to add a new user in the database. When added, the frame closes and the user can log in with the new username.

HomeFrame

This module implements one class named HomeFrame that extends the tkinter.ttk.Frame module to show some widgets. This frame implements a table, a panel of buttons to add, modify and delete passwords; a button to copy the selected password to clipboard and a menu bar.

When the user adds, modify or deletes a password the table automatically refreshes.

class GUI.HomeFrame.HomeFrame(root, user_id)[source]
class HomeFrame

This class implements the necessary functions to show to the user a simple table with all his data and four optional buttons. It also implements a menu bar with the same functions as the buttons.

copy_to_clipboard()[source]

This functions copies to the clipboard the selected password from the table. When copied it shows a message with a successful message. If the user clicks the button and there is no password selected it shows an error message.

create_menu_bar()[source]

This function creates and displays a menu bar with different options in the main frame. The options are:

  • Add

  • Modify

  • Delete

Returns

It returns the created menu bar

Return type

tkinter.Menu

refresh_table(root, user_id)[source]

This function refresh the main frame and all its widgets. The function destroys the frame and raise it again.

Parameters
  • root – It is the Tk object needed to raise a tkinter object such as a Frame.

  • user_id – Is the id of the user logged. It’s used for the CORE functions

AddPassFrame

This module implements one class named AddPassFrame that extends the tkinter.TopLevel. This module displays a window on the top of the one who raise it. This window displays a form to enter a new password into the database. When submitted, the windows calls to HomeFrame.refresh_table() and then it destroys itself.

class GUI.AddPassFrame.AddPassFrame(root, master, user_id)[source]
class AddPassFrame

This class implements the necessary functions to display a simple form to add a new password into the database. When submitted, the window checks if the password is correctly entered twice and if it is correct the windows makes a call to HomeFrame.refresh_table() and destroys itself.

check_password()[source]

This function checks if the password is correctly entered twice; if is correct it saves the data in the database, refreshes the table in the home frame, and then it closes. If the passwords are wrong it shows an error message.

ModifyPassFrame

This module implements all necessary functions to display a simple form to modify a password selected by the user. The ModifyPassFrame extends from tkinter.Toplevel and displays a form with the different option to modify from the entry of the table. It implements one function to check the data entered by the user and modify it.

class GUI.ModifyPassFrame.ModifyPassFrame(root, master, password_id, user)[source]
class ModifyPassFrame

This class implements the necessary widgets to display a simple form to modify the password. When the user submits the data it calls to modify_password().

modify_password()[source]

When the user submits the data from the form this function is called. It checks if the entries are empty or not since the user will probably want to modify only the password and not the other entries. If all the entries are empty it will show an error message.

RegisterFrame

This module implements all necessary functions to display a simple form of registration. The RegisterFrame class extends from tkinter.Frame and implements two functions to check if the entries of the form are empty and to register a new user into the database.

class GUI.RegisterFrame.RegisterFrame(root)[source]
class RegisterFrame

This class implements the necessary widgets from Tkinter to display a simple registration form. This frame will ask for the username, the master password and the email. When submitted, it checks if there is an empty entry, and then it adds a new user to the database.

empty_entries()[source]

This function checks if the value of the entries equals a blank space or not and returns a boolean value.

Returns

If there are empty entries it returns True if not it returns False

Return type

bool

register_user()[source]

This function is called when the user submits the form, it also calls the empty_entries() method to check if either the master password or the username entry are empty. When is checked, this function adds a new user in the database with the data submitted.

Widgets

This module implements two custom widgets to add more functionalities to the GUI.HomeFrame. the two widgets are: a tkinter.LabelFrame to set up a custom table and a tkinter.PanedWindows to set up the three main buttons.

class GUI.Widgets.ButtonPanel(root, master, user)[source]
class ButtonPanel

This class is used to display a custom panel with three buttons. These buttons are the ones to add, modify and delete passwords. When these buttons are pressed they raise their respective frames to perform the actions except to delete a password.

add_new_password()[source]

This function is called when the user clicks the Add password button. When called, this function raises the GUI.AddPassFrame.

delete_password()[source]

This function is called when the user clicks the Delete password button. To delete a password the user just needs to select the row wanted and press the button. This function will check the id of the password selected and delete it after the user confirms the questions.

Except

This function excepts an IndexError if the user did not select any row from the table

modify_password()[source]

This function is called when the user clicks the Modify password button. To modify a password the user has to select the password wanted in the database and then click the button.

The function checks the id of the password selected and then raises the GUI.ModifyPassFrame. If the user did not select a password and clicks the button it will show an error message.

Except

This functions excepts an IndexError if the user did not select any row from the table and displays an error message

class GUI.Widgets.EntriesTable(root, user)[source]
class EntriesTable

This class is used to display a custom table with all the data from the user logged. The label frame contains a Treeview widget which is used to create a table since tkinter does not have a table widget implemented. The data is requested to the database and then is entered into the Treeview with loops. It also has bound an event to detect when the user selects a row of the table.

add_id_to_list()[source]

This method is called when the user clicks into a table row and adds the id of the password to the list. This list is called by HomeFrame.copy_to_clipboard()