Skip to content

AMRHiwa/to_do_list_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

To Do List Project

In the "To Do List" program, it has been tried to be implemented in Python and this program is a program that can be implemented in the terminal environment or the command prompt environment.

"To-do list" is a program for managing the list of tasks that we need to do, which gives us the ability to put our tasks in our list by title, necessity, completion, and this list can be updated. and added, reduced or changed its items.

This guide is prepared for you in two parts:

Program guide :

This program is developed for command prompt and terminal environment. To use this program, just download the source code file and save it in your computer memory.

The tools of this program are as follows:

Add Item

In this section, you can add new items to the program. Just enter the following command in the command prompt environment:

python todo.py create title priority done

if you don't give it the priority and done of your work, the program set medium and 0 as default for them.

Delete Item

In this section, you can delete the items by them names. Just enter the following command in the command prompt environment:

python todo.py delete title

If there is an item with such a title, it will be removed from the list.

Show List

In this section, you can watch your To-Do list. Just enter the following command in the command prompt environment:

python todo.py list

If you enter this command, you will see a structure

like this:

Task List:
Index Title Priority Done
1 Task 1 Low 1
2 Task 2 Medium 0

Update Item

In this section, you can edit your To-Do list priority or Done feature of your Item by its title. Just enter the following command in the command prompt environment:

python todo.py update title priority new-value

or

python todo.py update title Done new-value

Clear Items

In this section, you can delete all items. Just enter the following command in the command prompt environment:

python todo.py clear

In this section, you can Search the items by them names. Just enter the following command in the command prompt environment:

python todo.py search title



Structure of program :

This program is implemented by two classes and a function, whose features are mentioned below:

Class Task:

Using an initial function, this class considers and creates an object with the attributes title, priority, and done for better management of tasks.

TodoList Task:

This class is used to manage "tasks" in the program and the following methods are defined and implemented to implement this management:
init:

In this method, we store the "path to save the file" in a variable called file_name, consider an empty list to store tasks in the tasks variable, and then call the load_tasks method to retrieve the information from the data file.

load_tasks:

In this method, it reads the information stored in the data file and then stores it as a series of objects from the task class in the tasks variable.

save_tasks:

In this method, the information stored in the task variable is read, and then the former information is placed in the data file in a special format.

create_tasks:

In this method, a new object of the task class is created by getting the information of the task title, task priority, and task completion status and saves it in the tasks variable.

list_tasks:

This method first reads the data file and then displays all the saved tasks as a table in the output.

update_task:

This method uses the title that the user enters in the list of tasks and updates the desired task based on priority or completion status and saves it again in the data file.

delete_task:

This method first takes a title among the tasks, and if it finds the desired task, it deletes it and then re-places the remaining tasks in the data file.

clear_list:

This method deletes all the tasks stored in the data file.

get_task:

By taking the title of a task, this method finds it in the list of tasks stored in the data file and displays it to the user if it exists.

main Function:

This function, which is in charge of the main operation, first creates an object of the todolist class, then notices what command the user enters and how many arguments he has passed in addition to the main command, and calls the desired functions based on the input.