Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***=-------------------------------------------------------=***
- Basic Contact List Manager
- BY: [REMOVED]
- Language: Python with Tkinter GUI
- ***=-------------------------------------------------------=***
- # Table of Contents
- - [Program Description](#program-description)
- - [User Stories](#user-stories)
- - [SOAP vs REST](#soap-vs-rest)
- - [RESTful API Design](#restfulapi-design)
- - [Object-oriented Design Showcase](#object-oriented-design-showcase)
- - [Coding Style](#coding-style)
- - [General OO Design of Program](#general-oo-design-of-program)
- - [Persistence](#persistence)
- - [Portability](#portability)
- - [Running the Program](#running-the-program)
- - [Installing Required Libraries](#installing-required-libraries)
- # Program Description
- This program is a basic contact list manager program.
- Here are the following things you can do on the app:
- - My Contacts: Displays contacts in the app.
- - Add Contact: Adds contact with information to the app.
- - Delete Contact: Removes selected contact from the app.
- - Export Contacts: Produces valid JSON for contacts within the system.
- - View API Calls: Displays the information retrieved from SOAP & REST calls.
- # User Stories
- ### New User Stories
- - As a user, I would like to view the currency conversion from CAD to USD so that I am up to date with the newest conversion rate without having to use google.
- - As a user, I would like the system to display a "lol cat" so that I get my daily dose of "lol cat" without having to leave the system.
- -
- ### Previous User Stories
- - As a user I would like entered contacts to be available until I delete them so that I can store my contacts in the program.
- - As a user I would like to export a single contact so that I can get one contacts information easily.
- - As a user I would like to add contacts so that I can store my contacts.
- - (Previous functionality but re-worked to have better UI. Spoke with Judi and was approved.)
- - As a user I would like to be notified if the contact was successfully added or not so that I know if a contact is successfully.
- # SOAP vs REST
- Please refer to the **`SOAPvsREST.pdf`** document found in the same folder as the README.
- # RESTful API Design
- Please refer to the **`RESTful_API_Design.pdf`** document found in the **design** folder in the same folder as the README.
- # Object-oriented Design Showcase
- ### Inheritance
- ```DEMO INFO HERE```
- ### Encapsulation
- ```DEMO INFO HERE```
- # Coding Style
- Throughout the assignment, the following coding styles were used:
- - Class names use PascalCase
- - "Private" variables use single '_' in front of them.
- - Variable names use camelCase
- # General OO Design of Program
- ### Encapsulation
- - package/model/ContactClass.py lines 6-10: Private variables for class.
- - package/model/PersonalContactClasses.py lines 7-10, 24-27, 40-42: Private variables for classes.
- - package/model/ProfessionalContactClasses.py lines 7-11, 26-28, 40-42: Private variables for classes.
- - package/controller/ContactListClass.py line 6: Private variable for class.
- > **/!\ Note**: Any variable that starts with "self._" is a private variable within the class.
- ### Overrided Methods
- - package/model/PersonalContactClasses.py lines 13,29,44
- - These methods overrides the "show" function belonging to each class. The show function displays the classes information in a string. The "show" method is inherited from the parent class and uses the parent's classes "show" functionality within it.
- - package/model/ProfessionalContactClasses.py lines 14,30,44
- - These methods overrides the "show" function belonging to each class. The show function displays the classes information in a string. The "show" method is inherited from the parent class and uses the parent's classes "show" functionality within it.
- ### Program Class's Relationships & Purpose
- - Contact Class (Abstract)
- - Location: package/model/ContactClass.py
- - Base contact class in which all other contacts inherit from.
- - Has attributes all contacts share in common. Example: (Name, Phone Number, Address)
- - ProfessionalContact Class (Abstract)
- - Location: package/model/ProfessionalContactClass.py
- - Only Colleague and HealthCare contact classes inherit from this class.
- - Has attributes only these two share in common. Example: (Office Hours, Work Number)
- - PersonalContact Class (Abstract)
- - Location: package/model/PersonalContactClass.py
- - Only Friend and Family contact classes inherit from this class.
- - Has attributes only these two share in common. Example: (Nickname, Birthday)
- - Friend/Family/Colleague/HealthCare Class
- - Location:
- - package/model/PersonalClass.py
- - package/model/ProfessionalClass.py
- - Classes the user can create within the system.
- - Only classes that can be instantiated as they are not abstract.
- - ContactList Class
- - Location: package/controller/ContactListClass.py
- - This class is the controller for the system as it houses all the functions that are used by the view in order to manipulate the model.
- - This class also conducts the logic for exporting contacts as JSON objects.
- - This class also contains the API classes and facilitates the delegation of the various API calls to retrieve the data from the REST and SOAP APIs.
- - ContactListView
- - Location: package/view/ContactListView.py
- - Creates a class that is used to make the Tkinter view.
- - This class can be used to instantiate many views for the system.
- # Persistence
- ### User Story Associated with Persistence
- The user story "As a user I would like entered contacts to be available until I delete them so that I can store my contacts in the program." is associated with persistence. This story is not possible without persistence as persistence is the storying of information for later retrieval of the program. Persistence also helps the program remember its state which is what this user story also requires.
- ### Persistence User Story within Application
- The user story associated with persistence makes the program better as a whole because without it the program is useless. Storing the user's contact information until the user deletes it is the purpose of this application.
- ### Save and Load Persistent Data Proof
- The package/controller/ContactListClass.py has two functions: saveData (line 13-16) & loadData (line 18-24)
- These functions allow the application to save the data given to the application by the user and load the saved data when the program is run.
- In order to do this, I used Pickle (Not to be confused with Pickle Rick) to serialize the data. As this is a relatively small application which will not have many different versions, using the built in Python serialization methods is acceptable.
- # Portability
- In order to test the portability aspect, click the "Export Contact" option in the side menu.
- ### Rationale For Portability
- Portability is associated with the second user story " - As a user I would like to export a single contact so that I can get one contacts information easily." for the program. Exporting uses JSON as it is a very universally used type of data sharing.
- ### Proof of Portability
- The package/controller/ContactListClass.py on line 60 - 62 has the function thats used for returning the JSON'd contact object to be displayed to the user.
- The object given was tested using: https://jsonlint.com/
- # Running the Program
- To run the program, just type `make`.
- If you do not have make installed, type:
- `{python v3 interperator} ContactListManager.py`
- Where `{python v3 interperator}` is the command required to run Python 3 on your machine. (python || python3) as per your specific machines configuration of where Python 3 is located and run.
- ## Technical Requirements
- - Uses Python 3.7.2 (3.5.4 also works as tested on NoMachine)
- - Uses tkinter version 8.6
- - Tested on Linux (NoMachine) & Mac (Using Python 3.7.2 and Tkinter 8.6)
- ## Required Libraries
- The following libraries are required:
- - **zeep**: for SOAP API Calls
- - **requests**: for REST (JSON) API Calls
- - **tkinter 8.6**: for Python GUI
- ## Checking Python & Tkinter Version
- ### Checking Python Version
- Use `python --version` to check the version of python you have as default.
- > **/!\ Note**: (SOCS Servers returns 2.7.13)
- Use `python3 --version` to check the version of Python 3 you have installed if any.
- > **/!\ Note**: (SOCS Servers returns 3.5)
- ### Checking Tkinter Version
- 1. Enter `python3` or `python` (Version for Python3 on your computer)
- 2. Enter `import tkiner as tk`
- 3. If step 2 fails, try `import Tkiner as tk`
- 4. If steps 2 and 3 fail, you do not have Tkinter. Please check the **Installing Required Libraries** section.
- 5. Enter `tk.TkVersion`
- 6. Ensure that the version given is 8.6 If not, please check Install Instructions.
- 7. Enter `exit()` to exit.
- # Installing Required Libraries
- You can install the required "zeep" and "requests" libraries by running
- the following commands:
- - `pip install zeep`
- - `pip install requests`
- To install Python (With Tkinter) please follow these instructions:
- >/!\ Note: When installing Python DO NOT use Homebrew. Homebrew Tkinter package is NOT included which is required for this project.
- >/!\ Note: The python.org version of Python comes with the appropriate version of Tkinter.
- - Windows: https://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/python.html
- >/!\Note: Install the latest version of 3.7 instead of the suggested 3.7.0
- - Mac:
- 1. Go to https://www.python.org/downloads/
- 2. Click the Big Yellow Button that says "Download Python 3.7.2"
- 3. Wait for installer to download.
- 4. Run the Python Installer.
- 5. Verify that the installer was successful by following steps in the **Checking Python & Tkinter Version** section of the README.
- - Linux: https://docs.python-guide.org/starting/install3/linux/
- # Known Limitations
- - Buttons have messed up colours. Known Tkinter issue for mac.
- - Unable to use underscores within program as they are replaced with ''
- - Command/Control + Q does not save the program's data.
- - Linux has issues displaying the GUI and looks poorly laid out.
- # Added Changes from Peer Review
- - Changed getters and setters to properties
- # Sources
- - https://stackoverflow.com/questions/7498658/importerror-when-importing-tkinter-in-python
- - https://krzysztofzuraw.com/blog/2016/makefiles-in-python-projects.html
- - http://net-informations.com/python/iq/interfaces.htm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement