Переглянути джерело

updated the notification message and added more documentation

master
Wouter Horlings 6 роки тому
джерело
коміт
9145acf5e7
1 змінених файлів з 18 додано та 2 видалено
  1. +18
    -2
      myTodoist.py

+ 18
- 2
myTodoist.py Переглянути файл

@@ -25,9 +25,14 @@ def fromisoformat(datestr):
else:
return None

##@class TodoProject
# @brief functions to load a single or all projects and has methods to check the state of the project
class TodoProject:
''' Common class for api calls'''

##@brief constructor of class
# tries to load api-token from apikey-file.
# @param project String with project name or integer with project_id
def __init__(self,project=None):
fh_api = open("apikey","r")
self.apikey = fh_api.read()
@@ -48,8 +53,9 @@ class TodoProject:
return self.api.sync()

def checktaskstoday(self,tasklimit):
if len(self.items.itemsForDay()) < tasklimit:
self.sendnotification("TASKS","Not enough Tasks Scheduled for today!")
numOfItems = len(self.items.itemsForDay())
if numOfItems < tasklimit:
self.sendnotification("TASKS","Not enough Tasks Scheduled for today!\n" + "Only " + str(numOfItems) + " of " + str(tasklimit) + " tasks set!" )

def checkTasksWithoutNotes(self,date=date.today()):
if len(self.items.itemsClosedWithoutNotes())>0:
@@ -126,6 +132,16 @@ class TodoItemList:
_items.append(item)
return _items

##@brief get all items that are due for specified day and not closed yet.
# @_date date-object to specify the search day. Defaults to today.
# @return list of items that have a duedate as specified in _date and are still open.
def pendingItemsForDay(self,_date=date.today()):
_items = []
for item in self.items:
if item.dueOnDate(_date) and not item.checked:
_items.append(item)
return _items

##@brief get all items that closed but do not have notes attached to them
# @return list of closed items that do not have notes attached.
def itemsClosedWithoutNotes(self):


Завантаження…
Відмінити
Зберегти