-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entry.py
66 lines (54 loc) · 2.36 KB
/
Entry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Import CSV class and Error class
from CSV import CSV
from Errors import Error
# Class containing all entry functions
class Entry:
"""
Entry class is used for interaction with an Entry between the work_log and the
CSV class. Most of the functions in this class simply pass down variables or
display them in a neater way. Init initializes the CSV and Errors class, and
the entry class uses user input to create a new entry.
"""
# Init initializes CSV/Error class to use in other functions
def __init__(self):
self.my_csv = CSV()
self.error = Error()
# Add an entry to CSV file
def add(self):
# Set date, name, time, and notes, check for errors on first 3 (Notes are optional)
date = self.error.time_error()
name = self.error.empty_task_error()
time = self.error.time_spent_error()
notes = input("Enter any additional notes on the entry (optional)\n>>")
# Pass down variables to writer in CSV, print confirmation
self.my_csv.writer(date, name, time, notes)
input("This entry has been added. Press enter to return to the main menu!")
# Delete an Entry (pass info)
def delete(self, to_delete):
self.my_csv.delete_entry(to_delete)
# Edit an Entry (pass info)
def edit(self, list_edit, item_edit):
self.my_csv.edit_entry(list_edit, item_edit)
# Search by date Range (pass info)
def range(self, date1, date2):
self.my_csv.reader5(date1, date2)
# Used for appending whole row while looking in entire row
def list_display(self, look):
new_list = [x for x in self.my_csv.reader(look)]
return new_list
# Used for appending whole row while looking at Task Name and Additional Notes
def list_display2(self, look):
new_list = [x for x in self.my_csv.reader2(look)]
return new_list
# Used for appending whole row while looking at Task Name and Additional Notes with REGEX
def list_display3(self, look):
new_list = [x for x in self.my_csv.reader3(look)]
return new_list
# Used for appending whole row while looking at Time Spent
def list_display4(self, look):
new_list = [x for x in self.my_csv.reader4(look)]
return new_list
# Used to display available dates
def display_dates(self):
for x in self.my_csv.date_reader():
print(x)